Added error code when array option is passed to special properties ALL, OPTIONAL, REQUIRED.

This commit is contained in:
skarg
2010-07-16 14:34:15 +00:00
parent 0b5efa5be5
commit 7852309f7e
+37 -19
View File
@@ -265,7 +265,6 @@ void handler_read_property_multiple(
error = len;
goto RPM_FAILURE;
}
decode_len += len;
/* handle the special properties */
if ((rpmdata.object_property == PROP_ALL) ||
@@ -276,27 +275,31 @@ void handler_read_property_multiple(
unsigned index = 0;
BACNET_PROPERTY_ID special_object_property;
special_object_property = rpmdata.object_property;
Device_Objects_Property_List(rpmdata.object_type, &property_list);
property_count =
RPM_Object_Property_Count(&property_list,
special_object_property);
if (property_count == 0) {
/* handle the error code - but use the special property */
if (rpmdata.array_index != BACNET_ARRAY_ALL) {
/* No array index options for this special property.
Encode error for this object property response */
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata);
if (len > 0) {
apdu_len += len;
} else {
error = len;
rpm_ack_encode_apdu_object_property_error(&Temp_Buf[0],
ERROR_CLASS_PROPERTY,
ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY);
copy_len =
memcopy(&Handler_Transmit_Buffer[0],
&Temp_Buf[0], npdu_len + apdu_len,
len, sizeof(Handler_Transmit_Buffer));
if (copy_len == 0) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
goto RPM_FAILURE;
}
apdu_len += len;
} else {
for (index = 0; index < property_count; index++) {
rpmdata.object_property =
RPM_Object_Property(&property_list,
special_object_property, index);
special_object_property = rpmdata.object_property;
Device_Objects_Property_List(rpmdata.object_type, &property_list);
property_count =
RPM_Object_Property_Count(&property_list,
special_object_property);
if (property_count == 0) {
/* handle the error code - but use the special property */
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata);
@@ -306,6 +309,21 @@ void handler_read_property_multiple(
error = len;
goto RPM_FAILURE;
}
} else {
for (index = 0; index < property_count; index++) {
rpmdata.object_property =
RPM_Object_Property(&property_list,
special_object_property, index);
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata);
if (len > 0) {
apdu_len += len;
} else {
error = len;
goto RPM_FAILURE;
}
}
}
}
} else {
@@ -375,7 +393,7 @@ void handler_read_property_multiple(
} else if (error == BACNET_STATUS_ERROR){
apdu_len =
bacerror_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id, SERVICE_CONFIRMED_READ_PROPERTY,
service_data->invoke_id, SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
rpmdata.error_class, rpmdata.error_code);
#if PRINT_ENABLED
fprintf(stderr, "RP: Sending Error!\n");