Unfactored the device object read-property common since it made error handling more difficult, and also required an additional characterstring when optional characterstrings were needed in the objects.

This commit is contained in:
skarg
2012-08-16 18:53:52 +00:00
parent 288a47edea
commit 4612e503d1
6 changed files with 213 additions and 149 deletions
+18 -3
View File
@@ -250,8 +250,8 @@ int Binary_Output_Read_Property(
{
int len = 0;
int apdu_len = 0; /* return value */
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
BACNET_BIT_STRING bit_string = {0};
BACNET_CHARACTER_STRING char_string = {0};
BACNET_BINARY_PV present_value = BINARY_INACTIVE;
unsigned object_index = 0;
unsigned i = 0;
@@ -264,7 +264,22 @@ int Binary_Output_Read_Property(
}
apdu = rpdata->application_data;
switch (rpdata->object_property) {
/* object id, object name, object type are handled in Device object */
case PROP_OBJECT_IDENTIFIER:
apdu_len =
encode_application_object_id(&apdu[0], rpdata->object_type,
rpdata->object_instance);
break;
case PROP_OBJECT_NAME:
Binary_Output_Object_Name(rpdata->object_instance, &char_string);
apdu_len =
encode_application_character_string(&apdu[0],
&char_string);
break;
case PROP_OBJECT_TYPE:
apdu_len =
encode_application_enumerated(&apdu[0],
rpdata->object_type);
break;
case PROP_PRESENT_VALUE:
present_value =
Binary_Output_Present_Value(rpdata->object_instance);