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 -2
View File
@@ -178,9 +178,10 @@ int Binary_Input_Read_Property(
BACNET_READ_PROPERTY_DATA * rpdata)
{
int apdu_len = 0; /* return value */
BACNET_BIT_STRING bit_string;
BACNET_BIT_STRING bit_string = {0};
BACNET_POLARITY polarity = POLARITY_NORMAL;
BACNET_BINARY_PV value = BINARY_INACTIVE;
BACNET_CHARACTER_STRING char_string = {0};
uint8_t *apdu = NULL;
if ((rpdata->application_data == NULL) ||
@@ -189,7 +190,22 @@ int Binary_Input_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_Input_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:
value = Binary_Input_Present_Value(rpdata->object_instance);
apdu_len = encode_application_enumerated(&apdu[0], value);