Fixed error-code returned when an object does not support WriteProperty but has properties that are known. (#912)

This commit is contained in:
Steve Karg
2025-02-12 16:54:40 -06:00
committed by GitHub
parent ae135cd368
commit 7b9d6d7dc5
8 changed files with 383 additions and 20 deletions
+40 -2
View File
@@ -307,6 +307,35 @@ void Device_Objects_Property_List(
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;
}
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Device_Properties_Required[] = {
PROP_OBJECT_IDENTIFIER,
@@ -1738,8 +1767,17 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
status = pObject->Object_Write_Property(wp_data);
}
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
if (Device_Objects_Property_List_Member(
wp_data->object_type, wp_data->object_instance,
wp_data->object_property)) {
/* this property is not writable */
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_WRITE_ACCESS_DENIED;
} else {
/* this property is not supported */
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_UNKNOWN_PROPERTY;
}
}
} else {
wp_data->error_class = ERROR_CLASS_OBJECT;
+29
View File
@@ -256,6 +256,35 @@ void Device_Objects_Property_List(
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;
}
/* These three arrays are used by the ReadPropertyMultiple handler */
static const int Device_Properties_Required[] = {
PROP_OBJECT_IDENTIFIER,