diff --git a/bacnet-stack/demo/object/ai.c b/bacnet-stack/demo/object/ai.c index 4d410f3e..a85a63d5 100644 --- a/bacnet-stack/demo/object/ai.c +++ b/bacnet-stack/demo/object/ai.c @@ -213,6 +213,13 @@ int Analog_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/ao.c b/bacnet-stack/demo/object/ao.c index aa7d7e0d..590e27e6 100644 --- a/bacnet-stack/demo/object/ao.c +++ b/bacnet-stack/demo/object/ao.c @@ -382,6 +382,14 @@ int Analog_Output_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_PRIORITY_ARRAY) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/av.c b/bacnet-stack/demo/object/av.c index 0c90d1c2..0d4c9257 100644 --- a/bacnet-stack/demo/object/av.c +++ b/bacnet-stack/demo/object/av.c @@ -330,7 +330,6 @@ int Analog_Value_Encode_Property_APDU( apdu_len = -1; } } - break; case PROP_RELINQUISH_DEFAULT: real_value = ANALOG_RELINQUISH_DEFAULT; @@ -342,6 +341,14 @@ int Analog_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_PRIORITY_ARRAY) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/bi.c b/bacnet-stack/demo/object/bi.c index 28ad7751..de693fc3 100644 --- a/bacnet-stack/demo/object/bi.c +++ b/bacnet-stack/demo/object/bi.c @@ -360,6 +360,13 @@ int Binary_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/bo.c b/bacnet-stack/demo/object/bo.c index e010f402..d0e607f7 100644 --- a/bacnet-stack/demo/object/bo.c +++ b/bacnet-stack/demo/object/bo.c @@ -323,6 +323,14 @@ int Binary_Output_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_PRIORITY_ARRAY) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/bv.c b/bacnet-stack/demo/object/bv.c index 96e7e59c..67e31f22 100644 --- a/bacnet-stack/demo/object/bv.c +++ b/bacnet-stack/demo/object/bv.c @@ -304,6 +304,14 @@ int Binary_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_PRIORITY_ARRAY) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/device.c b/bacnet-stack/demo/object/device.c index 3d7b789d..7a960d8f 100644 --- a/bacnet-stack/demo/object/device.c +++ b/bacnet-stack/demo/object/device.c @@ -709,6 +709,14 @@ int Device_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_OBJECT_LIST) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/lc.c b/bacnet-stack/demo/object/lc.c index 10a133e6..f9e207f6 100644 --- a/bacnet-stack/demo/object/lc.c +++ b/bacnet-stack/demo/object/lc.c @@ -920,6 +920,15 @@ int Load_Control_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_SHED_LEVEL_DESCRIPTIONS) && + (property != PROP_SHED_LEVELS) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/lo.c b/bacnet-stack/demo/object/lo.c index bcbcc224..f7cb18ed 100644 --- a/bacnet-stack/demo/object/lo.c +++ b/bacnet-stack/demo/object/lo.c @@ -25,6 +25,11 @@ /* Lighting Output Objects - customize for your use */ +/* WARNING! This object is still BACnet DRAFT status! + If you need to implement in a real product, you will + need to modify the new OBJECT type and properties to + be in the proprietrary range to be BACnet compliant */ + #include #include #include @@ -501,6 +506,14 @@ int Lighting_Output_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_PRIORITY_ARRAY) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/lsp.c b/bacnet-stack/demo/object/lsp.c index dd2073ef..e08df9b1 100644 --- a/bacnet-stack/demo/object/lsp.c +++ b/bacnet-stack/demo/object/lsp.c @@ -207,7 +207,6 @@ int Life_Safety_Point_Encode_Property_APDU( bool state = false; BACNET_RELIABILITY reliability = RELIABILITY_NO_FAULT_DETECTED; - (void) array_index; /* currently not used */ Life_Safety_Point_Init(); switch (property) { case PROP_OBJECT_IDENTIFIER: @@ -285,6 +284,13 @@ int Life_Safety_Point_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/ms-input.c b/bacnet-stack/demo/object/ms-input.c index a417c954..f9fa30b9 100644 --- a/bacnet-stack/demo/object/ms-input.c +++ b/bacnet-stack/demo/object/ms-input.c @@ -435,6 +435,14 @@ int Multistate_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_STATE_TEXT) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/demo/object/mso.c b/bacnet-stack/demo/object/mso.c index 92b3ad58..d309f896 100644 --- a/bacnet-stack/demo/object/mso.c +++ b/bacnet-stack/demo/object/mso.c @@ -323,6 +323,14 @@ int Multistate_Output_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_PRIORITY_ARRAY) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/at91sam7s/Makefile b/bacnet-stack/ports/at91sam7s/Makefile index d7fefb3f..14e4a5f2 100644 --- a/bacnet-stack/ports/at91sam7s/Makefile +++ b/bacnet-stack/ports/at91sam7s/Makefile @@ -61,6 +61,7 @@ DEMOSRC = ai.c \ h_wp.c \ device.c \ $(BACNET_DEMO)/handler/txbuf.c \ + $(BACNET_DEMO)/handler/noserv.c \ $(BACNET_DEMO)/handler/h_npdu.c \ $(BACNET_DEMO)/handler/h_whois.c \ $(BACNET_DEMO)/handler/h_rd.c \ diff --git a/bacnet-stack/ports/at91sam7s/ai.c b/bacnet-stack/ports/at91sam7s/ai.c index 91971a6c..62152db8 100644 --- a/bacnet-stack/ports/at91sam7s/ai.c +++ b/bacnet-stack/ports/at91sam7s/ai.c @@ -114,7 +114,6 @@ int Analog_Input_Encode_Property_APDU( BACNET_BIT_STRING bit_string; BACNET_CHARACTER_STRING char_string; - (void) array_index; switch (property) { case PROP_OBJECT_IDENTIFIER: apdu_len = @@ -163,6 +162,13 @@ int Analog_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/at91sam7s/av.c b/bacnet-stack/ports/at91sam7s/av.c index c6da3761..b10b1e61 100644 --- a/bacnet-stack/ports/at91sam7s/av.c +++ b/bacnet-stack/ports/at91sam7s/av.c @@ -272,6 +272,16 @@ int Analog_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && +#if 0 + (property != PROP_PRIORITY_ARRAY) && +#endif + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/at91sam7s/bi.c b/bacnet-stack/ports/at91sam7s/bi.c index ba4f539d..ed145b84 100644 --- a/bacnet-stack/ports/at91sam7s/bi.c +++ b/bacnet-stack/ports/at91sam7s/bi.c @@ -137,7 +137,6 @@ int Binary_Input_Encode_Property_APDU( BACNET_BINARY_PV value = BINARY_INACTIVE; - (void) array_index; Binary_Input_Initialize(); switch (property) { case PROP_OBJECT_IDENTIFIER: @@ -187,6 +186,13 @@ int Binary_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/at91sam7s/bv.c b/bacnet-stack/ports/at91sam7s/bv.c index c361dd78..c42a2caa 100644 --- a/bacnet-stack/ports/at91sam7s/bv.c +++ b/bacnet-stack/ports/at91sam7s/bv.c @@ -184,6 +184,13 @@ int Binary_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/at91sam7s/device.c b/bacnet-stack/ports/at91sam7s/device.c index 45596b46..e07f22fa 100644 --- a/bacnet-stack/ports/at91sam7s/device.c +++ b/bacnet-stack/ports/at91sam7s/device.c @@ -25,6 +25,7 @@ #include #include +#include #include "bacdef.h" #include "bacdcode.h" #include "bacstr.h" @@ -464,6 +465,14 @@ int Device_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_OBJECT_LIST) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega168/ai.c b/bacnet-stack/ports/atmega168/ai.c index b32e3099..558b2d3e 100644 --- a/bacnet-stack/ports/atmega168/ai.c +++ b/bacnet-stack/ports/atmega168/ai.c @@ -154,6 +154,13 @@ int Analog_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega168/av.c b/bacnet-stack/ports/atmega168/av.c index ea088c58..04b44225 100644 --- a/bacnet-stack/ports/atmega168/av.c +++ b/bacnet-stack/ports/atmega168/av.c @@ -151,6 +151,13 @@ int Analog_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega168/bv.c b/bacnet-stack/ports/atmega168/bv.c index d7cdc2a7..fd3f93ac 100644 --- a/bacnet-stack/ports/atmega168/bv.c +++ b/bacnet-stack/ports/atmega168/bv.c @@ -168,6 +168,13 @@ int Binary_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega168/device.c b/bacnet-stack/ports/atmega168/device.c index 4f326b5f..8fafc4e8 100644 --- a/bacnet-stack/ports/atmega168/device.c +++ b/bacnet-stack/ports/atmega168/device.c @@ -336,6 +336,14 @@ int Device_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_OBJECT_LIST) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega8/ai.c b/bacnet-stack/ports/atmega8/ai.c index b32e3099..43494d58 100644 --- a/bacnet-stack/ports/atmega8/ai.c +++ b/bacnet-stack/ports/atmega8/ai.c @@ -103,8 +103,6 @@ int Analog_Input_Encode_Property_APDU( BACNET_CHARACTER_STRING char_string; unsigned object_index; - - (void) array_index; switch (property) { case PROP_OBJECT_IDENTIFIER: apdu_len = @@ -154,6 +152,13 @@ int Analog_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega8/av.c b/bacnet-stack/ports/atmega8/av.c index ea088c58..04b44225 100644 --- a/bacnet-stack/ports/atmega8/av.c +++ b/bacnet-stack/ports/atmega8/av.c @@ -151,6 +151,13 @@ int Analog_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega8/bv.c b/bacnet-stack/ports/atmega8/bv.c index d7cdc2a7..fd3f93ac 100644 --- a/bacnet-stack/ports/atmega8/bv.c +++ b/bacnet-stack/ports/atmega8/bv.c @@ -168,6 +168,13 @@ int Binary_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/atmega8/device.c b/bacnet-stack/ports/atmega8/device.c index b788480b..826165ab 100644 --- a/bacnet-stack/ports/atmega8/device.c +++ b/bacnet-stack/ports/atmega8/device.c @@ -327,6 +327,14 @@ int Device_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_OBJECT_LIST) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/ai.c b/bacnet-stack/ports/bdk-atxx4-mstp/ai.c index c06a9b3b..a6d78e4c 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/ai.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/ai.c @@ -157,7 +157,6 @@ int Analog_Input_Encode_Property_APDU( BACNET_BIT_STRING bit_string; BACNET_CHARACTER_STRING char_string; - (void) array_index; switch (property) { case PROP_OBJECT_IDENTIFIER: apdu_len = @@ -206,6 +205,13 @@ int Analog_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/av.c b/bacnet-stack/ports/bdk-atxx4-mstp/av.c index bdf42407..75af4734 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/av.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/av.c @@ -316,6 +316,16 @@ int Analog_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && +#if 0 + (property != PROP_PRIORITY_ARRAY) && +#endif + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } @@ -397,59 +407,3 @@ bool Analog_Value_Write_Property( return status; } - - -#ifdef TEST -#include -#include -#include "ctest.h" - -void testAnalog_Value( - Test * pTest) -{ - uint8_t apdu[MAX_APDU] = { 0 }; - int len = 0; - uint32_t len_value = 0; - uint8_t tag_number = 0; - BACNET_OBJECT_TYPE decoded_type = OBJECT_ANALOG_VALUE; - uint32_t decoded_instance = 0; - uint32_t instance = 123; - BACNET_ERROR_CLASS error_class; - BACNET_ERROR_CODE error_code; - - - len = - Analog_Value_Encode_Property_APDU(&apdu[0], instance, - PROP_OBJECT_IDENTIFIER, BACNET_ARRAY_ALL, &error_class, &error_code); - ct_test(pTest, len != 0); - len = decode_tag_number_and_value(&apdu[0], &tag_number, &len_value); - ct_test(pTest, tag_number == BACNET_APPLICATION_TAG_OBJECT_ID); - len = - decode_object_id(&apdu[len], (int *) &decoded_type, &decoded_instance); - ct_test(pTest, decoded_type == OBJECT_ANALOG_VALUE); - ct_test(pTest, decoded_instance == instance); - - return; -} - -#ifdef TEST_ANALOG_VALUE -int main( - void) -{ - Test *pTest; - bool rc; - - pTest = ct_create("BACnet Analog Value", NULL); - /* individual tests */ - rc = ct_addTestFunction(pTest, testAnalog_Value); - assert(rc); - - ct_setStream(pTest, stdout); - ct_run(pTest); - (void) ct_report(pTest); - ct_destroy(pTest); - - return 0; -} -#endif /* TEST_ANALOG_VALUE */ -#endif /* TEST */ diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/bi.c b/bacnet-stack/ports/bdk-atxx4-mstp/bi.c index 506e1afb..6f521a13 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/bi.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/bi.c @@ -189,8 +189,6 @@ int Binary_Input_Encode_Property_APDU( BACNET_POLARITY polarity = POLARITY_NORMAL; BACNET_BINARY_PV value = BINARY_INACTIVE; - - (void) array_index; switch (property) { case PROP_OBJECT_IDENTIFIER: apdu_len = @@ -239,6 +237,13 @@ int Binary_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/bo.c b/bacnet-stack/ports/bdk-atxx4-mstp/bo.c index f006b310..151ed94b 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/bo.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/bo.c @@ -364,7 +364,6 @@ int Binary_Output_Encode_Property_APDU( apdu_len = -1; } } - break; case PROP_RELINQUISH_DEFAULT: present_value = RELINQUISH_DEFAULT; @@ -386,6 +385,14 @@ int Binary_Output_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_PRIORITY_ARRAY) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/bdk-atxx4-mstp/device.c b/bacnet-stack/ports/bdk-atxx4-mstp/device.c index 2a25cd2b..0f4f0186 100644 --- a/bacnet-stack/ports/bdk-atxx4-mstp/device.c +++ b/bacnet-stack/ports/bdk-atxx4-mstp/device.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "bacdef.h" #include "bacdcode.h" #include "bacstr.h" @@ -515,6 +516,14 @@ int Device_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_OBJECT_LIST) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/pic18f6720/ai.c b/bacnet-stack/ports/pic18f6720/ai.c index ecd743f8..c3d9219d 100644 --- a/bacnet-stack/ports/pic18f6720/ai.c +++ b/bacnet-stack/ports/pic18f6720/ai.c @@ -160,6 +160,13 @@ int Analog_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/pic18f6720/av.c b/bacnet-stack/ports/pic18f6720/av.c index 04f8fe66..e495ba00 100644 --- a/bacnet-stack/ports/pic18f6720/av.c +++ b/bacnet-stack/ports/pic18f6720/av.c @@ -269,6 +269,16 @@ int Analog_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && +#if 0 + (property != PROP_PRIORITY_ARRAY) && +#endif + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/pic18f6720/bi.c b/bacnet-stack/ports/pic18f6720/bi.c index 28f50d49..c6e7ffa0 100644 --- a/bacnet-stack/ports/pic18f6720/bi.c +++ b/bacnet-stack/ports/pic18f6720/bi.c @@ -184,6 +184,13 @@ int Binary_Input_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/pic18f6720/bv.c b/bacnet-stack/ports/pic18f6720/bv.c index eeaf6f66..b00f4f34 100644 --- a/bacnet-stack/ports/pic18f6720/bv.c +++ b/bacnet-stack/ports/pic18f6720/bv.c @@ -185,6 +185,13 @@ int Binary_Value_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; } diff --git a/bacnet-stack/ports/pic18f6720/device.c b/bacnet-stack/ports/pic18f6720/device.c index d4ddb296..dce9fdbb 100644 --- a/bacnet-stack/ports/pic18f6720/device.c +++ b/bacnet-stack/ports/pic18f6720/device.c @@ -476,6 +476,14 @@ int Device_Encode_Property_APDU( apdu_len = -1; break; } + /* only array properties can have array options */ + if ((apdu_len >= 0) && + (property != PROP_OBJECT_LIST) && + (array_index != BACNET_ARRAY_ALL)) { + *error_class = ERROR_CLASS_PROPERTY; + *error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY; + apdu_len = -1; + } return apdu_len; }