Added prototype for device object property list member to use for storing device data storing. (#735)

This commit is contained in:
Steve Karg
2024-08-19 09:32:52 -05:00
committed by GitHub
parent 032bf10994
commit f09a0ce5ed
3 changed files with 55 additions and 72 deletions
+40 -39
View File
@@ -537,6 +537,35 @@ void Device_Property_Lists(
return; return;
} }
/**
* @brief Determine if the object property is a member of this object instance
* @param object_type - object type of the object
* @param object_instance - object-instance number of the object
* @param object_property - object-property to be checked
* @return true if the property is a member of this object instance
*/
bool Device_Objects_Property_List_Member(
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_PROPERTY_ID object_property)
{
bool found = false;
struct special_property_list_t property_list = { 0 };
Device_Objects_Property_List(object_type, object_instance, &property_list);
found = property_list_member(property_list.Required.pList, object_property);
if (!found) {
found =
property_list_member(property_list.Optional.pList, object_property);
}
if (!found) {
found = property_list_member(property_list.Proprietary.pList,
object_property);
}
return found;
}
/* note: you really only need to define variables for /* note: you really only need to define variables for
properties that are writable or that may change. properties that are writable or that may change.
The properties that are constant can be hard coded The properties that are constant can be hard coded
@@ -1745,13 +1774,6 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
} }
} }
break; break;
#else
case PROP_TIME_SYNCHRONIZATION_INTERVAL:
case PROP_ALIGN_INTERVALS:
case PROP_INTERVAL_OFFSET:
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
break;
#endif #endif
case PROP_UTC_OFFSET: case PROP_UTC_OFFSET:
status = write_property_type_valid( status = write_property_type_valid(
@@ -1796,40 +1818,19 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
} }
} }
break; break;
#else
case PROP_MAX_INFO_FRAMES:
case PROP_MAX_MASTER:
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
break;
#endif #endif
case PROP_OBJECT_TYPE:
case PROP_VENDOR_NAME:
case PROP_FIRMWARE_REVISION:
case PROP_APPLICATION_SOFTWARE_VERSION:
case PROP_LOCAL_TIME:
case PROP_LOCAL_DATE:
case PROP_DAYLIGHT_SAVINGS_STATUS:
case PROP_PROTOCOL_VERSION:
case PROP_PROTOCOL_REVISION:
case PROP_PROTOCOL_SERVICES_SUPPORTED:
case PROP_PROTOCOL_OBJECT_TYPES_SUPPORTED:
case PROP_OBJECT_LIST:
case PROP_MAX_APDU_LENGTH_ACCEPTED:
case PROP_SEGMENTATION_SUPPORTED:
case PROP_DEVICE_ADDRESS_BINDING:
case PROP_DATABASE_REVISION:
case PROP_ACTIVE_COV_SUBSCRIPTIONS:
#if defined(BACNET_TIME_MASTER)
case PROP_TIME_SYNCHRONIZATION_RECIPIENTS:
#endif
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
break;
default: default:
wp_data->error_class = ERROR_CLASS_PROPERTY; if (property_lists_member(
wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY; Device_Properties_Required,
break; Device_Properties_Optional,
Device_Properties_Proprietary,
wp_data->object_property)) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
}
} }
return status; return status;
+6
View File
@@ -274,6 +274,12 @@ extern "C" {
BACNET_OBJECT_TYPE object_type, BACNET_OBJECT_TYPE object_type,
uint32_t object_instance, uint32_t object_instance,
struct special_property_list_t *pPropertyList); struct special_property_list_t *pPropertyList);
BACNET_STACK_EXPORT
bool Device_Objects_Property_List_Member(
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_PROPERTY_ID object_property);
/* functions to support COV */ /* functions to support COV */
BACNET_STACK_EXPORT BACNET_STACK_EXPORT
bool Device_Encode_Value_List( bool Device_Encode_Value_List(
+9 -33
View File
@@ -463,34 +463,6 @@ void Device_Property_Lists(
return; return;
} }
/**
* @brief Determine if the object property is a member of this object instance
* @param object_instance - object-instance number of the object
* @param object_property - object-property to be checked
* @return true if the property is a member of this object instance
*/
static bool Property_List_Member(
uint32_t object_instance, int object_property)
{
bool found = false;
const int *pRequired = NULL;
const int *pOptional = NULL;
const int *pProprietary = NULL;
(void)object_instance;
Device_Property_Lists(
&pRequired, &pOptional, &pProprietary);
found = property_list_member(pRequired, object_property);
if (!found) {
found = property_list_member(pOptional, object_property);
}
if (!found) {
found = property_list_member(pProprietary, object_property);
}
return found;
}
/** /**
* @brief Determine if the object property is a member of this object instance * @brief Determine if the object property is a member of this object instance
* @param object_type - object type of the object * @param object_type - object type of the object
@@ -498,9 +470,10 @@ static bool Property_List_Member(
* @param object_property - object-property to be checked * @param object_property - object-property to be checked
* @return true if the property is a member of this object instance * @return true if the property is a member of this object instance
*/ */
bool Device_Objects_Property_List_Member(BACNET_OBJECT_TYPE object_type, bool Device_Objects_Property_List_Member(
uint32_t object_instance, BACNET_OBJECT_TYPE object_type,
int object_property) uint32_t object_instance,
BACNET_PROPERTY_ID object_property)
{ {
bool found = false; bool found = false;
struct special_property_list_t property_list = { 0 }; struct special_property_list_t property_list = { 0 };
@@ -1304,8 +1277,11 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
} }
break; break;
default: default:
if (Property_List_Member( if (property_lists_member(
wp_data->object_instance, wp_data->object_property)) { Device_Properties_Required,
Device_Properties_Optional,
Device_Properties_Proprietary,
wp_data->object_property)) {
wp_data->error_class = ERROR_CLASS_PROPERTY; wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED; wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else { } else {