Implement parsing for proprietary events (complex-event-type) (#420)

* Implement parsing for proprietary events (complex-event-type)

* Fix unit test linking for event.c
---------

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Ondřej Hruška
2023-05-17 06:55:55 +02:00
committed by GitHub
parent c02a8281a7
commit dab95eec3f
4 changed files with 683 additions and 451 deletions
+634 -448
View File
File diff suppressed because it is too large Load Diff
+22
View File
@@ -48,6 +48,20 @@ typedef enum {
** Based on UnconfirmedEventNotification-Request
*/
// TODO make these configurable from env?
/** Enable decoding of complex-event-type property-values. If set to 0, the values are decoded and discarded. */
#ifndef BACNET_DECODE_COMPLEX_EVENT_TYPE_PARAMETERS
#define BACNET_DECODE_COMPLEX_EVENT_TYPE_PARAMETERS 1
#endif
/** Max complex-event-type property-values to decode. Events with more values fail to decode. */
#ifndef BACNET_COMPLEX_EVENT_TYPE_MAX_PARAMETERS
#define BACNET_COMPLEX_EVENT_TYPE_MAX_PARAMETERS 5
#endif
typedef struct BACnet_Event_Notification_Data {
uint32_t processIdentifier;
BACNET_OBJECT_ID initiatingObjectIdentifier;
@@ -168,6 +182,14 @@ typedef struct BACnet_Event_Notification_Data {
/* OPTIONAL - Set authenticationFactor.format_type to
AUTHENTICATION_FACTOR_MAX if not being used */
} accessEvent;
#if (BACNET_DECODE_COMPLEX_EVENT_TYPE_PARAMETERS == 1)
/*
* complex-event-type - a sequence of values, used for proprietary event types
*/
struct {
BACNET_PROPERTY_VALUE values[BACNET_COMPLEX_EVENT_TYPE_MAX_PARAMETERS];
} complexEventType;
#endif
} notificationParams;
} BACNET_EVENT_NOTIFICATION_DATA;
+13 -1
View File
@@ -35,16 +35,28 @@ add_executable(${PROJECT_NAME}
${SRC_DIR}/bacnet/event.c
# Support files and stubs (pathname alphabetical)
${SRC_DIR}/bacnet/authentication_factor.c
${SRC_DIR}/bacnet/bacaddr.c
${SRC_DIR}/bacnet/bacapp.c
${SRC_DIR}/bacnet/bacdcode.c
${SRC_DIR}/bacnet/bacdest.c
${SRC_DIR}/bacnet/bacdevobjpropref.c
${SRC_DIR}/bacnet/bacint.c
${SRC_DIR}/bacnet/bacreal.c
${SRC_DIR}/bacnet/bacstr.c
${SRC_DIR}/bacnet/bacpropstates.c
${SRC_DIR}/bacnet/bacdevobjpropref.c
${SRC_DIR}/bacnet/basic/sys/bigend.c
${SRC_DIR}/bacnet/datetime.c
${SRC_DIR}/bacnet/basic/sys/days.c
${SRC_DIR}/bacnet/timestamp.c
# Dependencies of bacapp.c
${SRC_DIR}/bacnet/bactext.c
${SRC_DIR}/bacnet/indtext.c
${SRC_DIR}/bacnet/weeklyschedule.c
${SRC_DIR}/bacnet/bactimevalue.c
${SRC_DIR}/bacnet/dailyschedule.c
${SRC_DIR}/bacnet/lighting.c
${SRC_DIR}/bacnet/timestamp.c
${SRC_DIR}/bacnet/hostnport.c
# Test and test library files
./src/main.c
${ZTST_DIR}/ztest_mock.c
+14 -2
View File
@@ -30,17 +30,29 @@ if(BOARD STREQUAL unit_testing)
get_filename_component(BACNET_SRC ${BACNET_SRC_PATH} PATH)
list(APPEND SOURCES
${BACNET_SRC}/bacaddr.c
${BACNET_SRC}/bacapp.c
${BACNET_SRC}/bacstr.c
${BACNET_SRC}/bacdcode.c
${BACNET_SRC}/bacdest.c
${BACNET_SRC}/bacstr.c
${BACNET_SRC}/bacint.c
${BACNET_SRC}/bacreal.c
${BACNET_SRC}/datetime.c
${BACNET_SRC}/timestamp.c
${BACNET_SRC}/basic/sys/days.c
${BACNET_SRC}/bacdevobjpropref.c
${BACNET_SRC}/authentication_factor.c
${BACNET_SRC}/bacpropstates.c
)
# Dependencies of bacapp.c
${BACNET_SRC}/bactext.c
${BACNET_SRC}/indtext.c
${BACNET_SRC}/weeklyschedule.c
${BACNET_SRC}/bactimevalue.c
${BACNET_SRC}/dailyschedule.c
${BACNET_SRC}/lighting.c
${BACNET_SRC}/timestamp.c
${BACNET_SRC}/hostnport.c
)
set(CONF_FILE "${CONF_FILE};prj.unit_testing.conf")
find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE})