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:
@@ -997,7 +997,13 @@ bool Analog_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
status = write_property_type_valid(
|
||||
wp_data, &value, BACNET_APPLICATION_TAG_ENUMERATED);
|
||||
if (status) {
|
||||
CurrentAV->Units = value.type.Enumerated;
|
||||
if (value.type.Enumerated <= UINT16_MAX) {
|
||||
CurrentAV->Units = value.type.Enumerated;
|
||||
} else {
|
||||
status = false;
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_COV_INCREMENT:
|
||||
|
||||
Reference in New Issue
Block a user