From 964085d4583e282577c22bfc617ac12f3ba458d0 Mon Sep 17 00:00:00 2001 From: skarg Date: Wed, 7 Sep 2016 21:06:17 +0000 Subject: [PATCH] Merged revision(s) 3031 from branches/releases/bacnet-stack-0-8-0: Added checks for OPTIONAL context tagged decoding to be sure it is not a closing tag. Added makefile for unit test in bacdevobjpropref.c module, and improved unit test. https://sourceforge.net/p/bacnet/bugs/49/ ........ --- bacnet-stack/include/bacdevobjpropref.h | 5 + bacnet-stack/src/bacdevobjpropref.c | 193 ++++++++++---- bacnet-stack/test.mak | 341 ------------------------ bacnet-stack/test/bacdevobjpropref.mak | 40 +++ 4 files changed, 180 insertions(+), 399 deletions(-) create mode 100644 bacnet-stack/test/bacdevobjpropref.mak diff --git a/bacnet-stack/include/bacdevobjpropref.h b/bacnet-stack/include/bacdevobjpropref.h index ff5e9c7b..ae87d951 100644 --- a/bacnet-stack/include/bacdevobjpropref.h +++ b/bacnet-stack/include/bacdevobjpropref.h @@ -89,6 +89,11 @@ extern "C" { uint8_t tag_number, BACNET_DEVICE_OBJECT_REFERENCE * value); +#ifdef TEST +#include "ctest.h" + void testBACnetDeviceObjectPropertyReference( + Test * pTest); +#endif #ifdef __cplusplus } diff --git a/bacnet-stack/src/bacdevobjpropref.c b/bacnet-stack/src/bacdevobjpropref.c index 03410228..8c8bbc4e 100644 --- a/bacnet-stack/src/bacdevobjpropref.c +++ b/bacnet-stack/src/bacdevobjpropref.c @@ -60,6 +60,16 @@ int bacapp_encode_context_device_obj_property_ref( return apdu_len; } +/* BACnetDeviceObjectPropertyReference ::= SEQUENCE { + object-identifier [0] BACnetObjectIdentifier, + property-identifier [1] BACnetPropertyIdentifier, + property-array-index [2] Unsigned OPTIONAL, + -- used only with array datatype + -- if omitted with an array then + -- the entire array is referenced + device-identifier [3] BACnetObjectIdentifier OPTIONAL +} +*/ int bacapp_encode_device_obj_property_ref( uint8_t * apdu, BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value) @@ -67,26 +77,26 @@ int bacapp_encode_device_obj_property_ref( int len; int apdu_len = 0; + /* object-identifier [0] BACnetObjectIdentifier */ len = encode_context_object_id(&apdu[apdu_len], 0, (int) value->objectIdentifier.type, value->objectIdentifier.instance); apdu_len += len; - + /* property-identifier [1] BACnetPropertyIdentifier */ len = encode_context_enumerated(&apdu[apdu_len], 1, value->propertyIdentifier); apdu_len += len; - - /* Array index is optional so check if needed before inserting */ + /* property-array-index [2] Unsigned OPTIONAL */ + /* Check if needed before inserting */ if (value->arrayIndex != BACNET_ARRAY_ALL) { len = encode_context_unsigned(&apdu[apdu_len], 2, value->arrayIndex); apdu_len += len; } - + /* device-identifier [3] BACnetObjectIdentifier OPTIONAL */ /* 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) { len = encode_context_object_id(&apdu[apdu_len], 3, @@ -97,6 +107,16 @@ int bacapp_encode_device_obj_property_ref( return apdu_len; } +/* BACnetDeviceObjectPropertyReference ::= SEQUENCE { + object-identifier [0] BACnetObjectIdentifier, + property-identifier [1] BACnetPropertyIdentifier, + property-array-index [2] Unsigned OPTIONAL, + -- used only with array datatype + -- if omitted with an array then + -- the entire array is referenced + device-identifier [3] BACnetObjectIdentifier OPTIONAL +} +*/ int bacapp_decode_device_obj_property_ref( uint8_t * apdu, BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE * value) @@ -104,6 +124,8 @@ int bacapp_decode_device_obj_property_ref( int len; int apdu_len = 0; uint32_t enumValue; + + /* object-identifier [0] BACnetObjectIdentifier */ if (-1 == (len = decode_context_object_id(&apdu[apdu_len], 0, &value->objectIdentifier.type, @@ -111,15 +133,16 @@ int bacapp_decode_device_obj_property_ref( return -1; } apdu_len += len; - + /* property-identifier [1] BACnetPropertyIdentifier */ if (-1 == (len = decode_context_enumerated(&apdu[apdu_len], 1, &enumValue))) { return -1; } value->propertyIdentifier = (BACNET_PROPERTY_ID) enumValue; apdu_len += len; - - if (decode_is_context_tag(&apdu[apdu_len], 2)) { + /* property-array-index [2] Unsigned OPTIONAL */ + if (decode_is_context_tag(&apdu[apdu_len], 2) && + !decode_is_closing_tag(&apdu[apdu_len])) { if (-1 == (len = decode_context_unsigned(&apdu[apdu_len], 2, &value->arrayIndex))) { @@ -129,8 +152,9 @@ int bacapp_decode_device_obj_property_ref( } else { value->arrayIndex = BACNET_ARRAY_ALL; } - - if (decode_is_context_tag(&apdu[apdu_len], 3)) { + /* device-identifier [3] BACnetObjectIdentifier OPTIONAL */ + if (decode_is_context_tag(&apdu[apdu_len], 3) && + !decode_is_closing_tag(&apdu[apdu_len])) { if (-1 == (len = decode_context_object_id(&apdu[apdu_len], 3, &value->deviceIndentifier.type, @@ -176,7 +200,10 @@ int bacapp_decode_context_device_obj_property_ref( } -/* Functions for BACnetDeviceObjectReference: */ +/* BACnetDeviceObjectReference ::= SEQUENCE { + device-identifier [0] BACnetObjectIdentifier OPTIONAL, + object-identifier [1] BACnetObjectIdentifier +}*/ int bacapp_encode_context_device_obj_ref( uint8_t * apdu, uint8_t tag_number, @@ -197,6 +224,10 @@ int bacapp_encode_context_device_obj_ref( return apdu_len; } +/* BACnetDeviceObjectReference ::= SEQUENCE { + device-identifier [0] BACnetObjectIdentifier OPTIONAL, + object-identifier [1] BACnetObjectIdentifier +}*/ int bacapp_encode_device_obj_ref( uint8_t * apdu, BACNET_DEVICE_OBJECT_REFERENCE * value) @@ -204,10 +235,10 @@ int bacapp_encode_device_obj_ref( int len; int apdu_len = 0; + /* device-identifier [0] BACnetObjectIdentifier OPTIONAL */ /* 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) { len = encode_context_object_id(&apdu[apdu_len], 0, @@ -215,7 +246,7 @@ int bacapp_encode_device_obj_ref( value->deviceIndentifier.instance); apdu_len += len; } - + /* object-identifier [1] BACnetObjectIdentifier */ len = encode_context_object_id(&apdu[apdu_len], 1, (int) value->objectIdentifier.type, value->objectIdentifier.instance); @@ -224,6 +255,10 @@ int bacapp_encode_device_obj_ref( return apdu_len; } +/* BACnetDeviceObjectReference ::= SEQUENCE { + device-identifier [0] BACnetObjectIdentifier OPTIONAL, + object-identifier [1] BACnetObjectIdentifier +}*/ int bacapp_decode_device_obj_ref( uint8_t * apdu, BACNET_DEVICE_OBJECT_REFERENCE * value) @@ -231,8 +266,9 @@ int bacapp_decode_device_obj_ref( int len; int apdu_len = 0; - /* Device ID is optional */ - if (decode_is_context_tag(&apdu[apdu_len], 0)) { + /* device-identifier [0] BACnetObjectIdentifier OPTIONAL */ + if (decode_is_context_tag(&apdu[apdu_len], 0) && + !decode_is_closing_tag(&apdu[apdu_len])) { if (-1 == (len = decode_context_object_id(&apdu[apdu_len], 0, &value->deviceIndentifier.type, @@ -244,7 +280,7 @@ int bacapp_decode_device_obj_ref( value->deviceIndentifier.type = BACNET_NO_DEV_TYPE; value->deviceIndentifier.instance = BACNET_NO_DEV_ID; } - + /* object-identifier [1] BACnetObjectIdentifier */ if (-1 == (len = decode_context_object_id(&apdu[apdu_len], 1, &value->objectIdentifier.type, @@ -284,51 +320,89 @@ int bacapp_decode_context_device_obj_ref( return len; } - #ifdef TEST +#include +#include +#include "ctest.h" +static void testDevObjPropRef( + Test * pTest, + BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *inData) +{ + BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE outData; + uint8_t buffer[MAX_APDU] = {0}; + int inLen = 0; + int outLen = 0; -void testDevIdPropRef( + /* encode */ + inLen = bacapp_encode_device_obj_property_ref(buffer, inData); + /* add a closing tag at the end of the buffer to verify proper handling + when that is encountered in real packets */ + encode_closing_tag(&buffer[inLen], 3); + /* decode */ + outLen = bacapp_decode_device_obj_property_ref(buffer, &outData); + ct_test(pTest, outLen == inLen); + ct_test(pTest, + inData->objectIdentifier.instance == outData.objectIdentifier.instance); + ct_test(pTest, + inData->objectIdentifier.type == outData.objectIdentifier.type); + ct_test(pTest, inData->propertyIdentifier == outData.propertyIdentifier); + if (inData->arrayIndex != BACNET_ARRAY_ALL) { + ct_test(pTest, inData->arrayIndex == outData.arrayIndex); + } else { + ct_test(pTest, outData.arrayIndex == BACNET_ARRAY_ALL); + } + if (inData->deviceIndentifier.type == OBJECT_DEVICE) { + ct_test(pTest, + inData->deviceIndentifier.instance == + outData.deviceIndentifier.instance); + ct_test(pTest, + inData->deviceIndentifier.type == outData.deviceIndentifier.type); + } else { + ct_test(pTest,outData.deviceIndentifier.instance == BACNET_NO_DEV_ID); + ct_test(pTest,outData.deviceIndentifier.type == BACNET_NO_DEV_TYPE); + } +} + +static void testDevIdPropRef( Test * pTest) { BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE inData; - BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE outData; - uint8_t buffer[MAX_APDU]; - int inLen; - int outLen; - + /* everything encoded */ inData.objectIdentifier.instance = 0x1234; inData.objectIdentifier.type = 15; - inData.propertyIdentifier = 25; - inData.arrayIndex = 0x5678; - inData.deviceIndentifier.instance = 0x4343; - inData.deviceIndentifier.type = 28; - - inLen = bacapp_encode_device_obj_property_ref(buffer, &inData); - outLen = bacapp_decode_device_obj_property_ref(buffer, &outData); - - ct_test(pTest, outLen == inLen); - - ct_test(pTest, - inData.objectIdentifier.instance == outData.objectIdentifier.instance); - ct_test(pTest, - inData.objectIdentifier.type == outData.objectIdentifier.type); - - ct_test(pTest, inData.propertyIdentifier == outData.propertyIdentifier); - - ct_test(pTest, inData.arrayIndex == outData.arrayIndex); - - ct_test(pTest, - inData.deviceIndentifier.instance == - outData.deviceIndentifier.instance); - ct_test(pTest, - inData.deviceIndentifier.type == outData.deviceIndentifier.type); + inData.deviceIndentifier.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; + 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; + 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; + testDevObjPropRef(pTest, &inData); } -void testDevIdRef( +static void testDevIdRef( Test * pTest) { BACNET_DEVICE_OBJECT_REFERENCE inData; @@ -338,13 +412,10 @@ void testDevIdRef( int outLen; inData.deviceIndentifier.instance = 0x4343; - inData.deviceIndentifier.type = 28; - + inData.deviceIndentifier.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); @@ -352,6 +423,17 @@ void testDevIdRef( inData.deviceIndentifier.type == outData.deviceIndentifier.type); } +void testBACnetDeviceObjectPropertyReference( + Test * pTest) +{ + bool rc; + + /* individual tests */ + rc = ct_addTestFunction(pTest, testDevIdPropRef); + assert(rc); + rc = ct_addTestFunction(pTest, testDevIdRef); + assert(rc); +} #ifdef TEST_DEV_ID_PROP_REF #include @@ -359,14 +441,9 @@ int main( void) { Test *pTest; - bool rc; pTest = ct_create("BACnet Prop Ref", NULL); - /* individual tests */ - rc = ct_addTestFunction(pTest, testDevIdPropRef); - assert(rc); - rc = ct_addTestFunction(pTest, testDevIdRef); - assert(rc); + testBACnetDeviceObjectPropertyReference(pTest); ct_setStream(pTest, stdout); ct_run(pTest); diff --git a/bacnet-stack/test.mak b/bacnet-stack/test.mak index 55aa36d5..e69de29b 100644 --- a/bacnet-stack/test.mak +++ b/bacnet-stack/test.mak @@ -1,341 +0,0 @@ -# tools - only if you need them. -# Most platforms have this already defined -# CC = gcc -# AR = ar -# MAKE = $(MAKE) -# SIZE = size -# -# Assumes rm, touch, and cp are available - -LOGFILE = test.log - -all: abort address arf awf bacapp bacdcode bacerror bacint bacstr \ - cov crc datetime dcc event filename fifo getevent iam ihave \ - indtext keylist key memcopy npdu proplist ptransfer \ - rd reject ringbuf rp rpm sbuf timesync \ - whohas whois wp objects lighting - -clean: logfile - rm ${LOGFILE} - -logfile: - touch ${LOGFILE} - -abort: logfile test/abort.mak - $(MAKE) -s -C test -f abort.mak clean all - ( ./test/abort >> ${LOGFILE} ) - $(MAKE) -s -C test -f abort.mak clean - -address: logfile test/address.mak - $(MAKE) -s -C test -f address.mak clean all - ( ./test/address >> ${LOGFILE} ) - $(MAKE) -s -C test -f address.mak clean - -arf: logfile test/arf.mak - $(MAKE) -s -C test -f arf.mak clean all - ( ./test/arf >> ${LOGFILE} ) - $(MAKE) -s -C test -f arf.mak clean - -awf: logfile test/awf.mak - $(MAKE) -s -C test -f awf.mak clean all - ( ./test/awf >> ${LOGFILE} ) - $(MAKE) -s -C test -f awf.mak clean - -bacapp: logfile test/bacapp.mak - $(MAKE) -s -C test -f bacapp.mak clean all - ( ./test/bacapp >> ${LOGFILE} ) - $(MAKE) -s -C test -f bacapp.mak clean - -bacdcode: logfile test/bacdcode.mak - $(MAKE) -s -C test -f bacdcode.mak clean all - ( ./test/bacdcode >> ${LOGFILE} ) - $(MAKE) -s -C test -f bacdcode.mak clean - -bacerror: logfile test/bacerror.mak - $(MAKE) -s -C test -f bacerror.mak clean all - ( ./test/bacerror >> ${LOGFILE} ) - $(MAKE) -s -C test -f bacerror.mak clean - -bacint: logfile test/bacint.mak - $(MAKE) -s -C test -f bacint.mak clean all - ( ./test/bacint >> ${LOGFILE} ) - $(MAKE) -s -C test -f bacint.mak clean - -bacstr: logfile test/bacstr.mak - $(MAKE) -s -C test -f bacstr.mak clean all - ( ./test/bacstr >> ${LOGFILE} ) - $(MAKE) -s -C test -f bacstr.mak clean - -cov: logfile test/cov.mak - $(MAKE) -s -C test -f cov.mak clean all - ( ./test/cov >> ${LOGFILE} ) - $(MAKE) -s -C test -f cov.mak clean - -crc: logfile test/crc.mak - $(MAKE) -s -C test -f crc.mak clean all - ( ./test/crc >> ${LOGFILE} ) - $(MAKE) -s -C test -f crc.mak clean - -datetime: logfile test/datetime.mak - $(MAKE) -s -C test -f datetime.mak clean all - ( ./test/datetime >> ${LOGFILE} ) - $(MAKE) -s -C test -f datetime.mak clean - -dcc: logfile test/dcc.mak - $(MAKE) -s -C test -f dcc.mak clean all - ( ./test/dcc >> ${LOGFILE} ) - $(MAKE) -s -C test -f dcc.mak clean - -event: logfile test/event.mak - $(MAKE) -s -C test -f event.mak clean all - ( ./test/event >> ${LOGFILE} ) - $(MAKE) -s -C test -f event.mak clean - -filename: logfile test/filename.mak - $(MAKE) -s -C test -f filename.mak clean all - ( ./test/filename >> ${LOGFILE} ) - $(MAKE) -s -C test -f filename.mak clean - -fifo: logfile test/fifo.mak - $(MAKE) -s -C test -f fifo.mak clean all - ( ./test/fifo >> ${LOGFILE} ) - $(MAKE) -s -C test -f fifo.mak clean - -getevent: logfile test/getevent.mak - $(MAKE) -s -C test -f getevent.mak clean all - ( ./test/getevent >> ${LOGFILE} ) - $(MAKE) -s -C test -f getevent.mak clean - -iam: logfile test/iam.mak - $(MAKE) -s -C test -f iam.mak clean all - ( ./test/iam >> ${LOGFILE} ) - $(MAKE) -s -C test -f iam.mak clean - -ihave: logfile test/ihave.mak - $(MAKE) -s -C test -f ihave.mak clean all - ( ./test/ihave >> ${LOGFILE} ) - $(MAKE) -s -C test -f ihave.mak clean - -indtext: logfile test/indtext.mak - $(MAKE) -s -C test -f indtext.mak clean all - ( ./test/indtext >> ${LOGFILE} ) - $(MAKE) -s -C test -f indtext.mak clean - -keylist: logfile test/keylist.mak - $(MAKE) -s -C test -f keylist.mak clean all - ( ./test/keylist >> ${LOGFILE} ) - $(MAKE) -s -C test -f keylist.mak clean - -key: logfile test/key.mak - $(MAKE) -s -C test -f key.mak clean all - ( ./test/key >> ${LOGFILE} ) - $(MAKE) -s -C test -f key.mak clean - -lighting: logfile test/lighting.mak - $(MAKE) -s -C test -f lighting.mak clean all - ( ./test/lighting >> ${LOGFILE} ) - $(MAKE) -s -C test -f lighting.mak clean - -memcopy: logfile test/memcopy.mak - $(MAKE) -s -C test -f memcopy.mak clean all - ( ./test/memcopy >> ${LOGFILE} ) - $(MAKE) -s -C test -f memcopy.mak clean - -npdu: logfile test/npdu.mak - $(MAKE) -s -C test -f npdu.mak clean all - ( ./test/npdu >> ${LOGFILE} ) - $(MAKE) -s -C test -f npdu.mak clean - -proplist: logfile test/proplist.mak - $(MAKE) -s -C test -f proplist.mak clean all - ( ./test/proplist >> ${LOGFILE} ) - $(MAKE) -s -C test -f proplist.mak clean - -ptransfer: logfile test/ptransfer.mak - $(MAKE) -s -C test -f ptransfer.mak clean all - ( ./test/ptransfer >> ${LOGFILE} ) - $(MAKE) -s -C test -f ptransfer.mak clean - -rd: logfile test/rd.mak - $(MAKE) -s -C test -f rd.mak clean all - ( ./test/rd >> ${LOGFILE} ) - $(MAKE) -s -C test -f rd.mak clean - -reject: logfile test/reject.mak - $(MAKE) -s -C test -f reject.mak clean all - ( ./test/reject >> ${LOGFILE} ) - $(MAKE) -s -C test -f reject.mak clean - -ringbuf: logfile test/ringbuf.mak - $(MAKE) -s -C test -f ringbuf.mak clean all - ( ./test/ringbuf >> ${LOGFILE} ) - $(MAKE) -s -C test -f ringbuf.mak clean - -rp: logfile test/rp.mak - $(MAKE) -s -C test -f rp.mak clean all - ( ./test/rp >> ${LOGFILE} ) - $(MAKE) -s -C test -f rp.mak clean - -rpm: logfile test/rpm.mak - $(MAKE) -s -C test -f rpm.mak clean all - ( ./test/rpm >> ${LOGFILE} ) - $(MAKE) -s -C test -f rpm.mak clean - -sbuf: logfile test/sbuf.mak - $(MAKE) -s -C test -f sbuf.mak clean all - ( ./test/sbuf >> ${LOGFILE} ) - $(MAKE) -s -C test -f sbuf.mak clean - -timesync: logfile test/timesync.mak - $(MAKE) -s -C test -f timesync.mak clean all - ( ./test/timesync >> ${LOGFILE} ) - $(MAKE) -s -C test -f timesync.mak clean - -whohas: logfile test/whohas.mak - $(MAKE) -s -C test -f whohas.mak clean all - ( ./test/whohas >> ${LOGFILE} ) - $(MAKE) -s -C test -f whohas.mak clean - -whois: logfile test/whois.mak - $(MAKE) -s -C test -f whois.mak clean all - ( ./test/whois >> ${LOGFILE} ) - $(MAKE) -s -C test -f whois.mak clean - -wp: logfile test/wp.mak - $(MAKE) -s -C test -f wp.mak clean all - ( ./test/wp >> ${LOGFILE} ) - $(MAKE) -s -C test -f wp.mak clean - -objects: ai ao av bi bo bv csv lc lo lso lsp \ - mso msv ms-input osv piv command \ - access_credential access_door access_point access_rights \ - access_user access_zone credential_data_input - -access_credential: logfile demo/object/access_credential.mak - $(MAKE) -s -C demo/object -f access_credential.mak clean all - ( ./demo/object/access_credential >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f access_credential.mak clean - -access_door: logfile demo/object/access_door.mak - $(MAKE) -s -C demo/object -f access_door.mak clean all - ( ./demo/object/access_door >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f access_door.mak clean - -access_point: logfile demo/object/access_point.mak - $(MAKE) -s -C demo/object -f access_point.mak clean all - ( ./demo/object/access_point >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f access_point.mak clean - -access_rights: logfile demo/object/access_rights.mak - $(MAKE) -s -C demo/object -f access_rights.mak clean all - ( ./demo/object/access_rights >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f access_rights.mak clean - -access_user: logfile demo/object/access_user.mak - $(MAKE) -s -C demo/object -f access_user.mak clean all - ( ./demo/object/access_user >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f access_user.mak clean - -access_zone: logfile demo/object/access_zone.mak - $(MAKE) -s -C demo/object -f access_zone.mak clean all - ( ./demo/object/access_zone >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f access_zone.mak clean - -credential_data_input: logfile demo/object/credential_data_input.mak - $(MAKE) -s -C demo/object -f credential_data_input.mak clean all - ( ./demo/object/credential_data_input >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f credential_data_input.mak clean - -ai: logfile demo/object/ai.mak - $(MAKE) -s -C demo/object -f ai.mak clean all - ( ./demo/object/analog_input >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f ai.mak clean - -ao: logfile demo/object/ao.mak - $(MAKE) -s -C demo/object -f ao.mak clean all - ( ./demo/object/analog_output >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f ao.mak clean - -av: logfile demo/object/av.mak - $(MAKE) -s -C demo/object -f av.mak clean all - ( ./demo/object/analog_value >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f av.mak clean - -bi: logfile demo/object/bi.mak - $(MAKE) -s -C demo/object -f bi.mak clean all - $(MAKE) -s -C demo/object -f bi.mak clean - -bo: logfile demo/object/bo.mak - $(MAKE) -s -C demo/object -f bo.mak clean all - ( ./demo/object/binary_output >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f bo.mak clean - -bv: logfile demo/object/bv.mak - $(MAKE) -s -C demo/object -f bv.mak clean all - ( ./demo/object/binary_value >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f bv.mak clean - -command: logfile demo/object/command.mak - $(MAKE) -s -C demo/object -f command.mak clean all - ( ./demo/object/command >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f command.mak clean - -csv: logfile demo/object/csv.mak - $(MAKE) -s -C demo/object -f csv.mak clean all - ( ./demo/object/characterstring_value >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f csv.mak clean - -device: logfile demo/object/device.mak - $(MAKE) -s -C demo/object -f device.mak clean all - ( ./demo/object/device >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f device.mak clean - -lc: logfile demo/object/lc.mak - $(MAKE) -s -C demo/object -f lc.mak clean all - ( ./demo/object/load_control >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f lc.mak clean - -lo: logfile demo/object/lo.mak - $(MAKE) -s -C demo/object -f lo.mak clean all - ( ./demo/object/lighting_output >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f lo.mak clean - -lso: logfile test/lso.mak - $(MAKE) -s -C test -f lso.mak clean all - ( ./test/lso >> ${LOGFILE} ) - $(MAKE) -s -C test -f lso.mak clean - -lsp: logfile demo/object/lsp.mak - $(MAKE) -s -C demo/object -f lsp.mak clean all - ( ./demo/object/life_safety_point >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f lsp.mak clean - -ms-input: logfile demo/object/ms-input.mak - $(MAKE) -s -C demo/object -f ms-input.mak clean all - ( ./demo/object/multistate_input >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f ms-input.mak clean - -mso: logfile demo/object/mso.mak - $(MAKE) -s -C demo/object -f mso.mak clean all - ( ./demo/object/multistate_output >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f mso.mak clean - -msv: logfile demo/object/msv.mak - $(MAKE) -s -C demo/object -f msv.mak clean all - ( ./demo/object/multistate_value >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f msv.mak clean - -osv: logfile demo/object/osv.mak - $(MAKE) -s -C demo/object -f osv.mak clean all - ( ./demo/object/octetstring_value >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f osv.mak clean - -piv: logfile demo/object/piv.mak - $(MAKE) -s -C demo/object -f piv.mak clean all - ( ./demo/object/positiveinteger_value >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f piv.mak clean - -schedule: logfile demo/object/schedule.mak - $(MAKE) -s -C demo/object -f schedule.mak clean all - ( ./demo/object/schedule >> ${LOGFILE} ) - $(MAKE) -s -C demo/object -f schedule.mak clean diff --git a/bacnet-stack/test/bacdevobjpropref.mak b/bacnet-stack/test/bacdevobjpropref.mak new file mode 100644 index 00000000..3a0acf44 --- /dev/null +++ b/bacnet-stack/test/bacdevobjpropref.mak @@ -0,0 +1,40 @@ +#Makefile to build test case +CC = gcc + +SRC_DIR = ../src +INCLUDES = -I../include -I. +DEFINES = -DBIG_ENDIAN=0 -DTEST -DTEST_DEV_ID_PROP_REF +CFLAGS = -Wall $(INCLUDES) $(DEFINES) -g + +SRCS = $(SRC_DIR)/bacdcode.c \ + $(SRC_DIR)/bacint.c \ + $(SRC_DIR)/bacstr.c \ + $(SRC_DIR)/bacreal.c \ + $(SRC_DIR)/bacapp.c \ + $(SRC_DIR)/bacdevobjpropref.c \ + $(SRC_DIR)/datetime.c \ + $(SRC_DIR)/bactext.c \ + $(SRC_DIR)/lighting.c \ + $(SRC_DIR)/indtext.c \ + ctest.c + +OBJS = ${SRCS:.c=.o} + +TARGET = bacdevobjpropref + +all: ${TARGET} + +${TARGET}: ${OBJS} + ${CC} -o $@ ${OBJS} + +.c.o: + ${CC} -c ${CFLAGS} $*.c -o $@ + +depend: + rm -f .depend + ${CC} -MM ${CFLAGS} *.c >> .depend + +clean: + rm -rf ${TARGET} $(OBJS) + +include: .depend