Bugfix/property array element zero size (#908)
* Changed BACnetARRAY index validation into ReadProperty, ReadPropertyMultiple, WriteProperty, and WritePropertyMultiple handlers. * Changed the basic and example objects after refactoring BACnetARRAY index validation into ReadProperty, ReadPropertyMultiple, WriteProperty, and WritePropertyMultiple handlers. * Added BACnet application decoder that understands that an array element of zero is an unsigned integer tagged value. Fixes RP and RPM apps when reading the array element zero of arrays.
This commit is contained in:
@@ -60,17 +60,6 @@ static const int Time_Value_Properties_Optional[] = { PROP_DESCRIPTION,
|
||||
|
||||
static const int Time_Value_Properties_Proprietary[] = { -1 };
|
||||
|
||||
/* standard properties that are arrays for this object,
|
||||
but not necessary supported in this object */
|
||||
static const int BACnetARRAY_Properties[] = { PROP_PRIORITY_ARRAY,
|
||||
PROP_EVENT_TIME_STAMPS,
|
||||
PROP_EVENT_MESSAGE_TEXTS,
|
||||
PROP_EVENT_MESSAGE_TEXTS_CONFIG,
|
||||
PROP_VALUE_SOURCE_ARRAY,
|
||||
PROP_COMMAND_TIME_ARRAY,
|
||||
PROP_TAGS,
|
||||
-1 };
|
||||
|
||||
/**
|
||||
* Returns the list of required, optional, and proprietary properties.
|
||||
* Used by ReadPropertyMultiple service.
|
||||
@@ -428,16 +417,6 @@ bool Time_Value_Description_Set(uint32_t object_instance, const char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Determine if the object property is a BACnetARRAY property
|
||||
* @param object_property - object-property to be checked
|
||||
* @return true if the property is a BACnetARRAY property
|
||||
*/
|
||||
static bool BACnetARRAY_Property(int object_property)
|
||||
{
|
||||
return property_list_member(BACnetARRAY_Properties, object_property);
|
||||
}
|
||||
|
||||
bool Time_Value_Change_Of_Value(uint32_t object_instance)
|
||||
{
|
||||
bool status = false;
|
||||
@@ -591,13 +570,6 @@ int Time_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = BACNET_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
/* only array properties can have array options */
|
||||
if ((apdu_len >= 0) && (!BACnetARRAY_Property(rpdata->object_property)) &&
|
||||
(rpdata->array_index != BACNET_ARRAY_ALL)) {
|
||||
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
||||
rpdata->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
|
||||
apdu_len = BACNET_STATUS_ERROR;
|
||||
}
|
||||
|
||||
return apdu_len;
|
||||
}
|
||||
@@ -627,13 +599,6 @@ bool Time_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
|
||||
return false;
|
||||
}
|
||||
if ((!BACnetARRAY_Property(wp_data->object_property)) &&
|
||||
(wp_data->array_index != BACNET_ARRAY_ALL)) {
|
||||
/* only array properties can have array options */
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
|
||||
return false;
|
||||
}
|
||||
switch (wp_data->object_property) {
|
||||
case PROP_PRESENT_VALUE:
|
||||
if (Time_Value_Out_Of_Service(wp_data->object_instance)) {
|
||||
|
||||
Reference in New Issue
Block a user