Feature/apdu null length returned (#285)

* Add APDU as NULL to get BACnet type lengths.

* Fix bacapp copy test to succeed

* fix BACnet REAL and DOUBLE decode

* Add unit test for NULL APDU encoding for length

* Add unit tests for bacapp context

* refactor host-n-port to hostnport.c module

* fix BVLC decoder

* additional unit testing for bacapp

* include bacdevobjpropref module in builds

* simplify bacapp snprintf to be able to return length

* adjust compiler for variable-length arrays

* fix bug found by scan-build

Authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-06-01 15:42:50 -05:00
committed by GitHub
parent 810bfefb34
commit f147283293
76 changed files with 3474 additions and 2791 deletions
+3 -3
View File
@@ -45,7 +45,7 @@
#include "bacnet/proplist.h"
#include "bacnet/lighting.h"
#include "bacnet/basic/object/device.h"
#if defined(CHANNEL_LIGHTING_COMMAND) || defined(BACAPP_LIGHTING_COMMAND)
#if defined(CHANNEL_LIGHTING_COMMAND)
#include "bacnet/basic/object/lo.h"
#endif
/* me! */
@@ -628,7 +628,7 @@ bool Channel_Value_Copy(
status = true;
break;
#endif
#if defined(BACAPP_LIGHTING_COMMAND) && defined(CHANNEL_LIGHTING_COMMAND)
#if defined(BACAPP_TYPES_EXTRA) && defined(CHANNEL_LIGHTING_COMMAND)
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
cvalue->tag = value->tag;
lighting_command_copy(
@@ -1045,7 +1045,7 @@ int Channel_Coerce_Data_Encode(uint8_t *apdu,
}
break;
#endif
#if defined(BACAPP_LIGHTING_COMMAND)
#if defined(BACAPP_TYPES_EXTRA)
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
if (tag == BACNET_APPLICATION_TAG_LIGHTING_COMMAND) {
apdu_len = lighting_command_encode(
+1 -1
View File
@@ -279,7 +279,7 @@ int cl_decode_apdu(uint8_t *apdu,
&bcl->Value.type.Object_Id.type,
&bcl->Value.type.Object_Id.instance);
break;
#if defined(BACAPP_LIGHTING_COMMAND)
#if defined(BACAPP_TYPES_EXTRA)
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
len = lighting_command_decode(&apdu[dec_len], apdu_len - dec_len,
&bcl->Value.type.Lighting_Command);
+1 -1
View File
@@ -210,7 +210,7 @@ static object_functions_t My_Object_Table[] = {
Trend_Log_Write_Property, Trend_Log_Property_Lists, TrendLogGetRRInfo,
NULL /* Iterator */, NULL /* Value_Lists */, NULL /* COV */,
NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
#if (BACNET_PROTOCOL_REVISION >= 14) && defined(BACAPP_LIGHTING_COMMAND)
#if (BACNET_PROTOCOL_REVISION >= 14)
{ OBJECT_LIGHTING_OUTPUT, Lighting_Output_Init, Lighting_Output_Count,
Lighting_Output_Index_To_Instance, Lighting_Output_Valid_Instance,
Lighting_Output_Object_Name, Lighting_Output_Read_Property,