Bugfix/using-uint16-for-units-property-storage (#1107)

* Fixed units property declaration in basic Analog Input header file to be uint16_t instead of uint8_t.

* Added range checking of units property in example objects WriteProperty handler.
This commit is contained in:
Steve Karg
2025-09-24 09:35:10 -05:00
committed by GitHub
parent b357bca5dd
commit 7dfc840dfc
8 changed files with 91 additions and 23 deletions
+14
View File
@@ -586,6 +586,20 @@ bool Integer_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
wp_data->object_instance, value.type.Boolean);
}
break;
case PROP_UNITS:
status = write_property_type_valid(
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
if (status) {
if (value.type.Enumerated <= UINT16_MAX) {
Integer_Value_Units_Set(
wp_data->object_instance, value.type.Enumerated);
} else {
status = false;
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
}
}
break;
default:
if (property_lists_member(
Integer_Value_Properties_Required,