Added explicit values for denoting optional device id not present

Modified bacapp_decode_device_obj_property_ref() and bacapp_decode_device_obj_ref() to use above values.
This commit is contained in:
petermcs
2015-02-16 10:49:50 +00:00
parent 1d9eb5318c
commit d7b40e0d8b
2 changed files with 12 additions and 7 deletions
+3
View File
@@ -107,6 +107,9 @@
/* Array index 0=size of array, n=array element n, MAX=all array elements */
/* 32-bit MAX, to use with uint32_t */
#define BACNET_ARRAY_ALL 0xFFFFFFFFU
/* For device object property references with no device id defined */
#define BACNET_NO_DEV_ID 0xFFFFFFFFu
#define BACNET_NO_DEV_TYPE 0xFFFFu
/* Priority Array for commandable objects */
#define BACNET_NO_PRIORITY 0
#define BACNET_MIN_PRIORITY 1
+9 -7
View File
@@ -84,7 +84,8 @@ int bacapp_encode_device_obj_property_ref(
}
/* Likewise, device id is optional so see if needed
* (set type to non device to omit */
* (set type to BACNET_NO_DEV_TYPE or something other than OBJECT_DEVICE to
* omit */
if (value->deviceIndentifier.type == OBJECT_DEVICE) {
len =
@@ -126,7 +127,7 @@ int bacapp_decode_device_obj_property_ref(
}
apdu_len += len;
} else {
value->arrayIndex = 0;
value->arrayIndex = BACNET_ARRAY_ALL;
}
if (decode_is_context_tag(&apdu[apdu_len], 3)) {
@@ -138,8 +139,8 @@ int bacapp_decode_device_obj_property_ref(
}
apdu_len += len;
} else {
value->deviceIndentifier.instance = 0;
value->deviceIndentifier.type = 0;
value->deviceIndentifier.type = BACNET_NO_DEV_TYPE;
value->deviceIndentifier.instance = BACNET_NO_DEV_ID;
}
return apdu_len;
@@ -204,7 +205,8 @@ int bacapp_encode_device_obj_ref(
int apdu_len = 0;
/* Device id is optional so see if needed
* (set type to non device to omit */
* (set type to BACNET_NO_DEV_TYPE or something other than OBJECT_DEVICE to
* omit */
if (value->deviceIndentifier.type == OBJECT_DEVICE) {
len =
@@ -239,8 +241,8 @@ int bacapp_decode_device_obj_ref(
}
apdu_len += len;
} else {
value->deviceIndentifier.instance = 0;
value->deviceIndentifier.type = 0;
value->deviceIndentifier.type = BACNET_NO_DEV_TYPE;
value->deviceIndentifier.instance = BACNET_NO_DEV_ID;
}
if (-1 == (len =