mirror of
https://github.com/stargieg/bacnet-stack
synced 2025-10-19 23:25:23 +08:00
[r3096] Fixed compilation of unit tests.
This commit is contained in:
parent
c1688016bc
commit
25ca4375f9
|
|
@ -310,7 +310,7 @@ static bool Channel_Reference_List_Member_Valid(
|
|||
|
||||
if ((pMember) &&
|
||||
(pMember->objectIdentifier.instance != BACNET_MAX_INSTANCE) &&
|
||||
(pMember->deviceIndentifier.instance != BACNET_MAX_INSTANCE)) {
|
||||
(pMember->deviceIdentifier.instance != BACNET_MAX_INSTANCE)) {
|
||||
status = true;
|
||||
}
|
||||
|
||||
|
|
@ -475,8 +475,8 @@ unsigned Channel_Reference_List_Member_Local_Add(
|
|||
member.objectIdentifier.instance = instance;
|
||||
member.propertyIdentifier = propertyIdentifier;
|
||||
member.arrayIndex = arrayIndex;
|
||||
member.deviceIndentifier.type = OBJECT_DEVICE;
|
||||
member.deviceIndentifier.instance = Device_Object_Instance_Number();
|
||||
member.deviceIdentifier.type = OBJECT_DEVICE;
|
||||
member.deviceIdentifier.instance = Device_Object_Instance_Number();
|
||||
|
||||
return Channel_Reference_List_Member_Element_Add(
|
||||
object_instance,
|
||||
|
|
@ -1219,8 +1219,8 @@ static bool Channel_Write_Members(
|
|||
we would need to update all channels when our device ID
|
||||
changed. Instead, we'll just screen when members are
|
||||
set. */
|
||||
if ((pMember->deviceIndentifier.type == OBJECT_DEVICE) &&
|
||||
(pMember->deviceIndentifier.instance != BACNET_MAX_INSTANCE) &&
|
||||
if ((pMember->deviceIdentifier.type == OBJECT_DEVICE) &&
|
||||
(pMember->deviceIdentifier.instance != BACNET_MAX_INSTANCE) &&
|
||||
(pMember->objectIdentifier.instance != BACNET_MAX_INSTANCE)) {
|
||||
wp_data.object_type = pMember->objectIdentifier.type;
|
||||
wp_data.object_instance = pMember->objectIdentifier.instance;
|
||||
|
|
@ -1695,9 +1695,9 @@ void Channel_Init(void)
|
|||
Channel[i].Members[m].objectIdentifier.instance = i+1;
|
||||
Channel[i].Members[m].propertyIdentifier = PROP_LIGHTING_COMMAND;
|
||||
Channel[i].Members[m].arrayIndex = BACNET_ARRAY_ALL;
|
||||
Channel[i].Members[m].deviceIndentifier.type =
|
||||
Channel[i].Members[m].deviceIdentifier.type =
|
||||
OBJECT_DEVICE;
|
||||
Channel[i].Members[m].deviceIndentifier.instance = 0;
|
||||
Channel[i].Members[m].deviceIdentifier.instance = 0;
|
||||
}
|
||||
Channel[i].Number = 0;
|
||||
for (g = 0; g < CONTROL_GROUPS_MAX; g++) {
|
||||
|
|
|
|||
|
|
@ -349,9 +349,9 @@ void Trend_Log_Init(
|
|||
TL_Descr[i].ulRecordCount = TL_INIT_ENTRIES;
|
||||
TL_Descr[i].ulTotalRecordCount = TL_INIT_ENTRIES;
|
||||
|
||||
TL_Descr[i].Source.deviceIndentifier.instance =
|
||||
TL_Descr[i].Source.deviceIdentifier.instance =
|
||||
Device_Object_Instance_Number();
|
||||
TL_Descr[i].Source.deviceIndentifier.type = ucidevice_type;
|
||||
TL_Descr[i].Source.deviceIdentifier.type = ucidevice_type;
|
||||
TL_Descr[i].Source.objectIdentifier.instance = uciobject_instance;
|
||||
TL_Descr[i].Source.objectIdentifier.type = uciobject_type;
|
||||
TL_Descr[i].Source.arrayIndex = BACNET_ARRAY_ALL;
|
||||
|
|
@ -1180,10 +1180,10 @@ bool Trend_Log_Write_Property(
|
|||
|
||||
if (value.context_tag == 3) {
|
||||
/* Got a device ID so deal with it */
|
||||
TempSource.deviceIndentifier = value.type.Object_Id;
|
||||
if ((TempSource.deviceIndentifier.instance !=
|
||||
TempSource.deviceIdentifier = value.type.Object_Id;
|
||||
if ((TempSource.deviceIdentifier.instance !=
|
||||
Device_Object_Instance_Number()) ||
|
||||
(TempSource.deviceIndentifier.type != OBJECT_DEVICE)) {
|
||||
(TempSource.deviceIdentifier.type != OBJECT_DEVICE)) {
|
||||
/* Not our ID so can't handle it at the moment */
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
wp_data->error_code =
|
||||
|
|
@ -1193,8 +1193,8 @@ bool Trend_Log_Write_Property(
|
|||
}
|
||||
}
|
||||
/* Make sure device ID is set to ours in case not supplied */
|
||||
TempSource.deviceIndentifier.type = OBJECT_DEVICE;
|
||||
TempSource.deviceIndentifier.instance =
|
||||
TempSource.deviceIdentifier.type = OBJECT_DEVICE;
|
||||
TempSource.deviceIdentifier.instance =
|
||||
Device_Object_Instance_Number();
|
||||
/* Quick comparison if structures are packed ... */
|
||||
if (memcmp(&TempSource, &CurrentTL->Source,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ typedef struct BACnetDeviceObjectPropertyReference {
|
|||
BACNET_OBJECT_ID objectIdentifier;
|
||||
BACNET_PROPERTY_ID propertyIdentifier;
|
||||
uint32_t arrayIndex;
|
||||
BACNET_OBJECT_ID deviceIndentifier;
|
||||
BACNET_OBJECT_ID deviceIdentifier;
|
||||
} BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE;
|
||||
|
||||
/** BACnetDeviceObjectReference structure.
|
||||
|
|
@ -42,7 +42,7 @@ typedef struct BACnetDeviceObjectPropertyReference {
|
|||
* to an object inside this Device.
|
||||
*/
|
||||
typedef struct BACnetDeviceObjectReference {
|
||||
BACNET_OBJECT_ID deviceIndentifier; /**< Optional, for external device. */
|
||||
BACNET_OBJECT_ID deviceIdentifier; /**< Optional, for external device. */
|
||||
BACNET_OBJECT_ID objectIdentifier;
|
||||
} BACNET_DEVICE_OBJECT_REFERENCE;
|
||||
|
||||
|
|
|
|||
|
|
@ -97,11 +97,11 @@ int bacapp_encode_device_obj_property_ref(
|
|||
/* Likewise, device id is optional so see if needed
|
||||
* (set type to BACNET_NO_DEV_TYPE or something other than OBJECT_DEVICE to
|
||||
* omit */
|
||||
if (value->deviceIndentifier.type == OBJECT_DEVICE) {
|
||||
if (value->deviceIdentifier.type == OBJECT_DEVICE) {
|
||||
len =
|
||||
encode_context_object_id(&apdu[apdu_len], 3,
|
||||
(int) value->deviceIndentifier.type,
|
||||
value->deviceIndentifier.instance);
|
||||
(int) value->deviceIdentifier.type,
|
||||
value->deviceIdentifier.instance);
|
||||
apdu_len += len;
|
||||
}
|
||||
return apdu_len;
|
||||
|
|
@ -157,14 +157,14 @@ int bacapp_decode_device_obj_property_ref(
|
|||
!decode_is_closing_tag(&apdu[apdu_len])) {
|
||||
if (-1 == (len =
|
||||
decode_context_object_id(&apdu[apdu_len], 3,
|
||||
&value->deviceIndentifier.type,
|
||||
&value->deviceIndentifier.instance))) {
|
||||
&value->deviceIdentifier.type,
|
||||
&value->deviceIdentifier.instance))) {
|
||||
return -1;
|
||||
}
|
||||
apdu_len += len;
|
||||
} else {
|
||||
value->deviceIndentifier.type = BACNET_NO_DEV_TYPE;
|
||||
value->deviceIndentifier.instance = BACNET_NO_DEV_ID;
|
||||
value->deviceIdentifier.type = BACNET_NO_DEV_TYPE;
|
||||
value->deviceIdentifier.instance = BACNET_NO_DEV_ID;
|
||||
}
|
||||
|
||||
return apdu_len;
|
||||
|
|
@ -239,11 +239,11 @@ int bacapp_encode_device_obj_ref(
|
|||
/* Device id is optional so see if needed
|
||||
* (set type to BACNET_NO_DEV_TYPE or something other than OBJECT_DEVICE to
|
||||
* omit */
|
||||
if (value->deviceIndentifier.type == OBJECT_DEVICE) {
|
||||
if (value->deviceIdentifier.type == OBJECT_DEVICE) {
|
||||
len =
|
||||
encode_context_object_id(&apdu[apdu_len], 0,
|
||||
(int) value->deviceIndentifier.type,
|
||||
value->deviceIndentifier.instance);
|
||||
(int) value->deviceIdentifier.type,
|
||||
value->deviceIdentifier.instance);
|
||||
apdu_len += len;
|
||||
}
|
||||
/* object-identifier [1] BACnetObjectIdentifier */
|
||||
|
|
@ -271,14 +271,14 @@ int bacapp_decode_device_obj_ref(
|
|||
!decode_is_closing_tag(&apdu[apdu_len])) {
|
||||
if (-1 == (len =
|
||||
decode_context_object_id(&apdu[apdu_len], 0,
|
||||
&value->deviceIndentifier.type,
|
||||
&value->deviceIndentifier.instance))) {
|
||||
&value->deviceIdentifier.type,
|
||||
&value->deviceIdentifier.instance))) {
|
||||
return -1;
|
||||
}
|
||||
apdu_len += len;
|
||||
} else {
|
||||
value->deviceIndentifier.type = BACNET_NO_DEV_TYPE;
|
||||
value->deviceIndentifier.instance = BACNET_NO_DEV_ID;
|
||||
value->deviceIdentifier.type = BACNET_NO_DEV_TYPE;
|
||||
value->deviceIdentifier.instance = BACNET_NO_DEV_ID;
|
||||
}
|
||||
/* object-identifier [1] BACnetObjectIdentifier */
|
||||
if (-1 == (len =
|
||||
|
|
@ -351,15 +351,15 @@ static void testDevObjPropRef(
|
|||
} else {
|
||||
ct_test(pTest, outData.arrayIndex == BACNET_ARRAY_ALL);
|
||||
}
|
||||
if (inData->deviceIndentifier.type == OBJECT_DEVICE) {
|
||||
if (inData->deviceIdentifier.type == OBJECT_DEVICE) {
|
||||
ct_test(pTest,
|
||||
inData->deviceIndentifier.instance ==
|
||||
outData.deviceIndentifier.instance);
|
||||
inData->deviceIdentifier.instance ==
|
||||
outData.deviceIdentifier.instance);
|
||||
ct_test(pTest,
|
||||
inData->deviceIndentifier.type == outData.deviceIndentifier.type);
|
||||
inData->deviceIdentifier.type == outData.deviceIdentifier.type);
|
||||
} else {
|
||||
ct_test(pTest,outData.deviceIndentifier.instance == BACNET_NO_DEV_ID);
|
||||
ct_test(pTest,outData.deviceIndentifier.type == BACNET_NO_DEV_TYPE);
|
||||
ct_test(pTest,outData.deviceIdentifier.instance == BACNET_NO_DEV_ID);
|
||||
ct_test(pTest,outData.deviceIdentifier.type == BACNET_NO_DEV_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -373,32 +373,32 @@ static void testDevIdPropRef(
|
|||
inData.objectIdentifier.type = 15;
|
||||
inData.propertyIdentifier = 25;
|
||||
inData.arrayIndex = 0x5678;
|
||||
inData.deviceIndentifier.instance = 0x4343;
|
||||
inData.deviceIndentifier.type = OBJECT_DEVICE;
|
||||
inData.deviceIdentifier.instance = 0x4343;
|
||||
inData.deviceIdentifier.type = OBJECT_DEVICE;
|
||||
testDevObjPropRef(pTest, &inData);
|
||||
/* optional array */
|
||||
inData.objectIdentifier.instance = 0x1234;
|
||||
inData.objectIdentifier.type = 15;
|
||||
inData.propertyIdentifier = 25;
|
||||
inData.arrayIndex = BACNET_ARRAY_ALL;
|
||||
inData.deviceIndentifier.instance = 0x4343;
|
||||
inData.deviceIndentifier.type = OBJECT_DEVICE;
|
||||
inData.deviceIdentifier.instance = 0x4343;
|
||||
inData.deviceIdentifier.type = OBJECT_DEVICE;
|
||||
testDevObjPropRef(pTest, &inData);
|
||||
/* optional device ID */
|
||||
inData.objectIdentifier.instance = 0x1234;
|
||||
inData.objectIdentifier.type = 15;
|
||||
inData.propertyIdentifier = 25;
|
||||
inData.arrayIndex = 1;
|
||||
inData.deviceIndentifier.instance = 0;
|
||||
inData.deviceIndentifier.type = BACNET_NO_DEV_TYPE;
|
||||
inData.deviceIdentifier.instance = 0;
|
||||
inData.deviceIdentifier.type = BACNET_NO_DEV_TYPE;
|
||||
testDevObjPropRef(pTest, &inData);
|
||||
/* optional array + optional device ID */
|
||||
inData.objectIdentifier.instance = 0x1234;
|
||||
inData.objectIdentifier.type = 15;
|
||||
inData.propertyIdentifier = 25;
|
||||
inData.arrayIndex = BACNET_ARRAY_ALL;
|
||||
inData.deviceIndentifier.instance = 0;
|
||||
inData.deviceIndentifier.type = BACNET_NO_DEV_TYPE;
|
||||
inData.deviceIdentifier.instance = 0;
|
||||
inData.deviceIdentifier.type = BACNET_NO_DEV_TYPE;
|
||||
testDevObjPropRef(pTest, &inData);
|
||||
}
|
||||
|
||||
|
|
@ -411,16 +411,16 @@ static void testDevIdRef(
|
|||
int inLen;
|
||||
int outLen;
|
||||
|
||||
inData.deviceIndentifier.instance = 0x4343;
|
||||
inData.deviceIndentifier.type = OBJECT_DEVICE;
|
||||
inData.deviceIdentifier.instance = 0x4343;
|
||||
inData.deviceIdentifier.type = OBJECT_DEVICE;
|
||||
inLen = bacapp_encode_device_obj_ref(buffer, &inData);
|
||||
outLen = bacapp_decode_device_obj_ref(buffer, &outData);
|
||||
ct_test(pTest, outLen == inLen);
|
||||
ct_test(pTest,
|
||||
inData.deviceIndentifier.instance ==
|
||||
outData.deviceIndentifier.instance);
|
||||
inData.deviceIdentifier.instance ==
|
||||
outData.deviceIdentifier.instance);
|
||||
ct_test(pTest,
|
||||
inData.deviceIndentifier.type == outData.deviceIndentifier.type);
|
||||
inData.deviceIdentifier.type == outData.deviceIdentifier.type);
|
||||
}
|
||||
|
||||
void testBACnetDeviceObjectPropertyReference(
|
||||
|
|
|
|||
|
|
@ -872,7 +872,7 @@ void testUCOVNotifyData(
|
|||
BACNET_COV_DATA test_data;
|
||||
BACNET_PROPERTY_VALUE value_list[5] = {{0}};
|
||||
|
||||
len = ucov_notify_encode_apdu(&apdu[0], data);
|
||||
len = ucov_notify_encode_apdu(&apdu[0], sizeof(apdu), data);
|
||||
ct_test(pTest, len > 0);
|
||||
apdu_len = len;
|
||||
|
||||
|
|
@ -894,7 +894,7 @@ void testCCOVNotifyData(
|
|||
BACNET_PROPERTY_VALUE value_list[2] = {{0}};
|
||||
uint8_t test_invoke_id = 0;
|
||||
|
||||
len = ccov_notify_encode_apdu(&apdu[0], invoke_id, data);
|
||||
len = ccov_notify_encode_apdu(&apdu[0], sizeof(apdu), invoke_id, data);
|
||||
ct_test(pTest, len != 0);
|
||||
apdu_len = len;
|
||||
|
||||
|
|
@ -995,7 +995,7 @@ void testCOVSubscribeEncoding(
|
|||
BACNET_SUBSCRIBE_COV_DATA test_data;
|
||||
uint8_t test_invoke_id = 0;
|
||||
|
||||
len = cov_subscribe_encode_apdu(&apdu[0], invoke_id, data);
|
||||
len = cov_subscribe_encode_apdu(&apdu[0], sizeof(apdu), invoke_id, data);
|
||||
ct_test(pTest, len != 0);
|
||||
apdu_len = len;
|
||||
|
||||
|
|
@ -1018,7 +1018,8 @@ void testCOVSubscribePropertyEncoding(
|
|||
BACNET_SUBSCRIBE_COV_DATA test_data;
|
||||
uint8_t test_invoke_id = 0;
|
||||
|
||||
len = cov_subscribe_property_encode_apdu(&apdu[0], invoke_id, data);
|
||||
len = cov_subscribe_property_encode_apdu(&apdu[0], sizeof(apdu), invoke_id,
|
||||
data);
|
||||
ct_test(pTest, len != 0);
|
||||
apdu_len = len;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ SRCS = $(SRC_DIR)/bacdcode.c \
|
|||
$(SRC_DIR)/bacdevobjpropref.c \
|
||||
$(SRC_DIR)/lighting.c \
|
||||
$(SRC_DIR)/indtext.c \
|
||||
$(SRC_DIR)/memcopy.c \
|
||||
$(SRC_DIR)/bactext.c \
|
||||
$(SRC_DIR)/cov.c \
|
||||
ctest.c
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user