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:
@@ -107,6 +107,9 @@
|
|||||||
/* Array index 0=size of array, n=array element n, MAX=all array elements */
|
/* Array index 0=size of array, n=array element n, MAX=all array elements */
|
||||||
/* 32-bit MAX, to use with uint32_t */
|
/* 32-bit MAX, to use with uint32_t */
|
||||||
#define BACNET_ARRAY_ALL 0xFFFFFFFFU
|
#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 */
|
/* Priority Array for commandable objects */
|
||||||
#define BACNET_NO_PRIORITY 0
|
#define BACNET_NO_PRIORITY 0
|
||||||
#define BACNET_MIN_PRIORITY 1
|
#define BACNET_MIN_PRIORITY 1
|
||||||
|
|||||||
@@ -84,7 +84,8 @@ int bacapp_encode_device_obj_property_ref(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Likewise, device id is optional so see if needed
|
/* 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) {
|
if (value->deviceIndentifier.type == OBJECT_DEVICE) {
|
||||||
len =
|
len =
|
||||||
@@ -126,7 +127,7 @@ int bacapp_decode_device_obj_property_ref(
|
|||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
} else {
|
} else {
|
||||||
value->arrayIndex = 0;
|
value->arrayIndex = BACNET_ARRAY_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decode_is_context_tag(&apdu[apdu_len], 3)) {
|
if (decode_is_context_tag(&apdu[apdu_len], 3)) {
|
||||||
@@ -138,8 +139,8 @@ int bacapp_decode_device_obj_property_ref(
|
|||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
} else {
|
} else {
|
||||||
value->deviceIndentifier.instance = 0;
|
value->deviceIndentifier.type = BACNET_NO_DEV_TYPE;
|
||||||
value->deviceIndentifier.type = 0;
|
value->deviceIndentifier.instance = BACNET_NO_DEV_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return apdu_len;
|
return apdu_len;
|
||||||
@@ -204,7 +205,8 @@ int bacapp_encode_device_obj_ref(
|
|||||||
int apdu_len = 0;
|
int apdu_len = 0;
|
||||||
|
|
||||||
/* Device id is optional so see if needed
|
/* 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) {
|
if (value->deviceIndentifier.type == OBJECT_DEVICE) {
|
||||||
len =
|
len =
|
||||||
@@ -239,8 +241,8 @@ int bacapp_decode_device_obj_ref(
|
|||||||
}
|
}
|
||||||
apdu_len += len;
|
apdu_len += len;
|
||||||
} else {
|
} else {
|
||||||
value->deviceIndentifier.instance = 0;
|
value->deviceIndentifier.type = BACNET_NO_DEV_TYPE;
|
||||||
value->deviceIndentifier.type = 0;
|
value->deviceIndentifier.instance = BACNET_NO_DEV_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-1 == (len =
|
if (-1 == (len =
|
||||||
|
|||||||
Reference in New Issue
Block a user