Corrected context decoding bug in ReadPropertyMultiple client. Corrected ReadPropertyMultiple handling of objects that aren't supported. Added the context to application tags for the Load Control object.

This commit is contained in:
skarg
2009-02-21 19:12:31 +00:00
parent c23b6c2742
commit d45d566c94
4 changed files with 58 additions and 20 deletions
+42 -12
View File
@@ -148,12 +148,24 @@ static void RPM_Property_List(
break;
}
/* fill the count */
pPropertyList->Required.count =
property_list_count(pPropertyList->Required.pList);
pPropertyList->Optional.count =
property_list_count(pPropertyList->Optional.pList);
pPropertyList->Proprietary.count =
property_list_count(pPropertyList->Proprietary.pList);
if (pPropertyList->Required.pList) {
pPropertyList->Required.count =
property_list_count(pPropertyList->Required.pList);
} else {
pPropertyList->Required.count = 0;
}
if (pPropertyList->Optional.pList) {
pPropertyList->Optional.count =
property_list_count(pPropertyList->Optional.pList);
} else {
pPropertyList->Optional.count = 0;
}
if (pPropertyList->Proprietary.pList) {
pPropertyList->Proprietary.count =
property_list_count(pPropertyList->Proprietary.pList);
} else {
pPropertyList->Proprietary.count = 0;
}
return;
}
@@ -405,10 +417,8 @@ void handler_read_property_multiple(
property_count =
RPM_Object_Property_Count(&property_list,
special_object_property);
for (index = 0; index < property_count; index++) {
object_property =
RPM_Object_Property(&property_list,
special_object_property, index);
if (property_count == 0) {
/* handle the error code - but use the special property */
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
npdu_len + apdu_len, sizeof(Handler_Transmit_Buffer),
@@ -418,11 +428,31 @@ void handler_read_property_multiple(
apdu_len += len;
} else {
apdu_len =
abort_encode_apdu(&Handler_Transmit_Buffer
[npdu_len], service_data->invoke_id,
abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
goto RPM_ABORT;
}
} else {
for (index = 0; index < property_count; index++) {
object_property =
RPM_Object_Property(&property_list,
special_object_property, index);
len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0],
npdu_len + apdu_len, sizeof(Handler_Transmit_Buffer),
object_type, object_instance, object_property,
array_index);
if (len > 0) {
apdu_len += len;
} else {
apdu_len =
abort_encode_apdu(&Handler_Transmit_Buffer
[npdu_len], service_data->invoke_id,
ABORT_REASON_SEGMENTATION_NOT_SUPPORTED, true);
goto RPM_ABORT;
}
}
}
} else {
/* handle an individual property */
+13 -2
View File
@@ -85,6 +85,10 @@ static int rpm_ack_decode_service_request(
&rpm_property->propertyArrayIndex);
if (len <= 0) {
old_rpm_property->next = NULL;
if (rpm_object->listOfProperties == rpm_property) {
/* was this the only property in the list? */
rpm_object->listOfProperties = NULL;
}
free(rpm_property);
break;
}
@@ -102,8 +106,15 @@ static int rpm_ack_decode_service_request(
rpm_property->value = value;
old_value = value;
while (value && (apdu_len > 0)) {
len =
bacapp_decode_application_data(apdu, apdu_len, value);
if (decode_is_context_specific(apdu)) {
len =
bacapp_decode_context_data(
apdu, apdu_len, value,
rpm_property->propertyIdentifier);
} else {
len =
bacapp_decode_application_data(apdu, apdu_len, value);
}
decoded_len += len;
apdu_len -= len;
apdu += len;
+1 -6
View File
@@ -713,6 +713,7 @@ int Load_Control_Encode_Property_APDU(
object_instance);
break;
case PROP_OBJECT_NAME:
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,
Load_Control_Name(object_instance));
apdu_len =
@@ -722,12 +723,6 @@ int Load_Control_Encode_Property_APDU(
apdu_len =
encode_application_enumerated(&apdu[0], OBJECT_LOAD_CONTROL);
break;
/* optional property
case PROP_DESCRIPTION:
characterstring_init_ansi(&char_string,"optional description");
apdu_len = encode_application_character_string(&apdu[0], &char_string);
break;
*/
case PROP_PRESENT_VALUE:
enumeration = Load_Control_Present_Value(object_instance);
apdu_len = encode_application_enumerated(&apdu[0], enumeration);
+2
View File
@@ -396,7 +396,9 @@ BACNET_APPLICATION_TAG bacapp_context_tag_type(
BACNET_APPLICATION_TAG tag = MAX_BACNET_APPLICATION_TAG;
switch (property) {
case PROP_ACTUAL_SHED_LEVEL:
case PROP_REQUESTED_SHED_LEVEL:
case PROP_EXPECTED_SHED_LEVEL:
switch (tag_number) {
case 0:
case 1: