Secure ReadProperty decoding and BACnetActionCommand (#702)
* Refactored and secured BACnetActionCommand codec into bacaction.c module for command object and added to bacapp module encode/decode with define for enabling and pseudo application tag for internal use. * Simplified bacapp_data_len() and moved into bacdcode module as bacnet_enclosed_data_len() function. * Secured ReadProperty-REQUEST and -ACK decoding. * Removed deprecated Keylist_Key() functions from usage. * Removed pseudo application datatypes from bacapp_data_decode() which only uses primitive application tag encoded values. * Defined INT_MAX when it is not already defined by compiler or libc. * Deprecated bacapp_decode_application_data_len() and bacapp_decode_context_data_len() as they are no longer used in any code in the library. * Added BACnetScale to bacapp module. Improved complex property value decoding. Refactored bacapp_decode_known_property() function. * Refactored and improved the bacapp_snprintf() function for printing EPICS. * Fixed Lighting Output WriteProperty to handle known property decoding.
This commit is contained in:
@@ -35,6 +35,7 @@ add_executable(${PROJECT_NAME}
|
||||
# File(s) under test
|
||||
${SRC_DIR}/bacnet/basic/object/command.c
|
||||
# Support files and stubs (pathname alphabetical)
|
||||
${SRC_DIR}/bacnet/bacaction.c
|
||||
${SRC_DIR}/bacnet/bacaddr.c
|
||||
${SRC_DIR}/bacnet/bacapp.c
|
||||
${SRC_DIR}/bacnet/bacdcode.c
|
||||
|
||||
@@ -27,12 +27,36 @@ static void test_object_command(void)
|
||||
bool status = false;
|
||||
unsigned count = 0;
|
||||
uint32_t object_instance = 0;
|
||||
const int skip_fail_property_list[] = { PROP_ACTION, -1 };
|
||||
const int skip_fail_property_list[] = { -1 };
|
||||
BACNET_ACTION_LIST *pAction;
|
||||
|
||||
Command_Init();
|
||||
count = Command_Count();
|
||||
zassert_true(count > 0, NULL);
|
||||
object_instance = Command_Index_To_Instance(0);
|
||||
status = Command_Valid_Instance(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
count = Command_Action_List_Count(object_instance);
|
||||
zassert_true(count > 0, NULL);
|
||||
/* configure the instance property values */
|
||||
pAction = Command_Action_List_Entry(object_instance, 0);
|
||||
zassert_not_null(pAction, NULL);
|
||||
pAction->Device_Id.type = OBJECT_DEVICE;
|
||||
pAction->Device_Id.instance = 4194303;
|
||||
pAction->Object_Id.type = OBJECT_ANALOG_INPUT;
|
||||
pAction->Object_Id.instance = 4194303;
|
||||
pAction->Property_Identifier = PROP_PRESENT_VALUE;
|
||||
pAction->Property_Array_Index = BACNET_ARRAY_ALL;
|
||||
pAction->Priority = 16;
|
||||
pAction->Value.tag = BACNET_APPLICATION_TAG_REAL;
|
||||
pAction->Value.type.Real = 3.14159;
|
||||
pAction->Post_Delay = 0;
|
||||
pAction->Quit_On_Failure = false;
|
||||
pAction->Write_Successful = false;
|
||||
pAction->next = NULL;
|
||||
Command_In_Process_Set(object_instance, false);
|
||||
Command_All_Writes_Successful_Set(object_instance, false);
|
||||
/* perform a general test for RP/WP */
|
||||
bacnet_object_properties_read_write_test(
|
||||
OBJECT_COMMAND, object_instance, Command_Property_Lists,
|
||||
Command_Read_Property, Command_Write_Property, skip_fail_property_list);
|
||||
|
||||
Reference in New Issue
Block a user