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:
@@ -262,7 +262,6 @@ int Trend_Log_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
BACNET_CHARACTER_STRING char_string;
|
||||
TL_LOG_INFO *CurrentLog;
|
||||
uint8_t *apdu = NULL;
|
||||
bool is_array;
|
||||
|
||||
if ((rpdata == NULL) || (rpdata->application_data == NULL) ||
|
||||
(rpdata->application_data_len == 0)) {
|
||||
@@ -405,15 +404,6 @@ int Trend_Log_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
apdu_len = BACNET_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
/* only array properties can have array options */
|
||||
is_array = property_list_bacnet_array_member(
|
||||
rpdata->object_type, rpdata->object_property);
|
||||
if ((apdu_len >= 0) && (!is_array) &&
|
||||
(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;
|
||||
}
|
||||
@@ -429,16 +419,7 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE TempSource;
|
||||
bool bEffectiveEnable;
|
||||
int log_index;
|
||||
bool is_array;
|
||||
|
||||
/* only array properties can have array options */
|
||||
is_array = property_list_bacnet_array_member(
|
||||
wp_data->object_type, wp_data->object_property);
|
||||
if (!is_array && (wp_data->array_index != BACNET_ARRAY_ALL)) {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
|
||||
return false;
|
||||
}
|
||||
/* Pin down which log to look at */
|
||||
log_index = Trend_Log_Instance_To_Index(wp_data->object_instance);
|
||||
CurrentLog = &LogInfo[log_index];
|
||||
|
||||
Reference in New Issue
Block a user