Fixed CreateObject service list-of-initial-values encoding and decoding. (#1199)

Fixes the CreateObject service list-of-initial-values encoding and decoding by refactoring the data structure to be similar to WriteProperty. The implementation changes from using a linked list of property values to using a flat buffer approach with delayed decoding.

Changes:

* Refactored BACNET_CREATE_OBJECT_DATA structure to use an application_data buffer instead of a linked list for initial values
* Added a new create_object_process() and create_object_initializer_list_process() functions to centralize object creation logic and error reporting
* Updated all device implementations to use the new centralized creation functions
* Enhanced the create-object example application to support command-line specification of initial property values
* Added comprehensive test coverage for the new encoding/decoding and processing functions
This commit is contained in:
Steve Karg
2026-01-15 14:50:59 -06:00
committed by GitHub
parent 21daea9eb4
commit 5802bd0ecc
18 changed files with 921 additions and 212 deletions
@@ -92,7 +92,9 @@ add_executable(${PROJECT_NAME}
${SRC_DIR}/bacnet/datalink/bvlc.c
${SRC_DIR}/bacnet/datalink/bvlc6.c
${SRC_DIR}/bacnet/cov.c
${SRC_DIR}/bacnet/create_object.c
${SRC_DIR}/bacnet/datetime.c
${SRC_DIR}/bacnet/delete_object.c
${SRC_DIR}/bacnet/dcc.c
${SRC_DIR}/bacnet/indtext.c
${SRC_DIR}/bacnet/hostnport.c
@@ -97,7 +97,9 @@ add_executable(${PROJECT_NAME}
${SRC_DIR}/bacnet/datalink/bvlc.c
${SRC_DIR}/bacnet/datalink/bvlc6.c
${SRC_DIR}/bacnet/cov.c
${SRC_DIR}/bacnet/create_object.c
${SRC_DIR}/bacnet/datetime.c
${SRC_DIR}/bacnet/delete_object.c
${SRC_DIR}/bacnet/dcc.c
${SRC_DIR}/bacnet/indtext.c
${SRC_DIR}/bacnet/hostnport.c
@@ -376,7 +376,7 @@ static void testDevice(void)
count = Device_Object_List_Count();
create_data.object_type = OBJECT_ANALOG_VALUE;
create_data.object_instance = BACNET_MAX_INSTANCE;
create_data.list_of_initial_values = NULL;
create_data.application_data_len = 0;
create_data.error_class = ERROR_CLASS_DEVICE;
create_data.error_code = ERROR_CODE_SUCCESS;
create_data.first_failed_element_number = 0;
@@ -410,7 +410,7 @@ static void testDevice(void)
/* known object without create */
create_data.object_type = OBJECT_DEVICE;
create_data.object_instance = BACNET_MAX_INSTANCE;
create_data.list_of_initial_values = NULL;
create_data.application_data_len = 0;
create_data.error_class = ERROR_CLASS_DEVICE;
create_data.error_code = ERROR_CODE_SUCCESS;
create_data.first_failed_element_number = 0;