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; error = len;
goto RPM_FAILURE; goto RPM_FAILURE;
} }
decode_len += len; decode_len += len;
/* handle the special properties */ /* handle the special properties */
if ((rpmdata.object_property == PROP_ALL) || if ((rpmdata.object_property == PROP_ALL) ||
@@ -276,27 +275,31 @@ void handler_read_property_multiple(
unsigned index = 0; unsigned index = 0;
BACNET_PROPERTY_ID special_object_property; BACNET_PROPERTY_ID special_object_property;
special_object_property = rpmdata.object_property; if (rpmdata.array_index != BACNET_ARRAY_ALL) {
Device_Objects_Property_List(rpmdata.object_type, &property_list); /* No array index options for this special property.
property_count = Encode error for this object property response */
RPM_Object_Property_Count(&property_list,
special_object_property);
if (property_count == 0) {
/* handle the error code - but use the special property */
len = len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0], rpm_ack_encode_apdu_object_property_error(&Temp_Buf[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata); ERROR_CLASS_PROPERTY,
if (len > 0) { ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY);
apdu_len += len; copy_len =
} else { memcopy(&Handler_Transmit_Buffer[0],
error = len; &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; goto RPM_FAILURE;
} }
apdu_len += len;
} else { } else {
for (index = 0; index < property_count; index++) { special_object_property = rpmdata.object_property;
rpmdata.object_property = Device_Objects_Property_List(rpmdata.object_type, &property_list);
RPM_Object_Property(&property_list, property_count =
special_object_property, index); RPM_Object_Property_Count(&property_list,
special_object_property);
if (property_count == 0) {
/* handle the error code - but use the special property */
len = len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0], RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata); (uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata);
@@ -306,6 +309,21 @@ void handler_read_property_multiple(
error = len; error = len;
goto RPM_FAILURE; 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 { } else {
@@ -375,7 +393,7 @@ void handler_read_property_multiple(
} else if (error == BACNET_STATUS_ERROR){ } else if (error == BACNET_STATUS_ERROR){
apdu_len = apdu_len =
bacerror_encode_apdu(&Handler_Transmit_Buffer[npdu_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); rpmdata.error_class, rpmdata.error_code);
#if PRINT_ENABLED #if PRINT_ENABLED
fprintf(stderr, "RP: Sending Error!\n"); fprintf(stderr, "RP: Sending Error!\n");