Refactor/property lists member function (#609)

* Refactor property lists member function for WriteProperty default case.

* Refactor time-value object unit testing

* Added test for unsupported property to common property test
This commit is contained in:
Steve Karg
2024-03-27 09:52:01 -05:00
committed by GitHub
parent 4e0a37fd75
commit 6bd1942635
14 changed files with 118 additions and 304 deletions
+3 -30
View File
@@ -380,34 +380,6 @@ void Command_Property_Lists(
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;
Command_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;
}
/**
* Initializes the Command object data
*/
@@ -828,8 +800,9 @@ bool Command_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
}
break;
default:
if (Property_List_Member(
wp_data->object_instance, wp_data->object_property)) {
if (property_lists_member(
Command_Properties_Required, Command_Properties_Optional,
Command_Properties_Proprietary, wp_data->object_property)) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else {