From 340bd09561d850700fdebe91c24978143dcf686f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Thu, 1 Feb 2024 17:57:46 +0100 Subject: [PATCH] Implement missing data types for calendar and schedule (#474) * Added the SpecialEvent struct for the Exception_Schedule property of Schedule, encode/decode/same functions, unit tests, and integrated into bacapp functions. * Added the CalendarEntry struct for the Date_List property of Calendar and the SpecialEvent struct, encode/decode functions, unit tests, and integrated into bacapp functions. * Added the DateRange struct for the Effective_Period property of Schedule, encode/decode functions, unit tests, and integrated into bacapp functions. --------- Co-authored-by: Steve Karg --- CMakeLists.txt | 4 + ports/at91sam7s/CMakeLists.txt | 2 + ports/at91sam7s/Makefile | 2 + ports/stm32f10x/Makefile | 2 + ports/stm32f4xx/CMakeLists.txt | 2 + ports/stm32f4xx/Makefile | 2 + .../bacnet-stack/bacnet-stack.vcxproj | 2 + .../bacnet-stack/bacnet-stack.vcxproj.filters | 6 + src/bacnet/bacapp.c | 161 +++++++- src/bacnet/bacapp.h | 11 + src/bacnet/calendar_entry.c | 363 +++++++++++++++++ src/bacnet/calendar_entry.h | 78 ++++ src/bacnet/config.h | 9 + src/bacnet/dailyschedule.c | 15 +- src/bacnet/dailyschedule.h | 6 +- src/bacnet/datetime.c | 194 +++++++-- src/bacnet/datetime.h | 54 +-- src/bacnet/special_event.c | 266 ++++++++++++ src/bacnet/special_event.h | 71 ++++ src/bacnet/weeklyschedule.c | 8 +- test/CMakeLists.txt | 2 + test/bacnet/bacapp/CMakeLists.txt | 2 + test/bacnet/bacdcode/CMakeLists.txt | 2 + test/bacnet/bacdcode/src/main.c | 188 ++++++++- test/bacnet/bacdest/CMakeLists.txt | 2 + test/bacnet/bacdevobjpropref/CMakeLists.txt | 2 + test/bacnet/bacreal/src/main.c | 6 +- test/bacnet/bactimevalue/CMakeLists.txt | 2 + .../basic/binding/address/CMakeLists.txt | 2 + test/bacnet/basic/object/acc/CMakeLists.txt | 2 + .../object/access_credential/CMakeLists.txt | 2 + .../basic/object/access_door/CMakeLists.txt | 2 + .../basic/object/access_point/CMakeLists.txt | 2 + .../basic/object/access_rights/CMakeLists.txt | 2 + .../basic/object/access_user/CMakeLists.txt | 2 + .../basic/object/access_zone/CMakeLists.txt | 2 + test/bacnet/basic/object/ai/CMakeLists.txt | 2 + test/bacnet/basic/object/ao/CMakeLists.txt | 2 + test/bacnet/basic/object/av/CMakeLists.txt | 2 + .../basic/object/bacfile/CMakeLists.txt | 2 + test/bacnet/basic/object/bi/CMakeLists.txt | 2 + test/bacnet/basic/object/blo/CMakeLists.txt | 2 + test/bacnet/basic/object/bo/CMakeLists.txt | 2 + test/bacnet/basic/object/bv/CMakeLists.txt | 2 + .../basic/object/channel/CMakeLists.txt | 2 + .../basic/object/color_object/CMakeLists.txt | 2 + .../object/color_temperature/CMakeLists.txt | 2 + .../basic/object/command/CMakeLists.txt | 2 + .../credential_data_input/CMakeLists.txt | 2 + test/bacnet/basic/object/csv/CMakeLists.txt | 2 + .../bacnet/basic/object/device/CMakeLists.txt | 2 + test/bacnet/basic/object/iv/CMakeLists.txt | 2 + test/bacnet/basic/object/lc/CMakeLists.txt | 2 + test/bacnet/basic/object/lo/CMakeLists.txt | 2 + test/bacnet/basic/object/lsp/CMakeLists.txt | 2 + .../basic/object/ms-input/CMakeLists.txt | 2 + test/bacnet/basic/object/mso/CMakeLists.txt | 2 + test/bacnet/basic/object/msv/CMakeLists.txt | 2 + test/bacnet/basic/object/nc/CMakeLists.txt | 2 + .../basic/object/netport/CMakeLists.txt | 2 + test/bacnet/basic/object/osv/CMakeLists.txt | 2 + test/bacnet/basic/object/piv/CMakeLists.txt | 2 + .../basic/object/schedule/CMakeLists.txt | 2 + .../basic/object/trendlog/CMakeLists.txt | 2 + test/bacnet/cov/CMakeLists.txt | 2 + test/bacnet/cov/src/main.c | 3 +- test/bacnet/create_object/CMakeLists.txt | 3 + test/bacnet/delete_object/CMakeLists.txt | 4 +- test/bacnet/event/CMakeLists.txt | 2 + test/bacnet/event/src/main.c | 36 +- test/bacnet/getalarm/CMakeLists.txt | 2 + test/bacnet/getevent/CMakeLists.txt | 2 + test/bacnet/hostnport/CMakeLists.txt | 2 + test/bacnet/list_element/CMakeLists.txt | 2 + test/bacnet/lso/CMakeLists.txt | 2 + test/bacnet/ptransfer/CMakeLists.txt | 2 + test/bacnet/rpm/CMakeLists.txt | 2 + test/bacnet/specialevent/CMakeLists.txt | 63 +++ test/bacnet/specialevent/src/main.c | 377 ++++++++++++++++++ test/bacnet/timesync/CMakeLists.txt | 2 + test/bacnet/weeklyschedule/CMakeLists.txt | 2 + test/bacnet/wp/CMakeLists.txt | 2 + test/bacnet/wp/src/main.c | 5 +- test/bacnet/wpm/CMakeLists.txt | 2 + zephyr/CMakeLists.txt | 4 + zephyr/tests/bacnet/bacapp/CMakeLists.txt | 2 + .../bacnet/basic/object/acc/CMakeLists.txt | 2 + .../object/access_credential/CMakeLists.txt | 2 + .../basic/object/access_door/CMakeLists.txt | 2 + .../basic/object/access_point/CMakeLists.txt | 2 + .../basic/object/access_rights/CMakeLists.txt | 2 + .../basic/object/access_user/CMakeLists.txt | 2 + .../basic/object/access_zone/CMakeLists.txt | 2 + .../bacnet/basic/object/ai/CMakeLists.txt | 2 + .../bacnet/basic/object/ao/CMakeLists.txt | 2 + .../bacnet/basic/object/av/CMakeLists.txt | 2 + .../bacnet/basic/object/bi/CMakeLists.txt | 2 + .../bacnet/basic/object/bo/CMakeLists.txt | 2 + .../bacnet/basic/object/bv/CMakeLists.txt | 2 + .../basic/object/color_object/CMakeLists.txt | 2 + .../object/color_temperature/CMakeLists.txt | 2 + .../basic/object/command/CMakeLists.txt | 2 + .../credential_data_input/CMakeLists.txt | 2 + .../bacnet/basic/object/device/CMakeLists.txt | 2 + .../bacnet/basic/object/lc/CMakeLists.txt | 2 + .../bacnet/basic/object/lo/CMakeLists.txt | 2 + .../bacnet/basic/object/lsp/CMakeLists.txt | 2 + .../basic/object/ms-input/CMakeLists.txt | 2 + .../bacnet/basic/object/mso/CMakeLists.txt | 2 + .../bacnet/basic/object/msv/CMakeLists.txt | 2 + .../basic/object/netport/CMakeLists.txt | 2 + .../basic/object/objects/CMakeLists.txt | 2 + .../bacnet/basic/object/osv/CMakeLists.txt | 2 + .../bacnet/basic/object/piv/CMakeLists.txt | 2 + .../basic/object/schedule/CMakeLists.txt | 2 + zephyr/tests/bacnet/cov/CMakeLists.txt | 2 + zephyr/tests/bacnet/event/CMakeLists.txt | 2 + zephyr/tests/bacnet/ptransfer/CMakeLists.txt | 2 + zephyr/tests/bacnet/rpm/CMakeLists.txt | 2 + zephyr/tests/bacnet/wp/CMakeLists.txt | 2 + 120 files changed, 2003 insertions(+), 124 deletions(-) create mode 100644 src/bacnet/calendar_entry.c create mode 100644 src/bacnet/calendar_entry.h create mode 100644 src/bacnet/special_event.c create mode 100644 src/bacnet/special_event.h create mode 100644 test/bacnet/specialevent/CMakeLists.txt create mode 100644 test/bacnet/specialevent/src/main.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 094cd266..fb11b46b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,6 +151,8 @@ add_library(${PROJECT_NAME} src/bacnet/dailyschedule.h src/bacnet/weeklyschedule.c src/bacnet/weeklyschedule.h + src/bacnet/special_event.c + src/bacnet/special_event.h $<$:src/bacnet/basic/bbmd/h_bbmd.c> $<$:src/bacnet/basic/bbmd/h_bbmd.h> $<$:src/bacnet/basic/bbmd6/h_bbmd6.c> @@ -389,6 +391,8 @@ add_library(${PROJECT_NAME} src/bacnet/bits.h src/bacnet/bytes.h src/bacnet/config.h + src/bacnet/calendar_entry.c + src/bacnet/calendar_entry.h src/bacnet/cov.c src/bacnet/cov.h src/bacnet/create_object.c diff --git a/ports/at91sam7s/CMakeLists.txt b/ports/at91sam7s/CMakeLists.txt index 1fc2c6df..43d41fce 100644 --- a/ports/at91sam7s/CMakeLists.txt +++ b/ports/at91sam7s/CMakeLists.txt @@ -164,6 +164,8 @@ set(BACNET_PROJECT_SOURCE ${LIBRARY_BACNET_CORE}/timestamp.c ${LIBRARY_BACNET_CORE}/weeklyschedule.c ${LIBRARY_BACNET_CORE}/dailyschedule.c + ${LIBRARY_BACNET_CORE}/calendar_entry.c + ${LIBRARY_BACNET_CORE}/special_event.c ${LIBRARY_BACNET_CORE}/bactimevalue.c ${LIBRARY_BACNET_CORE}/whohas.c ${LIBRARY_BACNET_CORE}/whois.c diff --git a/ports/at91sam7s/Makefile b/ports/at91sam7s/Makefile index 28ca1a2e..9a2eaa5f 100644 --- a/ports/at91sam7s/Makefile +++ b/ports/at91sam7s/Makefile @@ -115,6 +115,8 @@ CORESRC = $(BACNET_CORE)/abort.c \ $(BACNET_CORE)/weeklyschedule.c \ $(BACNET_CORE)/dailyschedule.c \ $(BACNET_CORE)/bactimevalue.c \ + $(BACNET_CORE)/calendar_entry.c \ + $(BACNET_CORE)/special_event.c \ $(BACNET_CORE)/whohas.c \ $(BACNET_CORE)/whois.c \ $(BACNET_CORE)/wp.c diff --git a/ports/stm32f10x/Makefile b/ports/stm32f10x/Makefile index a0477622..071c3c37 100644 --- a/ports/stm32f10x/Makefile +++ b/ports/stm32f10x/Makefile @@ -80,6 +80,8 @@ BACNET_SRC = \ $(BACNET_CORE)/weeklyschedule.c \ $(BACNET_CORE)/dailyschedule.c \ $(BACNET_CORE)/bactimevalue.c \ + $(BACNET_CORE)/calendar_entry.c \ + $(BACNET_CORE)/special_event.c \ $(BACNET_CORE)/whohas.c \ $(BACNET_CORE)/whois.c \ $(BACNET_CORE)/wp.c diff --git a/ports/stm32f4xx/CMakeLists.txt b/ports/stm32f4xx/CMakeLists.txt index 9e46d052..7573ec1f 100644 --- a/ports/stm32f4xx/CMakeLists.txt +++ b/ports/stm32f4xx/CMakeLists.txt @@ -196,6 +196,8 @@ set(BACNET_PROJECT_SOURCE ${LIBRARY_BACNET_CORE}/timestamp.c ${LIBRARY_BACNET_CORE}/weeklyschedule.c ${LIBRARY_BACNET_CORE}/dailyschedule.c + ${LIBRARY_BACNET_CORE}/calendar_entry.c + ${LIBRARY_BACNET_CORE}/special_event.c ${LIBRARY_BACNET_CORE}/bactimevalue.c ${LIBRARY_BACNET_CORE}/whohas.c ${LIBRARY_BACNET_CORE}/whois.c diff --git a/ports/stm32f4xx/Makefile b/ports/stm32f4xx/Makefile index 465a5f1d..d046c200 100644 --- a/ports/stm32f4xx/Makefile +++ b/ports/stm32f4xx/Makefile @@ -81,6 +81,8 @@ BACNET_SRC = \ $(BACNET_CORE)/timestamp.c \ $(BACNET_CORE)/weeklyschedule.c \ $(BACNET_CORE)/dailyschedule.c \ + $(BACNET_CORE)/calendar_entry.c \ + $(BACNET_CORE)/special_event.c \ $(BACNET_CORE)/bactimevalue.c \ $(BACNET_CORE)/whohas.c \ $(BACNET_CORE)/whois.c \ diff --git a/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj b/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj index 8be7b02c..e9debc68 100644 --- a/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj +++ b/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj @@ -189,6 +189,8 @@ + + diff --git a/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj.filters b/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj.filters index db072a3f..13492f46 100644 --- a/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj.filters +++ b/ports/win32/Microsoft Visual Studio/bacnet-stack/bacnet-stack.vcxproj.filters @@ -204,6 +204,12 @@ Source Files\src\bacnet + + Source Files\src\bacnet + + + Source Files\src\bacnet + Source Files\src\bacnet diff --git a/src/bacnet/bacapp.c b/src/bacnet/bacapp.c index 396047dc..ca03126a 100644 --- a/src/bacnet/bacapp.c +++ b/src/bacnet/bacapp.c @@ -55,6 +55,8 @@ #include "bacnet/lighting.h" #include "bacnet/hostnport.h" #include "bacnet/weeklyschedule.h" +#include "bacnet/calendar_entry.h" +#include "bacnet/special_event.h" #include "bacnet/basic/sys/platform.h" /** @file bacapp.c Utilities for the BACnet_Application_Data_Value */ @@ -157,6 +159,11 @@ int bacapp_encode_application_data( apdu_len = bacapp_encode_datetime(apdu, &value->type.Date_Time); break; #endif +#if defined(BACAPP_DATERANGE) + case BACNET_APPLICATION_TAG_DATERANGE: + apdu_len = bacnet_daterange_encode(apdu, &value->type.Date_Range); + break; +#endif #if defined(BACAPP_LIGHTING_COMMAND) case BACNET_APPLICATION_TAG_LIGHTING_COMMAND: /* BACnetLightingCommand */ @@ -184,6 +191,20 @@ int bacapp_encode_application_data( apdu, &value->type.Weekly_Schedule); break; #endif +#if defined(BACAPP_CALENDAR_ENTRY) + case BACNET_APPLICATION_TAG_CALENDAR_ENTRY: + /* BACnetCalendarEntry */ + apdu_len = bacnet_calendar_entry_encode( + apdu, &value->type.Calendar_Entry); + break; +#endif +#if defined(BACAPP_SPECIAL_EVENT) + case BACNET_APPLICATION_TAG_SPECIAL_EVENT: + /* BACnetSpecialEvent */ + apdu_len = bacnet_special_event_encode( + apdu, &value->type.Special_Event); + break; +#endif #if defined(BACAPP_HOST_N_PORT) case BACNET_APPLICATION_TAG_HOST_N_PORT: /* BACnetHostNPort */ @@ -336,6 +357,12 @@ int bacapp_decode_data(uint8_t *apdu, apdu, len_value_type, &value->type.Date_Time); break; #endif +#if defined(BACAPP_DATERANGE) + case BACNET_APPLICATION_TAG_DATERANGE: + len = bacnet_daterange_decode(apdu, len_value_type, + &value->type.Date_Range); + break; +#endif #if defined(BACAPP_LIGHTING_COMMAND) case BACNET_APPLICATION_TAG_LIGHTING_COMMAND: len = lighting_command_decode( @@ -359,7 +386,19 @@ int bacapp_decode_data(uint8_t *apdu, #if defined(BACAPP_WEEKLY_SCHEDULE) case BACNET_APPLICATION_TAG_WEEKLY_SCHEDULE: len = bacnet_weeklyschedule_decode( - apdu, len_value_type, &value->type.Weekly_Schedule); + apdu, (int) len_value_type, &value->type.Weekly_Schedule); + break; +#endif +#if defined(BACAPP_CALENDAR_ENTRY) + case BACNET_APPLICATION_TAG_CALENDAR_ENTRY: + len = bacnet_calendar_entry_decode( + apdu, len_value_type, &value->type.Calendar_Entry); + break; +#endif +#if defined(BACAPP_SPECIAL_EVENT) + case BACNET_APPLICATION_TAG_SPECIAL_EVENT: + len = bacnet_special_event_decode( + apdu, (int) len_value_type, &value->type.Special_Event); break; #endif #if defined(BACAPP_HOST_N_PORT) @@ -692,6 +731,12 @@ int bacapp_encode_context_data_value(uint8_t *apdu, apdu, context_tag_number, &value->type.Date_Time); break; #endif +#if defined(BACAPP_DATERANGE) + case BACNET_APPLICATION_TAG_DATERANGE: + apdu_len = bacnet_daterange_context_encode( + apdu, context_tag_number, &value->type.Date_Range); + break; +#endif #if defined(BACAPP_LIGHTING_COMMAND) case BACNET_APPLICATION_TAG_LIGHTING_COMMAND: apdu_len = lighting_command_encode_context( @@ -705,6 +750,20 @@ int bacapp_encode_context_data_value(uint8_t *apdu, apdu, context_tag_number, &value->type.XY_Color); break; #endif +#if defined(BACAPP_CALENDAR_ENTRY) + case BACNET_APPLICATION_TAG_CALENDAR_ENTRY: + /* BACnetWeeklySchedule */ + apdu_len = bacnet_calendar_entry_context_encode( + apdu, context_tag_number, &value->type.Calendar_Entry); + break; +#endif +#if defined(BACAPP_SPECIAL_EVENT) + case BACNET_APPLICATION_TAG_SPECIAL_EVENT: + /* BACnetWeeklySchedule */ + apdu_len = bacnet_special_event_context_encode( + apdu, context_tag_number, &value->type.Special_Event); + break; +#endif #if defined(BACAPP_COLOR_COMMAND) case BACNET_APPLICATION_TAG_COLOR_COMMAND: /* BACnetColorCommand */ @@ -1216,19 +1275,19 @@ int bacapp_known_property_tag( case PROP_EXCEPTION_SCHEDULE: /* BACnetSpecialEvent (Schedule) */ - return -1; + return BACNET_APPLICATION_TAG_SPECIAL_EVENT; case PROP_DATE_LIST: - /* FIXME: Properties using : BACnetCalendarEntry */ - return -1; + /* BACnetCalendarEntry */ + return BACNET_APPLICATION_TAG_CALENDAR_ENTRY; case PROP_ACTIVE_COV_SUBSCRIPTIONS: /* FIXME: BACnetCOVSubscription */ return -1; case PROP_EFFECTIVE_PERIOD: - /* FIXME: Properties using BACnetDateRange (Schedule) */ - return -1; + /* BACnetDateRange (Schedule) */ + return BACNET_APPLICATION_TAG_DATERANGE; case PROP_RECIPIENT_LIST: /* Properties using BACnetDestination */ @@ -1417,19 +1476,37 @@ int bacapp_decode_known_property(uint8_t *apdu, #endif break; + case PROP_DATE_LIST: +#ifdef BACAPP_CALENDAR_ENTRY + /* List of BACnetCalendarEntry */ + len = bacnet_calendar_entry_decode( + apdu, max_apdu_len, &value->type.Calendar_Entry); +#endif + break; + + case PROP_EXCEPTION_SCHEDULE: +#ifdef BACAPP_SPECIAL_EVENT + /* List of BACnetSpecialEvent (Schedule) */ + len = bacnet_special_event_decode( + apdu, max_apdu_len, &value->type.Special_Event); +#endif + break; + + case PROP_EFFECTIVE_PERIOD: +#ifdef BACAPP_DATERANGE + /* BACnetDateRange (Schedule) */ + len = bacnet_daterange_decode( + apdu, max_apdu_len, &value->type.Date_Range); +#endif + break; + /* properties without a specific decoder - fall through to default */ case PROP_LIST_OF_GROUP_MEMBERS: /* Properties using ReadAccessSpecification */ - case PROP_EXCEPTION_SCHEDULE: - /* BACnetSpecialEvent (Schedule) */ - case PROP_DATE_LIST: - /* FIXME: Properties using : BACnetCalendarEntry */ case PROP_ACTIVE_COV_SUBSCRIPTIONS: /* FIXME: BACnetCOVSubscription */ - case PROP_EFFECTIVE_PERIOD: - /* FIXME: Properties using BACnetDateRange (Schedule) */ case PROP_TIME_SYNCHRONIZATION_RECIPIENTS: case PROP_RESTART_NOTIFICATION_RECIPIENTS: case PROP_UTC_TIME_SYNCHRONIZATION_RECIPIENTS: @@ -2305,6 +2382,26 @@ int bacapp_snprintf_value( ret_val += slen; break; #endif +#if defined(BACAPP_DATERANGE) + case BACNET_APPLICATION_TAG_DATERANGE: + slen = bacapp_snprintf_date(str, str_len, &value->type.Date_Range.startdate); + ret_val += slen; + if (str) { + str += slen; + if (str_len >= slen) { + str_len -= slen; + } else { + str_len = 0; + } + } + + slen = snprintf(str, str_len, ".."); + ret_val += slen; + + slen = bacapp_snprintf_date(str, str_len, &value->type.Date_Range.enddate); + ret_val += slen; + break; +#endif #if defined(BACAPP_TIMESTAMP) case BACNET_APPLICATION_TAG_TIMESTAMP: /*ISO 8601 format */ @@ -2389,6 +2486,20 @@ int bacapp_snprintf_value( &value->type.Weekly_Schedule, object_value->array_index); break; #endif +#if defined(BACAPP_SPECIAL_EVENT) + case BACNET_APPLICATION_TAG_SPECIAL_EVENT: + /* FIXME: add printing for BACnetSpecialEvent */ + ret_val = + snprintf(str, str_len, "SpecialEvent(TODO)"); + break; +#endif +#if defined(BACAPP_CALENDAR_ENTRY) + case BACNET_APPLICATION_TAG_CALENDAR_ENTRY: + /* FIXME: add printing for BACnetCalendarEntry */ + ret_val = + snprintf(str, str_len, "CalendarEntry(TODO)"); + break; +#endif #if defined(BACAPP_HOST_N_PORT) case BACNET_APPLICATION_TAG_HOST_N_PORT: /* BACnetHostNPort */ @@ -2901,6 +3012,16 @@ bool bacapp_parse_application_data(BACNET_APPLICATION_TAG tag_number, status = parse_weeklyschedule(argv, value); break; #endif +#if defined(BACAPP_SPECIAL_EVENT) + case BACNET_APPLICATION_TAG_SPECIAL_EVENT: + /* FIXME: add parsing for BACnetSpecialEvent */ + break; +#endif +#if defined(BACAPP_CALENDAR_ENTRY) + case BACNET_APPLICATION_TAG_CALENDAR_ENTRY: + /* FIXME: add parsing for BACnetCalendarEntry */ + break; +#endif #if defined(BACAPP_HOST_N_PORT) case BACNET_APPLICATION_TAG_HOST_N_PORT: status = @@ -3360,6 +3481,22 @@ bool bacapp_same_value(BACNET_APPLICATION_DATA_VALUE *value, &test_value->type.Weekly_Schedule); break; #endif +#if defined(BACAPP_CALENDAR_ENTRY) + case BACNET_APPLICATION_TAG_CALENDAR_ENTRY: + /* BACnetCalendarEntry */ + status = + bacnet_calendar_entry_same(&value->type.Calendar_Entry, + &test_value->type.Calendar_Entry); + break; +#endif +#if defined(BACAPP_SPECIAL_EVENT) + case BACNET_APPLICATION_TAG_SPECIAL_EVENT: + /* BACnetSpecialEvent */ + status = + bacnet_special_event_same(&value->type.Special_Event, + &test_value->type.Special_Event); + break; +#endif #if defined(BACAPP_HOST_N_PORT) case BACNET_APPLICATION_TAG_HOST_N_PORT: status = host_n_port_same( diff --git a/src/bacnet/bacapp.h b/src/bacnet/bacapp.h index 53e4c638..a09cbc50 100644 --- a/src/bacnet/bacapp.h +++ b/src/bacnet/bacapp.h @@ -38,6 +38,8 @@ #include "bacnet/hostnport.h" #include "bacnet/timestamp.h" #include "bacnet/weeklyschedule.h" +#include "bacnet/calendar_entry.h" +#include "bacnet/special_event.h" struct BACnet_Application_Data_Value; typedef struct BACnet_Application_Data_Value { @@ -88,6 +90,9 @@ typedef struct BACnet_Application_Data_Value { #if defined (BACAPP_DATETIME) BACNET_DATE_TIME Date_Time; #endif +#if defined (BACAPP_DATERANGE) + BACNET_DATE_RANGE Date_Range; +#endif #if defined (BACAPP_LIGHTING_COMMAND) BACNET_LIGHTING_COMMAND Lighting_Command; #endif @@ -117,6 +122,12 @@ typedef struct BACnet_Application_Data_Value { #endif #if defined (BACAPP_DESTINATION) BACNET_DESTINATION Destination; +#endif +#if defined (BACAPP_CALENDAR_ENTRY) + BACNET_CALENDAR_ENTRY Calendar_Entry; +#endif +#if defined (BACAPP_SPECIAL_EVENT) + BACNET_SPECIAL_EVENT Special_Event; #endif } type; /* simple linked list if needed */ diff --git a/src/bacnet/calendar_entry.c b/src/bacnet/calendar_entry.c new file mode 100644 index 00000000..0c89a0f1 --- /dev/null +++ b/src/bacnet/calendar_entry.c @@ -0,0 +1,363 @@ +/** + * @file + * @brief BACnetCalendarEntry complex data type encode and decode + * @author Ondřej Hruška + * @author Steve Karg + * @date May 2022 + * @section LICENSE + * + * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 + */ +#include +#include "bacnet/calendar_entry.h" +#include "bacnet/bacapp.h" +#include "bacnet/bacdcode.h" +#include "bacnet/bactimevalue.h" +#include "bacnet/datetime.h" +#include "bacnet/basic/sys/days.h" + +/** @file calendar_entry.c Manipulate BACnet calendar entry values */ + +/* + * @brief Encode the BACnetCalendarEntry complex data + * + * BACnetCalendarEntry ::= CHOICE { + * date [0] Date, + * date-range [1] BACnetDateRange, + * weekNDay [2] BACnetWeekNDay + * } + * + * @param apdu Pointer to the buffer for encoding, or NULL for only length + * @param value Pointer to the property data to be encoded. + * @return bytes encoded or zero on error. + */ +int bacnet_calendar_entry_encode(uint8_t *apdu, BACNET_CALENDAR_ENTRY *value) +{ + int len = 0; + int apdu_len = 0; + BACNET_OCTET_STRING octetstring = { 0 }; + + switch (value->tag) { + case BACNET_CALENDAR_DATE: + len = encode_context_date(apdu, value->tag, &value->type.Date); + apdu_len += len; + break; + case BACNET_CALENDAR_DATE_RANGE: + len = bacnet_daterange_context_encode( + apdu, value->tag, &value->type.DateRange); + apdu_len += len; + break; + case BACNET_CALENDAR_WEEK_N_DAY: + octetstring.value[0] = value->type.WeekNDay.month; + octetstring.value[1] = value->type.WeekNDay.weekofmonth; + octetstring.value[2] = value->type.WeekNDay.dayofweek; + octetstring.length = 3; + len = encode_context_octet_string(apdu, value->tag, &octetstring); + apdu_len += len; + break; + default: + /* do nothing */ + break; + } + + return apdu_len; +} + +/** + * @brief Encodes into bytes from the calendar-entry structure + * a context tagged chunk (opening and closing tag) + * @param apdu Pointer to the buffer for encoding, or NULL for only length + * @param tag_number - tag number to encode this chunk + * @param value - calendar entry value to encode + * @return number of bytes encoded, or 0 if unable to encode. + */ +int bacnet_calendar_entry_context_encode( + uint8_t *apdu, uint8_t tag_number, BACNET_CALENDAR_ENTRY *value) +{ + int len = 0; + int apdu_len = 0; + + if (value) { + len = encode_opening_tag(apdu, tag_number); + apdu_len += len; + if (apdu) { + apdu += len; + } + len = bacnet_calendar_entry_encode(apdu, value); + apdu_len += len; + if (apdu) { + apdu += len; + } + len = encode_closing_tag(apdu, tag_number); + apdu_len += len; + } + + return apdu_len; +} + +/** + * @brief Decodes from bytes into the calendar-entry structure + * @param apdu - buffer to hold the bytes + * @param apdu_size - number of bytes in the buffer to decode + * @param entry - calendar entry value to place the decoded values + * @return number of bytes decoded, or BACNET_STATUS_REJECT + */ +int bacnet_calendar_entry_decode( + uint8_t *apdu, uint32_t apdu_size, BACNET_CALENDAR_ENTRY *entry) +{ + int apdu_len = 0; + int len = 0; + BACNET_TAG tag = { 0 }; + BACNET_OCTET_STRING octet_string = { 0 }; + + if (!apdu || !entry) { + return BACNET_STATUS_REJECT; + } + len = bacnet_tag_decode(&apdu[apdu_len], apdu_size - apdu_len, &tag); + if (len <= 0) { + return BACNET_STATUS_REJECT; + } + if (tag.context || tag.opening) { + entry->tag = tag.number; + } else { + return BACNET_STATUS_REJECT; + } + switch (entry->tag) { + case BACNET_CALENDAR_DATE: + len = bacnet_date_context_decode(&apdu[apdu_len], + apdu_size - apdu_len, entry->tag, &entry->type.Date); + if (len <= 0) { + return BACNET_STATUS_REJECT; + } + apdu_len += len; + break; + + case BACNET_CALENDAR_DATE_RANGE: + len = bacnet_daterange_context_decode(&apdu[apdu_len], + apdu_size - apdu_len, entry->tag, &entry->type.DateRange); + if (len <= 0) { + return BACNET_STATUS_REJECT; + } + apdu_len += len; + break; + + case BACNET_CALENDAR_WEEK_N_DAY: + len = bacnet_octet_string_context_decode(&apdu[apdu_len], + apdu_size - apdu_len, entry->tag, &octet_string); + if (len <= 0) { + return BACNET_STATUS_REJECT; + } + apdu_len += len; + /* additional checks for valid Week-n-Day */ + if (octet_string.length != 3) { + return BACNET_STATUS_ERROR; + } + entry->type.WeekNDay.month = octet_string.value[0]; + entry->type.WeekNDay.weekofmonth = octet_string.value[1]; + entry->type.WeekNDay.dayofweek = octet_string.value[2]; + break; + default: + /* none */ + return BACNET_STATUS_REJECT; + } + + return apdu_len; +} + +/** + * @brief Decodes from bytes into the calendar-entry structure + * a context tagged chunk (opening and closing tag) + * @param apdu - buffer to hold the bytes + * @param apdu_size - number of bytes in the buffer to decode + * @param tag_number - tag number to encode this chunk + * @param value - calendar entry value to place the decoded values + * + * @return number of bytes decoded, or BACNET_STATUS_REJECT + */ +int bacnet_calendar_entry_context_decode(uint8_t *apdu, + uint32_t apdu_size, + uint8_t tag_number, + BACNET_CALENDAR_ENTRY *value) +{ + int apdu_len = 0; + int len = 0; + + if (bacnet_is_opening_tag_number( + &apdu[apdu_len], apdu_size - apdu_len, tag_number, &len)) { + apdu_len += len; + } else { + return BACNET_STATUS_REJECT; + } + len = bacnet_calendar_entry_decode( + &apdu[apdu_len], apdu_size - apdu_len, value); + if (len <= 0) { + return BACNET_STATUS_REJECT; + } else { + apdu_len += len; + } + if (bacnet_is_closing_tag_number( + &apdu[apdu_len], apdu_size - apdu_len, tag_number, &len)) { + apdu_len += len; + } else { + return BACNET_STATUS_REJECT; + } + + return apdu_len; +} + +/** + * @brief Compare a month to a BACnetDate value month + * @param date - BACnetDate with a month value to compare + * @param month - month to compare + * @return true if the same month including special values, else false + */ +static bool month_match(BACNET_DATE *date, uint8_t month) +{ + if (month == 0xff) { + return true; + } + if (!date) { + return false; + } + + return ((month == date->month) || + ((month == 13) && (date->month % 2 == 1)) || + ((month == 14) && (date->month % 2 == 0))); +} + +/** + * @brief Compare a week of the month to a BACnetDate value + * @param date - BACnetDate value to compare + * @param weekofmonth - week of the month to compare + * @return true if the same week of the month including special values + */ +static bool weekofmonth_match(BACNET_DATE *date, uint8_t weekofmonth) +{ + bool st = false; + uint8_t day_to_end_month; + + switch (weekofmonth) { + case 1: + case 2: + case 3: + case 4: + case 5: + if (date) { + st = (weekofmonth == (date->day - 1) % 7 + 1); + } + break; + case 6: + case 7: + case 8: + case 9: + if (date) { + day_to_end_month = + days_per_month(date->year, date->month) - date->day; + st = ((weekofmonth - 6) == day_to_end_month % 7); + } + break; + case 0xff: + st = true; + break; + default: + break; + } + + return st; +} + +/** + * @brief Compare a day of the week to a BACnetDate value + * @param date - BACnetDate value to compare + * @param dayofweek - day of the week to compare + * @return true if the same day of the week including special values + */ +static bool dayofweek_match(BACNET_DATE *date, uint8_t dayofweek) +{ + if (dayofweek == 0xff) { + return true; + } + if (!date) { + return false; + } + + return (dayofweek == date->wday); +} + +/** + * @brief Determine if a BACnetCalendarEntry includes a BACnetDate value + * @param date - BACnetDate value to compare + * @param entry - BACnetCalendarEntry value to compare + * @return true if a BACnetCalendarEntry includes the BACnetDate value + */ +bool bacapp_date_in_calendar_entry( + BACNET_DATE *date, BACNET_CALENDAR_ENTRY *entry) +{ + if (!entry) { + return false; + } + switch (entry->tag) { + case BACNET_CALENDAR_DATE: + if (datetime_compare_date(date, &entry->type.Date) == 0) { + return true; + } + break; + case BACNET_CALENDAR_DATE_RANGE: + if ((datetime_compare_date( + &entry->type.DateRange.startdate, date) <= 0) && + (datetime_compare_date(date, &entry->type.DateRange.enddate) <= + 0)) { + return true; + } + break; + case BACNET_CALENDAR_WEEK_N_DAY: + if (month_match(date, entry->type.WeekNDay.month) && + weekofmonth_match(date, entry->type.WeekNDay.weekofmonth) && + dayofweek_match(date, entry->type.WeekNDay.dayofweek)) { + return true; + } + break; + default: + /* do nothing */ + break; + } + + return false; +} + +/** + * @brief Determine if two BACnetCalendarEntry are the same + * @param value1 - BACnetCalendarEntry value to compare + * @param value2 - BACnetCalendarEntry value to compare + * @return true if both BACnetCalendarEntry are the same + */ +bool bacnet_calendar_entry_same( + BACNET_CALENDAR_ENTRY *value1, BACNET_CALENDAR_ENTRY *value2) +{ + if (!value1 || !value2) { + return false; + } + if (value1->tag != value2->tag) { + return false; + } + switch (value1->tag) { + case BACNET_CALENDAR_DATE: + return datetime_compare_date( + &value1->type.Date, &value2->type.Date) == 0; + case BACNET_CALENDAR_DATE_RANGE: + return (datetime_compare_date(&value1->type.DateRange.startdate, + &value2->type.DateRange.startdate) == 0) && + (datetime_compare_date(&value2->type.DateRange.enddate, + &value2->type.DateRange.enddate) == 0); + case BACNET_CALENDAR_WEEK_N_DAY: + return (value1->type.WeekNDay.month == + value2->type.WeekNDay.month) && + (value1->type.WeekNDay.weekofmonth == + value2->type.WeekNDay.weekofmonth) && + (value1->type.WeekNDay.dayofweek == + value2->type.WeekNDay.dayofweek); + default: + /* should be unreachable */ + return false; + } +} diff --git a/src/bacnet/calendar_entry.h b/src/bacnet/calendar_entry.h new file mode 100644 index 00000000..676ebe28 --- /dev/null +++ b/src/bacnet/calendar_entry.h @@ -0,0 +1,78 @@ +/** + * @file + * @brief API for BACnetCalendarEntry complex data type encode and decode + * @author Ondřej Hruška + * @author Steve Karg + * @date August 2023 + * @section LICENSE + * + * SPDX-License-Identifier: MIT + */ +#ifndef BACNET_CALENDAR_ENTRY_H +#define BACNET_CALENDAR_ENTRY_H + +#include +#include +#include "bacnet/bacnet_stack_exports.h" +#include "bacnet/bactimevalue.h" +#include "bacnet/datetime.h" + +/* + BACnetCalendarEntry ::= CHOICE { + date [0] Date, + date-range [1] BACnetDateRange, + weekNDay [2] BACnetWeekNDay + } +*/ + +typedef enum BACnet_CalendarEntry_Tags { + BACNET_CALENDAR_DATE = 0, + BACNET_CALENDAR_DATE_RANGE = 1, + BACNET_CALENDAR_WEEK_N_DAY = 2 +} BACNET_CALENDAR_ENTRY_TAGS; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +typedef struct BACnetCalendarEntry_T { + uint8_t tag; + union { + BACNET_DATE Date; + BACNET_DATE_RANGE DateRange; + BACNET_WEEKNDAY WeekNDay; + } type; + /* simple linked list if needed */ + struct BACnetCalendarEntry_T *next; +} BACNET_CALENDAR_ENTRY; + + +BACNET_STACK_EXPORT +int bacnet_calendar_entry_encode(uint8_t *apdu, BACNET_CALENDAR_ENTRY *value); + +BACNET_STACK_EXPORT +int bacnet_calendar_entry_context_encode( + uint8_t *apdu, uint8_t tag_number, BACNET_CALENDAR_ENTRY *value); + +BACNET_STACK_EXPORT +int bacnet_calendar_entry_decode( + uint8_t *apdu, uint32_t apdu_max_len, BACNET_CALENDAR_ENTRY *entry); + +BACNET_STACK_EXPORT +int bacnet_calendar_entry_context_decode( + uint8_t *apdu, uint32_t apdu_max_len, uint8_t tag_number, + BACNET_CALENDAR_ENTRY *value); + +BACNET_STACK_EXPORT +bool bacapp_date_in_calendar_entry(BACNET_DATE *date, + BACNET_CALENDAR_ENTRY *entry); + +BACNET_STACK_EXPORT +bool bacnet_calendar_entry_same( + BACNET_CALENDAR_ENTRY *value1, BACNET_CALENDAR_ENTRY *value2); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif + diff --git a/src/bacnet/config.h b/src/bacnet/config.h index f41819bb..469f06b7 100644 --- a/src/bacnet/config.h +++ b/src/bacnet/config.h @@ -157,10 +157,13 @@ defined(BACAPP_TIME) || \ defined(BACAPP_OBJECT_ID) || \ defined(BACAPP_DATETIME) || \ + defined(BACAPP_DATERANGE) || \ defined(BACAPP_LIGHTING_COMMAND) || \ defined(BACAPP_XY_COLOR) || \ defined(BACAPP_COLOR_COMMAND) || \ defined(BACAPP_WEEKLY_SCHEDULE) || \ + defined(BACAPP_CALENDAR_ENTRY) || \ + defined(BACAPP_SPECIAL_EVENT) || \ defined(BACAPP_HOST_N_PORT) || \ defined(BACAPP_DEVICE_OBJECT_PROPERTY_REFERENCE) || \ defined(BACAPP_DEVICE_OBJECT_REFERENCE) || \ @@ -194,10 +197,13 @@ #define BACAPP_DOUBLE #define BACAPP_TIMESTAMP #define BACAPP_DATETIME +#define BACAPP_DATERANGE #define BACAPP_LIGHTING_COMMAND #define BACAPP_XY_COLOR #define BACAPP_COLOR_COMMAND #define BACAPP_WEEKLY_SCHEDULE +#define BACAPP_CALENDAR_ENTRY +#define BACAPP_SPECIAL_EVENT #define BACAPP_HOST_N_PORT #define BACAPP_DEVICE_OBJECT_PROPERTY_REFERENCE #define BACAPP_DEVICE_OBJECT_REFERENCE @@ -207,10 +213,13 @@ #if defined(BACAPP_DOUBLE) || \ defined(BACAPP_DATETIME) || \ + defined(BACAPP_DATERANGE) || \ defined(BACAPP_LIGHTING_COMMAND) || \ defined(BACAPP_XY_COLOR) || \ defined(BACAPP_COLOR_COMMAND) || \ defined(BACAPP_WEEKLY_SCHEDULE) || \ + defined(BACAPP_CALENDAR_ENTRY) || \ + defined(BACAPP_SPECIAL_EVENT) || \ defined(BACAPP_HOST_N_PORT) || \ defined(BACAPP_DEVICE_OBJECT_PROPERTY_REFERENCE) || \ defined(BACAPP_DEVICE_OBJECT_REFERENCE) || \ diff --git a/src/bacnet/dailyschedule.c b/src/bacnet/dailyschedule.c index d200c1d4..054d71d3 100644 --- a/src/bacnet/dailyschedule.c +++ b/src/bacnet/dailyschedule.c @@ -36,18 +36,21 @@ License. #include "bacnet/dailyschedule.h" #include "bacnet/bactimevalue.h" -int bacnet_dailyschedule_decode( - uint8_t *apdu, int max_apdu_len, BACNET_DAILY_SCHEDULE *day) +int bacnet_dailyschedule_context_decode(uint8_t *apdu, + int max_apdu_len, + uint8_t tag_number, + BACNET_DAILY_SCHEDULE *day) { unsigned int tv_count = 0; - int retval = bacnet_time_values_context_decode(apdu, max_apdu_len, 0, - &day->Time_Values[0], MAX_DAY_SCHEDULE_VALUES, &tv_count); + int retval = bacnet_time_values_context_decode(apdu, max_apdu_len, + tag_number, &day->Time_Values[0], MAX_DAY_SCHEDULE_VALUES, &tv_count); day->TV_Count = (uint16_t)tv_count; return retval; } -int bacnet_dailyschedule_encode(uint8_t *apdu, BACNET_DAILY_SCHEDULE *day) +int bacnet_dailyschedule_context_encode( + uint8_t *apdu, uint8_t tag_number, BACNET_DAILY_SCHEDULE *day) { return bacnet_time_values_context_encode( - apdu, 0, &day->Time_Values[0], day->TV_Count); + apdu, tag_number, &day->Time_Values[0], day->TV_Count); } diff --git a/src/bacnet/dailyschedule.h b/src/bacnet/dailyschedule.h index 8e7aa26f..e1294253 100644 --- a/src/bacnet/dailyschedule.h +++ b/src/bacnet/dailyschedule.h @@ -51,15 +51,17 @@ extern "C" { /** Decode DailySchedule (sequence of times and values) */ BACNET_STACK_EXPORT - int bacnet_dailyschedule_decode( + int bacnet_dailyschedule_context_decode( uint8_t * apdu, int max_apdu_len, + uint8_t tag_number, BACNET_DAILY_SCHEDULE * day); /** Encode DailySchedule (sequence of times and values) */ BACNET_STACK_EXPORT - int bacnet_dailyschedule_encode( + int bacnet_dailyschedule_context_encode( uint8_t * apdu, + uint8_t tag_number, BACNET_DAILY_SCHEDULE * day); #ifdef __cplusplus diff --git a/src/bacnet/datetime.c b/src/bacnet/datetime.c index a959ac45..e4746aa6 100644 --- a/src/bacnet/datetime.c +++ b/src/bacnet/datetime.c @@ -1,36 +1,15 @@ -/*####COPYRIGHTBEGIN#### - ------------------------------------------- - Copyright (C) 2007 Steve Karg - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to: - The Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307, USA. - - As a special exception, if other files instantiate templates or - use macros or inline functions from this file, or you compile - this file and link it with other works to produce a work based - on this file, this file does not by itself cause the resulting - work to be covered by the GNU General Public License. However - the source code for this file must still be made available in - accordance with section (3) of the GNU General Public License. - - This exception does not invalidate any other reasons why a work - based on this file might be covered by the GNU General Public - License. - ------------------------------------------- -####COPYRIGHTEND####*/ +/** + * @file + * @brief BACnetDate, BACnetTime, BACnetDateTime, BACnetDateRange complex data + * type encode and decode functions + * @author Steve Karg + * @author Greg Shue + * @author Ondřej Hruška + * @date 2012 + * @section LICENSE + * + * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 + */ #include #include #include @@ -1182,12 +1161,161 @@ int bacnet_datetime_context_decode(uint8_t *apdu, return apdu_len; } +/** + * @brief Decodes a context tagged BACnetDateTime value from APDU buffer + * @param apdu - the APDU buffer + * @param tag_number - context tag number to be encoded + * @param value - parameter to store the value after decoding + * @return length of the APDU buffer decoded, or BACNET_STATUS_ERROR + * @deprecated - use bacnet_datetime_context_decode() instead + */ int bacapp_decode_context_datetime( uint8_t *apdu, uint8_t tag_number, BACNET_DATE_TIME *value) { return bacnet_datetime_context_decode(apdu, MAX_APDU, tag_number, value); } +/** + * @brief Encode BACnetDateRange complex data type + * + * BACnetDateRange ::= SEQUENCE { -- see Clause 20.2.12 for restrictions + * start-date Date, + * end-date Date + * } + * + * @param apdu - apdu buffer; NULL to only measure capacity needed + * @param value - value to encode + * @return number of bytes emitted, BACNET_STATUS_ERROR on error + */ +int bacnet_daterange_encode(uint8_t *apdu, BACNET_DATE_RANGE *value) +{ + int len = 0; + int apdu_len = 0; + + len = encode_application_date(apdu, &value->startdate); + if (len < 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + if (apdu) { + apdu += len; + } + + len = encode_application_date(apdu, &value->enddate); + if (len < 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + + return apdu_len; +} + +/** + * @brief Decode BACnetDateRange complex data type + * @param apdu - apdu buffer; NULL to only measure capacity needed + * @param apdu_size - apdu buffer size + * @param value - value to decode + * @return number of bytes emitted, BACNET_STATUS_ERROR on error + */ +int bacnet_daterange_decode( + uint8_t *apdu, uint32_t apdu_size, BACNET_DATE_RANGE *value) +{ + int len = 0; + int apdu_len = 0; + + if (!apdu || !value) { + return BACNET_STATUS_ERROR; + } + len = bacnet_date_application_decode( + &apdu[apdu_len], apdu_size - apdu_len, &value->startdate); + if (len <= 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + len = bacnet_date_application_decode( + &apdu[apdu_len], apdu_size - apdu_len, &value->enddate); + if (len <= 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + + return apdu_len; +} + +/** + * @brief Encode daterange with context tag + * @param apdu - apdu buffer; NULL to only measure capacity needed + * @param tag_number - context tag number + * @param value - value to encode + * @return number of bytes decoded, or BACNET_STATUS_ERROR on error + */ +int bacnet_daterange_context_encode( + uint8_t *apdu, uint8_t tag_number, BACNET_DATE_RANGE *value) +{ + int len = 0; + int apdu_len = 0; + + if (value) { + len = encode_opening_tag(apdu, tag_number); + apdu_len += len; + if (apdu) { + apdu += len; + } + len = bacnet_daterange_encode(apdu, value); + if (len <= 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + if (apdu) { + apdu += len; + } + len = encode_closing_tag(apdu, tag_number); + apdu_len += len; + } + + return apdu_len; +} + +/** + * @brief Decode BACnetDateRange complex data with context tag + * @param apdu - apdu buffer to decode + * @param apdu_size - apdu buffer size + * @param tag_number - context tag number + * @param value - value to encode + * @return number of bytes decoded, BACNET_STATUS_ERROR on error + */ +int bacnet_daterange_context_decode(uint8_t *apdu, + uint32_t apdu_size, + uint8_t tag_number, + BACNET_DATE_RANGE *value) +{ + int apdu_len = 0; + int len = 0; + + if (!apdu || !value) { + return -1; + } + if (bacnet_is_opening_tag_number( + &apdu[apdu_len], apdu_size - apdu_len, tag_number, &len)) { + apdu_len += len; + } else { + return BACNET_STATUS_ERROR; + } + len = bacnet_daterange_decode(&apdu[apdu_len], apdu_size - apdu_len, value); + if (len <= 0) { + return BACNET_STATUS_ERROR; + } else { + apdu_len += len; + } + if (bacnet_is_closing_tag_number( + &apdu[apdu_len], apdu_size - apdu_len, tag_number, &len)) { + apdu_len += len; + } else { + return BACNET_STATUS_ERROR; + } + return apdu_len; +} + /** * @brief Parse an ascii string for the date 2021/12/31 or 2021/12/31:1 * @param bdate - #BACNET_DATE structure diff --git a/src/bacnet/datetime.h b/src/bacnet/datetime.h index 1d89aa4e..c6c2989f 100644 --- a/src/bacnet/datetime.h +++ b/src/bacnet/datetime.h @@ -1,28 +1,17 @@ -/************************************************************************** +/** + * @file + * @brief API for BACnetDate, BACnetTime, BACnetDateTime, BACnetDateRange + * complex data type encode and decode + * @author Steve Karg + * @author Greg Shue + * @author Ondřej Hruška + * @date 2012 + * @section LICENSE * - * Copyright (C) 2012 Steve Karg - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *********************************************************************/ -#ifndef DATE_TIME_H -#define DATE_TIME_H + * SPDX-License-Identifier: MIT + */ +#ifndef BACNET_DATE_TIME_H +#define BACNET_DATE_TIME_H #include #include @@ -288,6 +277,21 @@ int bacapp_decode_context_datetime(uint8_t *apdu, uint8_t tag_number, BACNET_DATE_TIME *value); +BACNET_STACK_EXPORT +int bacnet_daterange_encode(uint8_t *apdu, BACNET_DATE_RANGE *value); +BACNET_STACK_EXPORT +int bacnet_daterange_decode(uint8_t *apdu, + uint32_t apdu_size, + BACNET_DATE_RANGE *value); +BACNET_STACK_EXPORT +int bacnet_daterange_context_encode( + uint8_t *apdu, uint8_t tag_number, BACNET_DATE_RANGE *value); +BACNET_STACK_EXPORT +int bacnet_daterange_context_decode(uint8_t *apdu, + uint32_t apdu_size, + uint8_t tag_number, + BACNET_DATE_RANGE *value); + /* implementation agnostic functions - create your own! */ BACNET_STACK_EXPORT bool datetime_local(BACNET_DATE *bdate, @@ -300,4 +304,4 @@ void datetime_init(void); #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* DATE_TIME_H */ +#endif diff --git a/src/bacnet/special_event.c b/src/bacnet/special_event.c new file mode 100644 index 00000000..4e7ec736 --- /dev/null +++ b/src/bacnet/special_event.c @@ -0,0 +1,266 @@ +/** + * @file + * @brief BACnetSpecialEvent complex data type encode and decode + * @author Ondřej Hruška + * @author Steve Karg + * @date May 2022 + * @section LICENSE + * + * SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0 + */ + +#include +#include "bacnet/special_event.h" +#include "bacnet/bacdcode.h" +#include "bacapp.h" + +/** + * @brief Decode a BACnetSpecialEvent complex data type + * + * BACnetSpecialEvent ::= SEQUENCE { + * period CHOICE { + * calendar-entry [0] BACnetCalendarEntry, + * calendar-reference [1] BACnetObjectIdentifier + * }, + * list-of-time-values [2] SEQUENCE OF BACnetTimeValue, + * event-priority [3] Unsigned (1..16) + * } + * + * @param apdu - the APDU buffer + * @param apdu_size - the size of the APDU buffer + * @param value - BACnetSpecialEvent structure + * @return length of the APDU buffer, or BACNET_STATUS_ERROR if unable to decode + */ +int bacnet_special_event_decode( + uint8_t *apdu, int apdu_size, BACNET_SPECIAL_EVENT *value) +{ + int len = 0; + int apdu_len = 0; + BACNET_UNSIGNED_INTEGER priority = 0; + BACNET_TAG tag = { 0 }; + + if (!apdu || !value) { + return BACNET_STATUS_ERROR; + } + len = bacnet_tag_decode(&apdu[apdu_len], apdu_size - apdu_len, &tag); + if (len <= 0) { + return BACNET_STATUS_ERROR; + } + if (tag.opening && + (tag.number == BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY)) { + value->periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY; + len = bacnet_calendar_entry_context_decode(&apdu[apdu_len], + apdu_size - apdu_len, BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY, + &value->period.calendarEntry); + if (len < 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + } else if (tag.context && + (tag.number == BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_REFERENCE)) { + value->periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_REFERENCE; + len = bacnet_object_id_context_decode(&apdu[apdu_len], + apdu_size - apdu_len, + BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_REFERENCE, + &value->period.calendarReference.type, + &value->period.calendarReference.instance); + if (len < 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + } else { + return BACNET_STATUS_ERROR; + } + /* Values [2] */ + len = bacnet_dailyschedule_context_decode( + &apdu[apdu_len], apdu_size - apdu_len, 2, &value->timeValues); + if (len < 0) { + return BACNET_STATUS_ERROR; + } + apdu_len += len; + + /* Priority [3] */ + len = bacnet_unsigned_context_decode( + &apdu[apdu_len], apdu_size - apdu_len, 3, &priority); + if (len < 0) { + return BACNET_STATUS_ERROR; + } + if (priority > BACNET_MAX_PRIORITY) { + return BACNET_STATUS_ERROR; + } + value->priority = (uint8_t)priority; + apdu_len += len; + + return apdu_len; +} + +/** + * @brief Encode a BACnetSpecialEvent complex data type + * @param apdu - the APDU buffer (NULL to determine the length) + * @param value - BACnetSpecialEvent structure + * @return length of the APDU buffer, or 0 if not able to encode + */ +int bacnet_special_event_encode(uint8_t *apdu, BACNET_SPECIAL_EVENT *value) +{ + int apdu_len = 0; + int len; + + if (value->periodTag == BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY) { + len = bacnet_calendar_entry_context_encode(apdu, + BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY, + &value->period.calendarEntry); + if (len < 0) { + return -1; + } + apdu_len += len; + if (apdu) { + apdu += len; + } + } else { + len = encode_context_object_id(apdu, + BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_REFERENCE, + value->period.calendarReference.type, + value->period.calendarReference.instance); + if (len < 0) { + return -1; + } + apdu_len += len; + if (apdu) { + apdu += len; + } + } + + len = bacnet_dailyschedule_context_encode(apdu, 2, &value->timeValues); + if (len < 0) { + return -1; + } + apdu_len += len; + if (apdu) { + apdu += len; + } + + len = encode_context_unsigned(apdu, 3, value->priority); + if (len < 0) { + return -1; + } + apdu_len += len; + + return apdu_len; +} + +/** + * @brief Encode a context tagged BACnetSpecialEvent complex data type + * @param apdu - the APDU buffer (NULL to determine the length) + * @param tag_number - tag number to context encode + * @param value - BACnetSpecialEvent structure + * @return length of the APDU buffer, or 0 if not able to encode + */ +int bacnet_special_event_context_encode( + uint8_t *apdu, uint8_t tag_number, BACNET_SPECIAL_EVENT *value) +{ + int len = 0; + int apdu_len = 0; + + if (value) { + len = encode_opening_tag(apdu, tag_number); + apdu_len += len; + if (apdu) { + apdu += len; + } + len = bacnet_special_event_encode(apdu, value); + apdu_len += len; + if (apdu) { + apdu += len; + } + len = encode_closing_tag(apdu, tag_number); + apdu_len += len; + } + + return apdu_len; +} + +/** + * @brief Decode a context tagged BACnetSpecialEvent complex data type + * @param apdu - the APDU buffer + * @param apdu_size - the size of the APDU buffer + * @param tag_number - tag number to context decode + * @param value - BACnetSpecialEvent structure + * @return length of the APDU buffer, or BACNET_STATUS_ERROR if unable to decode + */ +int bacnet_special_event_context_decode(uint8_t *apdu, + int apdu_size, + uint8_t tag_number, + BACNET_SPECIAL_EVENT *value) +{ + int apdu_len = 0; + int len = 0; + + if (bacnet_is_opening_tag_number( + &apdu[apdu_len], apdu_size - apdu_len, tag_number, &len)) { + apdu_len += len; + } else { + return BACNET_STATUS_ERROR; + } + len = bacnet_special_event_decode( + &apdu[apdu_len], apdu_size - apdu_len, value); + if (len < 0) { + return BACNET_STATUS_ERROR; + } else { + apdu_len += len; + } + if (bacnet_is_closing_tag_number( + &apdu[apdu_len], apdu_size - apdu_len, tag_number, &len)) { + apdu_len += len; + } else { + return BACNET_STATUS_ERROR; + } + + return apdu_len; +} + +/** + * @brief Compare the BACnetSpecialEvent complex data + * @param value1 - BACNET_SPECIAL_EVENT structure + * @param value2 - BACNET_SPECIAL_EVENT structure + * @return true if the same + */ +bool bacnet_special_event_same( + BACNET_SPECIAL_EVENT *value1, BACNET_SPECIAL_EVENT *value2) +{ + BACNET_APPLICATION_DATA_VALUE adv1, adv2; + BACNET_TIME_VALUE *tv1, *tv2; + int ti; + + if (value1->periodTag != value2->periodTag || + value1->priority != value2->priority) { + return false; + } + + if (value1->periodTag == BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY) { + if (!bacnet_calendar_entry_same( + &value1->period.calendarEntry, &value2->period.calendarEntry)) { + return false; + } + } + + /* TODO extract shared code with `bacnet_weeklyschedule_same` */ + if (value1->timeValues.TV_Count != value2->timeValues.TV_Count) { + return false; + } + for (ti = 0; ti < value1->timeValues.TV_Count; ti++) { + tv1 = &value1->timeValues.Time_Values[ti]; + tv2 = &value2->timeValues.Time_Values[ti]; + if (0 != datetime_compare_time(&tv1->Time, &tv2->Time)) { + return false; + } + + bacnet_primitive_to_application_data_value(&adv1, &tv1->Value); + bacnet_primitive_to_application_data_value(&adv2, &tv2->Value); + + if (!bacapp_same_value(&adv1, &adv2)) { + return false; + } + } + + return true; +} diff --git a/src/bacnet/special_event.h b/src/bacnet/special_event.h new file mode 100644 index 00000000..245deefb --- /dev/null +++ b/src/bacnet/special_event.h @@ -0,0 +1,71 @@ +/** + * @file + * @brief API for BACnetSpecialEvent complex data type encode and decode + * @author Ondřej Hruška + * @author Steve Karg + * @date August 2023 + * @section LICENSE + * + * SPDX-License-Identifier: MIT + */ +#ifndef BACNET_SPECIAL_EVENT_H +#define BACNET_SPECIAL_EVENT_H + +#include +#include +#include "bacnet/bacnet_stack_exports.h" +#include "bacnet/bactimevalue.h" +#include "bacnet/calendar_entry.h" +#include "bacnet/dailyschedule.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + typedef enum BACnet_SpecialEventPeriod_Tags { + BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY = 0, + BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_REFERENCE = 1 + } BACNET_SPECIAL_EVENT_PERIOD_TAG; + + typedef struct BACnet_Special_Event { + BACNET_SPECIAL_EVENT_PERIOD_TAG periodTag; + union { + BACNET_CALENDAR_ENTRY calendarEntry; + BACNET_OBJECT_ID calendarReference; + } period; + /* We reuse the daily schedule struct and its encoding/decoding - it's identical */ + BACNET_DAILY_SCHEDULE timeValues; + uint8_t priority; + } BACNET_SPECIAL_EVENT; + + /** Decode Special Event */ + BACNET_STACK_EXPORT + int bacnet_special_event_decode( + uint8_t * apdu, + int max_apdu_len, + BACNET_SPECIAL_EVENT * value); + + /** Encode Special Event */ + BACNET_STACK_EXPORT + int bacnet_special_event_encode( + uint8_t * apdu, + BACNET_SPECIAL_EVENT * value); + + BACNET_STACK_EXPORT + int bacnet_special_event_context_encode( + uint8_t *apdu, uint8_t tag_number, BACNET_SPECIAL_EVENT *value); + + BACNET_STACK_EXPORT + int bacnet_special_event_context_decode( + uint8_t *apdu, int max_apdu_len, uint8_t tag_number, + BACNET_SPECIAL_EVENT *value); + + BACNET_STACK_EXPORT + bool bacnet_special_event_same( + BACNET_SPECIAL_EVENT *value1, BACNET_SPECIAL_EVENT *value2); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif /* BACNET_SPECIAL_EVENT_H */ diff --git a/src/bacnet/weeklyschedule.c b/src/bacnet/weeklyschedule.c index a6f6e58e..01b469aa 100644 --- a/src/bacnet/weeklyschedule.c +++ b/src/bacnet/weeklyschedule.c @@ -59,8 +59,8 @@ int bacnet_weeklyschedule_decode( } value->singleDay = false; for (wi = 0; wi < 7; wi++) { - len = bacnet_dailyschedule_decode(&apdu[apdu_len], - max_apdu_len - apdu_len, &value->weeklySchedule[wi]); + len = bacnet_dailyschedule_context_decode(&apdu[apdu_len], + max_apdu_len - apdu_len, 0, &value->weeklySchedule[wi]); if (len < 0) { if (wi == 1) { value->singleDay = true; @@ -96,8 +96,8 @@ int bacnet_weeklyschedule_encode(uint8_t *apdu, BACNET_WEEKLY_SCHEDULE *value) if (apdu) { apdu_offset = &apdu[apdu_len]; } - len = bacnet_dailyschedule_encode( - apdu_offset, &value->weeklySchedule[wi]); + len = bacnet_dailyschedule_context_encode( + apdu_offset, 0, &value->weeklySchedule[wi]); if (len < 0) { return BACNET_STATUS_ERROR; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 022ea581..5d4de053 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,6 +21,7 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU") add_compile_options(-Wno-sign-conversion -Wno-conversion) add_compile_options(-Wno-sign-compare -Wno-long-long) add_compile_options(-Wno-implicit-fallthrough -Wno-attributes) + add_compile_options(-Wno-missing-braces) # ignore some warnings that occur during unit testing add_compile_options(-Wno-unused-variable -Wno-unused-function) add_compile_options(-Wno-unused-parameter) @@ -87,6 +88,7 @@ list(APPEND testdirs bacnet/reject bacnet/rp bacnet/rpm + bacnet/specialevent bacnet/timestamp bacnet/timesync bacnet/whohas diff --git a/test/bacnet/bacapp/CMakeLists.txt b/test/bacnet/bacapp/CMakeLists.txt index 6244aae0..beca62ad 100644 --- a/test/bacnet/bacapp/CMakeLists.txt +++ b/test/bacnet/bacapp/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/bacdcode/CMakeLists.txt b/test/bacnet/bacdcode/CMakeLists.txt index 6c2cf60a..8e16b3d2 100644 --- a/test/bacnet/bacdcode/CMakeLists.txt +++ b/test/bacnet/bacdcode/CMakeLists.txt @@ -38,6 +38,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/bacint.c ${SRC_DIR}/bacnet/bacreal.c ${SRC_DIR}/bacnet/bacstr.c + ${SRC_DIR}/bacnet/datetime.c + ${SRC_DIR}/bacnet/basic/sys/days.c ${SRC_DIR}/bacnet/basic/sys/bigend.c # Test and test library files ./src/main.c diff --git a/test/bacnet/bacdcode/src/main.c b/test/bacnet/bacdcode/src/main.c index 2cdfe751..22add4ee 100644 --- a/test/bacnet/bacdcode/src/main.c +++ b/test/bacnet/bacdcode/src/main.c @@ -7,10 +7,11 @@ /* @file * @brief test BACnet integer encode/decode APIs */ - +#include #include /* For isprint */ #include #include +#include /** * @addtogroup bacnet_tests @@ -301,7 +302,7 @@ static void testBACDCodeReal(void) #if defined(BACNET_STACK_DEPRECATED_DISABLE) encode_bacnet_real(value, &real_apdu[0]); decode_real(&real_apdu[0], &decoded_value); - zassert_equal(decoded_value, value, NULL); + zassert_false(islessgreater(decoded_value, value), NULL); encode_bacnet_real(value, &encoded_apdu[0]); zassert_equal( memcmp(&real_apdu, &encoded_apdu, sizeof(real_apdu)), 0, NULL); @@ -320,7 +321,7 @@ static void testBACDCodeReal(void) zassert_equal(len, 1, NULL); zassert_equal(long_value, 4, NULL); decode_real(&apdu[len], &decoded_value); - zassert_equal(decoded_value, value, NULL); + zassert_false(islessgreater(decoded_value, value), NULL); #endif null_len = bacnet_real_application_decode(apdu, apdu_len, NULL); zassert_equal(apdu_len, null_len, NULL); @@ -331,7 +332,7 @@ static void testBACDCodeReal(void) zassert_equal(tag.number, BACNET_APPLICATION_TAG_REAL, NULL); zassert_true(tag.application, NULL); zassert_false(tag.context, NULL); - zassert_equal(decoded_value, value, NULL); + zassert_false(islessgreater(decoded_value, value), NULL); while (apdu_len) { apdu_len--; len = bacnet_real_application_decode(apdu, apdu_len, NULL); @@ -358,7 +359,7 @@ static void testBACDCodeDouble(void) #if defined(BACNET_STACK_DEPRECATED_DISABLE) encode_bacnet_double(value, &double_apdu[0]); decode_double(&double_apdu[0], &decoded_value); - zassert_equal(decoded_value, value, NULL); + zassert_false(islessgreater(decoded_value, value), NULL); encode_bacnet_double(value, &encoded_apdu[0]); zassert_equal( memcmp(&double_apdu, &encoded_apdu, sizeof(double_apdu)), 0, NULL); @@ -390,7 +391,7 @@ static void testBACDCodeDouble(void) zassert_false(tag.context, NULL); zassert_false(tag.closing, NULL); zassert_false(tag.opening, NULL); - zassert_equal(decoded_value, value, NULL); + zassert_false(islessgreater(decoded_value, value), NULL); while (apdu_len) { apdu_len--; len = bacnet_double_application_decode(apdu, apdu_len, NULL); @@ -400,6 +401,107 @@ static void testBACDCodeDouble(void) return; } +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(bacdcode_tests, testBACnetDateDecodes) +#else +static void testBACnetDateDecodes(void) +#endif +{ + uint8_t apdu[MAX_APDU]; + uint8_t sample[10] = { 0xa4, 0xff, 0xff, 0xff, 0xff }; + int inLen; + int outLen; + int outLen2; + + BACNET_DATE in; + BACNET_DATE out; + + in.day = 3; + in.month = 10; + in.wday = 5; + in.year = 1945; + + inLen = encode_application_date(apdu, &in); + outLen = decode_application_date(apdu, &out); + + zassert_equal(inLen, outLen, NULL); + zassert_equal(in.day, out.day, NULL); + zassert_equal(in.month, out.month, NULL); + zassert_equal(in.wday, out.wday, NULL); + zassert_equal(in.year, out.year, NULL); + + memset(&out, 0, sizeof(out)); + outLen = decode_application_date(sample, &out); + + /* try decoding sample data captured from a bacnet device - all wildcards */ + zassert_equal(5, outLen, NULL); + zassert_equal(0xff, out.day, NULL); + zassert_equal(0xff, out.month, NULL); + zassert_equal(0xff, out.wday, NULL); + zassert_equal(2155, out.year, NULL); +} + +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(bacdcode_tests, testBACnetDateRangeDecodes) +#else +static void testBACnetDateRangeDecodes(void) +#endif +{ + uint8_t apdu[MAX_APDU]; + uint8_t sample[10] = { 0xa4, 0xff, 0xff, 0xff, 0xff, 0xa4, 0xff, 0xff, 0xff, + 0xff }; + int len; + int null_len; + int test_len; + int outLen2; + + BACNET_DATE_RANGE data; + BACNET_DATE_RANGE test_data; + + memset(&test_data, 0, sizeof(test_data)); + + data.startdate.day = 3; + data.startdate.month = 10; + data.startdate.wday = 5; + data.startdate.year = 1945; + + data.enddate.day = 24; + data.enddate.month = 8; + data.enddate.wday = 4; + data.enddate.year = 2023; + + len = bacnet_daterange_encode(apdu, &data); + null_len = bacnet_daterange_encode(NULL, &data); + zassert_equal(len, null_len, NULL); + + test_len = bacnet_daterange_decode(apdu, len, &test_data); + zassert_equal(len, test_len, NULL); + zassert_equal(data.startdate.day, test_data.startdate.day, NULL); + zassert_equal(data.startdate.month, test_data.startdate.month, NULL); + zassert_equal(data.startdate.wday, test_data.startdate.wday, NULL); + zassert_equal(data.startdate.year, test_data.startdate.year, NULL); + + zassert_equal(data.enddate.day, test_data.enddate.day, NULL); + zassert_equal(data.enddate.month, test_data.enddate.month, NULL); + zassert_equal(data.enddate.wday, test_data.enddate.wday, NULL); + zassert_equal(data.enddate.year, test_data.enddate.year, NULL); + + memset(&test_data, 0, sizeof(test_data)); + test_len = bacnet_daterange_decode(sample, len, &test_data); + + /* try decoding sample data captured from a bacnet device - all wildcards */ + zassert_equal(10, test_len, NULL); + zassert_equal(0xff, test_data.startdate.day, NULL); + zassert_equal(0xff, test_data.startdate.month, NULL); + zassert_equal(0xff, test_data.startdate.wday, NULL); + zassert_equal(2155, test_data.startdate.year, NULL); + + zassert_equal(0xff, test_data.enddate.day, NULL); + zassert_equal(0xff, test_data.enddate.month, NULL); + zassert_equal(0xff, test_data.enddate.wday, NULL); + zassert_equal(2155, test_data.enddate.year, NULL); +} + static void verifyBACDCodeUnsignedValue(BACNET_UNSIGNED_INTEGER value) { uint8_t array[5] = { 0 }; @@ -413,7 +515,7 @@ static void verifyBACDCodeUnsignedValue(BACNET_UNSIGNED_INTEGER value) len_value = encode_application_unsigned(&array[0], value); len = decode_tag_number_and_value(&array[0], &tag_number, &len_value); len = decode_unsigned(&array[len], len_value, &decoded_value); - zassert_equal(decoded_value, value, "value=%lu decoded_value=%lu\n", + zassert_equal(decoded_value, value, "value=%lu decoded_value=%lu\n", (unsigned long)value, (unsigned long)decoded_value); encode_application_unsigned(&encoded_array[0], decoded_value); zassert_equal(memcmp(&array[0], &encoded_array[0], sizeof(array)), 0, NULL); @@ -1155,7 +1257,7 @@ static void testFloatContextDecodes(void) outLen2 = bacnet_real_context_decode(apdu, inLen, 9, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); zassert_equal(outLen2, 0, NULL); inLen = encode_context_real(apdu, large_context_tag, in); @@ -1164,7 +1266,7 @@ static void testFloatContextDecodes(void) bacnet_real_context_decode(apdu, inLen, large_context_tag - 1, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); zassert_equal(outLen2, 0, NULL); in = 0.0f; @@ -1173,7 +1275,7 @@ static void testFloatContextDecodes(void) outLen2 = bacnet_real_context_decode(apdu, inLen, 9, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); inLen = encode_context_real(apdu, large_context_tag, in); outLen = bacnet_real_context_decode(apdu, inLen, large_context_tag, &out); @@ -1181,7 +1283,7 @@ static void testFloatContextDecodes(void) bacnet_real_context_decode(apdu, inLen, large_context_tag - 1, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); zassert_equal(outLen2, 0, NULL); while (inLen) { inLen--; @@ -1212,7 +1314,7 @@ static void testDoubleContextDecodes(void) outLen = bacnet_double_context_decode(apdu, inLen, 10, &out); outLen2 = bacnet_double_context_decode(apdu, inLen, 9, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); zassert_equal(outLen2, 0, NULL); inLen = encode_context_double(apdu, large_context_tag, in); @@ -1220,7 +1322,7 @@ static void testDoubleContextDecodes(void) outLen2 = bacnet_double_context_decode(apdu, inLen, large_context_tag - 1, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); zassert_equal(outLen2, 0, NULL); in = 0.0; @@ -1228,7 +1330,7 @@ static void testDoubleContextDecodes(void) outLen = bacnet_double_context_decode(apdu, inLen, 10, &out); outLen2 = bacnet_double_context_decode(apdu, inLen, 9, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); zassert_equal(outLen2, 0, NULL); inLen = encode_context_double(apdu, large_context_tag, in); @@ -1236,7 +1338,7 @@ static void testDoubleContextDecodes(void) outLen2 = bacnet_double_context_decode(apdu, inLen, large_context_tag - 1, &out); zassert_equal(inLen, outLen, NULL); - zassert_equal(in, out, NULL); + zassert_false(islessgreater(in, out), NULL); zassert_equal(outLen2, 0, NULL); while (inLen) { inLen--; @@ -1517,15 +1619,16 @@ static void testDateContextDecodes(void) /* Test large tags */ inLen = encode_context_date(apdu, large_context_tag, &in); outLen = bacnet_date_context_decode(apdu, inLen, large_context_tag, &out); - outLen2 = - bacnet_date_context_decode(apdu, inLen, large_context_tag - 1, &out); - zassert_equal(inLen, outLen, NULL); zassert_equal(in.day, out.day, NULL); zassert_equal(in.month, out.month, NULL); zassert_equal(in.wday, out.wday, NULL); zassert_equal(in.year, out.year, NULL); - + /* incorrect tag */ + outLen2 = + bacnet_date_context_decode(apdu, inLen, large_context_tag - 1, &out); + zassert_equal(outLen2, 0, NULL); + /* short APDU */ while (inLen) { inLen--; outLen2 = @@ -1534,6 +1637,50 @@ static void testDateContextDecodes(void) } } +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(bacdcode_tests, testDateRangeContextDecodes) +#else +static void testDateRangeContextDecodes(void) +#endif +{ + uint8_t apdu[MAX_APDU]; + int len; + int null_len; + int test_len; + + BACNET_DATE_RANGE data; + BACNET_DATE_RANGE test_data; + memset(&data, 0, sizeof(data)); + memset(&test_data, 0, sizeof(test_data)); + + data.startdate.day = 3; + data.startdate.month = 10; + data.startdate.wday = 5; + data.startdate.year = 1945; + + data.enddate.day = 24; + data.enddate.month = 8; + data.enddate.wday = 4; + data.enddate.year = 2023; + + len = bacnet_daterange_context_encode(apdu, 10, &data); + null_len = bacnet_daterange_context_encode(NULL, 10, &data); + zassert_equal(len, null_len, NULL); + test_len = bacnet_daterange_context_decode(apdu, len, 10, &test_data); + zassert_equal(len, test_len, NULL); + zassert_equal(data.startdate.day, test_data.startdate.day, NULL); + zassert_equal(data.startdate.month, test_data.startdate.month, NULL); + zassert_equal(data.startdate.wday, test_data.startdate.wday, NULL); + zassert_equal(data.startdate.year, test_data.startdate.year, NULL); + zassert_equal(data.enddate.day, test_data.enddate.day, NULL); + zassert_equal(data.enddate.month, test_data.enddate.month, NULL); + zassert_equal(data.enddate.wday, test_data.enddate.wday, NULL); + zassert_equal(data.enddate.year, test_data.enddate.year, NULL); + /* incorrect tag number */ + test_len = bacnet_daterange_context_decode(apdu, len, 9, &test_data); + zassert_equal(test_len, BACNET_STATUS_ERROR, NULL); +} + /** * @brief Encode a BACnetARRAY property element; a function template * @param object_instance [in] BACnet network port object instance number @@ -1629,6 +1776,8 @@ void test_main(void) ztest_unit_test(testBACDCodeUnsigned), ztest_unit_test(testBACnetUnsigned), ztest_unit_test(testBACDCodeSigned), ztest_unit_test(testBACnetSigned), + ztest_unit_test(testBACnetDateDecodes), + ztest_unit_test(testBACnetDateRangeDecodes), ztest_unit_test(testBACDCodeEnumerated), ztest_unit_test(testBACDCodeOctetString), ztest_unit_test(testBACDCodeCharacterString), @@ -1645,6 +1794,7 @@ void test_main(void) ztest_unit_test(testBitStringContextDecodes), ztest_unit_test(testTimeContextDecodes), ztest_unit_test(testDateContextDecodes), + ztest_unit_test(testDateRangeContextDecodes), ztest_unit_test(testOctetStringContextDecodes), ztest_unit_test(testBACDCodeDouble), ztest_unit_test(test_bacnet_array_encode)); diff --git a/test/bacnet/bacdest/CMakeLists.txt b/test/bacnet/bacdest/CMakeLists.txt index ad8b3af2..02a0d97e 100644 --- a/test/bacnet/bacdest/CMakeLists.txt +++ b/test/bacnet/bacdest/CMakeLists.txt @@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/bacdevobjpropref/CMakeLists.txt b/test/bacnet/bacdevobjpropref/CMakeLists.txt index 3f27421e..7dd2967d 100644 --- a/test/bacnet/bacdevobjpropref/CMakeLists.txt +++ b/test/bacnet/bacdevobjpropref/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/bacreal/src/main.c b/test/bacnet/bacreal/src/main.c index 50f1ab7f..09bddd3a 100644 --- a/test/bacnet/bacreal/src/main.c +++ b/test/bacnet/bacreal/src/main.c @@ -7,7 +7,7 @@ /* @file * @brief test BACnet real value encode/decode APIs */ - +#include #include #include #include @@ -34,7 +34,7 @@ static void testBACreal(void) zassert_equal(len, 4, NULL); test_len = decode_real(&apdu[0], &test_real_value); zassert_equal(test_len, len, NULL); - zassert_equal(test_real_value, real_value, NULL); + zassert_false(islessgreater(test_real_value, real_value), NULL); } /** @@ -54,7 +54,7 @@ static void testBACdouble(void) zassert_equal(len, 8, NULL); test_len = decode_double(&apdu[0], &test_double_value); zassert_equal(test_len, len, NULL); - zassert_equal(test_double_value, double_value, NULL); + zassert_false(islessgreater(test_double_value, double_value), NULL); } /** * @} diff --git a/test/bacnet/bactimevalue/CMakeLists.txt b/test/bacnet/bactimevalue/CMakeLists.txt index 3d885daf..d57b95f2 100644 --- a/test/bacnet/bactimevalue/CMakeLists.txt +++ b/test/bacnet/bactimevalue/CMakeLists.txt @@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/timestamp.c ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/binding/address/CMakeLists.txt b/test/bacnet/basic/binding/address/CMakeLists.txt index fefe1e7d..69ffce35 100644 --- a/test/bacnet/basic/binding/address/CMakeLists.txt +++ b/test/bacnet/basic/binding/address/CMakeLists.txt @@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/acc/CMakeLists.txt b/test/bacnet/basic/object/acc/CMakeLists.txt index 5cd996e7..aa386873 100644 --- a/test/bacnet/basic/object/acc/CMakeLists.txt +++ b/test/bacnet/basic/object/acc/CMakeLists.txt @@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/access_credential/CMakeLists.txt b/test/bacnet/basic/object/access_credential/CMakeLists.txt index 512a2921..fc0fc72c 100644 --- a/test/bacnet/basic/object/access_credential/CMakeLists.txt +++ b/test/bacnet/basic/object/access_credential/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/access_door/CMakeLists.txt b/test/bacnet/basic/object/access_door/CMakeLists.txt index 6fcb65d5..37682f26 100644 --- a/test/bacnet/basic/object/access_door/CMakeLists.txt +++ b/test/bacnet/basic/object/access_door/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/access_point/CMakeLists.txt b/test/bacnet/basic/object/access_point/CMakeLists.txt index acf201a4..d26a3c26 100644 --- a/test/bacnet/basic/object/access_point/CMakeLists.txt +++ b/test/bacnet/basic/object/access_point/CMakeLists.txt @@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/access_rights/CMakeLists.txt b/test/bacnet/basic/object/access_rights/CMakeLists.txt index 326ee99d..bf8c3b51 100644 --- a/test/bacnet/basic/object/access_rights/CMakeLists.txt +++ b/test/bacnet/basic/object/access_rights/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/access_user/CMakeLists.txt b/test/bacnet/basic/object/access_user/CMakeLists.txt index ca90257f..1cfa0724 100644 --- a/test/bacnet/basic/object/access_user/CMakeLists.txt +++ b/test/bacnet/basic/object/access_user/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/access_zone/CMakeLists.txt b/test/bacnet/basic/object/access_zone/CMakeLists.txt index d72d98a3..bb3e9f11 100644 --- a/test/bacnet/basic/object/access_zone/CMakeLists.txt +++ b/test/bacnet/basic/object/access_zone/CMakeLists.txt @@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/ai/CMakeLists.txt b/test/bacnet/basic/object/ai/CMakeLists.txt index e4689519..d343cddc 100644 --- a/test/bacnet/basic/object/ai/CMakeLists.txt +++ b/test/bacnet/basic/object/ai/CMakeLists.txt @@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/ao/CMakeLists.txt b/test/bacnet/basic/object/ao/CMakeLists.txt index 46fadcd8..501052b5 100644 --- a/test/bacnet/basic/object/ao/CMakeLists.txt +++ b/test/bacnet/basic/object/ao/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/av/CMakeLists.txt b/test/bacnet/basic/object/av/CMakeLists.txt index a5c8ba19..df2169fc 100644 --- a/test/bacnet/basic/object/av/CMakeLists.txt +++ b/test/bacnet/basic/object/av/CMakeLists.txt @@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/bacfile/CMakeLists.txt b/test/bacnet/basic/object/bacfile/CMakeLists.txt index 4a3126f1..c7dc39e3 100644 --- a/test/bacnet/basic/object/bacfile/CMakeLists.txt +++ b/test/bacnet/basic/object/bacfile/CMakeLists.txt @@ -60,6 +60,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/apdu_mock.c diff --git a/test/bacnet/basic/object/bi/CMakeLists.txt b/test/bacnet/basic/object/bi/CMakeLists.txt index 7ff88570..51e5a491 100644 --- a/test/bacnet/basic/object/bi/CMakeLists.txt +++ b/test/bacnet/basic/object/bi/CMakeLists.txt @@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/blo/CMakeLists.txt b/test/bacnet/basic/object/blo/CMakeLists.txt index 011d28a2..b5490d64 100644 --- a/test/bacnet/basic/object/blo/CMakeLists.txt +++ b/test/bacnet/basic/object/blo/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/bo/CMakeLists.txt b/test/bacnet/basic/object/bo/CMakeLists.txt index 9bf65a78..8aaa6d7b 100644 --- a/test/bacnet/basic/object/bo/CMakeLists.txt +++ b/test/bacnet/basic/object/bo/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/bv/CMakeLists.txt b/test/bacnet/basic/object/bv/CMakeLists.txt index 280fd248..7b73229e 100644 --- a/test/bacnet/basic/object/bv/CMakeLists.txt +++ b/test/bacnet/basic/object/bv/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/channel/CMakeLists.txt b/test/bacnet/basic/object/channel/CMakeLists.txt index 2cc35733..59f024dd 100644 --- a/test/bacnet/basic/object/channel/CMakeLists.txt +++ b/test/bacnet/basic/object/channel/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/wp.c ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/color_object/CMakeLists.txt b/test/bacnet/basic/object/color_object/CMakeLists.txt index 59fd44b2..ca0707d1 100644 --- a/test/bacnet/basic/object/color_object/CMakeLists.txt +++ b/test/bacnet/basic/object/color_object/CMakeLists.txt @@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/color_temperature/CMakeLists.txt b/test/bacnet/basic/object/color_temperature/CMakeLists.txt index f398eea9..d146c96e 100644 --- a/test/bacnet/basic/object/color_temperature/CMakeLists.txt +++ b/test/bacnet/basic/object/color_temperature/CMakeLists.txt @@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/command/CMakeLists.txt b/test/bacnet/basic/object/command/CMakeLists.txt index c5a3e366..b26080b8 100644 --- a/test/bacnet/basic/object/command/CMakeLists.txt +++ b/test/bacnet/basic/object/command/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/credential_data_input/CMakeLists.txt b/test/bacnet/basic/object/credential_data_input/CMakeLists.txt index 622e256e..214b15ae 100644 --- a/test/bacnet/basic/object/credential_data_input/CMakeLists.txt +++ b/test/bacnet/basic/object/credential_data_input/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/csv/CMakeLists.txt b/test/bacnet/basic/object/csv/CMakeLists.txt index 7056889d..96edd4ba 100644 --- a/test/bacnet/basic/object/csv/CMakeLists.txt +++ b/test/bacnet/basic/object/csv/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c ${SRC_DIR}/bacnet/memcopy.c # Test and test library files ./src/main.c diff --git a/test/bacnet/basic/object/device/CMakeLists.txt b/test/bacnet/basic/object/device/CMakeLists.txt index 132cabfb..13c9fc08 100644 --- a/test/bacnet/basic/object/device/CMakeLists.txt +++ b/test/bacnet/basic/object/device/CMakeLists.txt @@ -96,6 +96,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/wp.c ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c ./stubs.c # Test and test library files ./src/main.c diff --git a/test/bacnet/basic/object/iv/CMakeLists.txt b/test/bacnet/basic/object/iv/CMakeLists.txt index efa8f53b..293fa19e 100644 --- a/test/bacnet/basic/object/iv/CMakeLists.txt +++ b/test/bacnet/basic/object/iv/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/lc/CMakeLists.txt b/test/bacnet/basic/object/lc/CMakeLists.txt index 5fde0e75..5a7ab937 100644 --- a/test/bacnet/basic/object/lc/CMakeLists.txt +++ b/test/bacnet/basic/object/lc/CMakeLists.txt @@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c ./stubs.c # Test and test library files ./src/main.c diff --git a/test/bacnet/basic/object/lo/CMakeLists.txt b/test/bacnet/basic/object/lo/CMakeLists.txt index e8de6ac2..ab56836c 100644 --- a/test/bacnet/basic/object/lo/CMakeLists.txt +++ b/test/bacnet/basic/object/lo/CMakeLists.txt @@ -58,6 +58,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/lsp/CMakeLists.txt b/test/bacnet/basic/object/lsp/CMakeLists.txt index 4ce23ebf..09a31b0c 100644 --- a/test/bacnet/basic/object/lsp/CMakeLists.txt +++ b/test/bacnet/basic/object/lsp/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/ms-input/CMakeLists.txt b/test/bacnet/basic/object/ms-input/CMakeLists.txt index 5a61d9c8..fabbd268 100644 --- a/test/bacnet/basic/object/ms-input/CMakeLists.txt +++ b/test/bacnet/basic/object/ms-input/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/mso/CMakeLists.txt b/test/bacnet/basic/object/mso/CMakeLists.txt index 8c68da66..2ca97e03 100644 --- a/test/bacnet/basic/object/mso/CMakeLists.txt +++ b/test/bacnet/basic/object/mso/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/basic/object/msv/CMakeLists.txt b/test/bacnet/basic/object/msv/CMakeLists.txt index 4db9f4a7..d7ca77c9 100644 --- a/test/bacnet/basic/object/msv/CMakeLists.txt +++ b/test/bacnet/basic/object/msv/CMakeLists.txt @@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/nc/CMakeLists.txt b/test/bacnet/basic/object/nc/CMakeLists.txt index 2cdfb7fc..12cd7d91 100644 --- a/test/bacnet/basic/object/nc/CMakeLists.txt +++ b/test/bacnet/basic/object/nc/CMakeLists.txt @@ -59,6 +59,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/wp.c ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./stubs.c ./src/main.c diff --git a/test/bacnet/basic/object/netport/CMakeLists.txt b/test/bacnet/basic/object/netport/CMakeLists.txt index ff5eaaa9..c4de36d9 100644 --- a/test/bacnet/basic/object/netport/CMakeLists.txt +++ b/test/bacnet/basic/object/netport/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/osv/CMakeLists.txt b/test/bacnet/basic/object/osv/CMakeLists.txt index b37a0f5c..48ceed6b 100644 --- a/test/bacnet/basic/object/osv/CMakeLists.txt +++ b/test/bacnet/basic/object/osv/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/piv/CMakeLists.txt b/test/bacnet/basic/object/piv/CMakeLists.txt index 2c16d761..973e4daf 100644 --- a/test/bacnet/basic/object/piv/CMakeLists.txt +++ b/test/bacnet/basic/object/piv/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/schedule/CMakeLists.txt b/test/bacnet/basic/object/schedule/CMakeLists.txt index 1d03f930..09a46e07 100644 --- a/test/bacnet/basic/object/schedule/CMakeLists.txt +++ b/test/bacnet/basic/object/schedule/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/wp.c ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/basic/object/trendlog/CMakeLists.txt b/test/bacnet/basic/object/trendlog/CMakeLists.txt index 47c31279..c9ec1098 100644 --- a/test/bacnet/basic/object/trendlog/CMakeLists.txt +++ b/test/bacnet/basic/object/trendlog/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/wp.c ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ../mock/device_mock.c diff --git a/test/bacnet/cov/CMakeLists.txt b/test/bacnet/cov/CMakeLists.txt index 4237d828..5393faf1 100644 --- a/test/bacnet/cov/CMakeLists.txt +++ b/test/bacnet/cov/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/cov/src/main.c b/test/bacnet/cov/src/main.c index 849e278d..2fa49e26 100644 --- a/test/bacnet/cov/src/main.c +++ b/test/bacnet/cov/src/main.c @@ -270,7 +270,8 @@ static void testCOVSubscribePropertyData( zassert_equal( test_data->covIncrementPresent, data->covIncrementPresent, NULL); if (test_data->covIncrementPresent) { - zassert_equal(test_data->covIncrement, data->covIncrement, NULL); + zassert_false(islessgreater(test_data->covIncrement, + data->covIncrement), NULL); } } diff --git a/test/bacnet/create_object/CMakeLists.txt b/test/bacnet/create_object/CMakeLists.txt index 828305f6..07542d85 100644 --- a/test/bacnet/create_object/CMakeLists.txt +++ b/test/bacnet/create_object/CMakeLists.txt @@ -45,6 +45,7 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/bacstr.c ${SRC_DIR}/bacnet/bactext.c ${SRC_DIR}/bacnet/basic/sys/bigend.c + ${SRC_DIR}/bacnet/calendar_entry.c ${SRC_DIR}/bacnet/datetime.c ${SRC_DIR}/bacnet/basic/sys/days.c ${SRC_DIR}/bacnet/indtext.c @@ -55,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/delete_object/CMakeLists.txt b/test/bacnet/delete_object/CMakeLists.txt index f2d2bd69..2401806c 100644 --- a/test/bacnet/delete_object/CMakeLists.txt +++ b/test/bacnet/delete_object/CMakeLists.txt @@ -55,7 +55,9 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c - # Test and test library files + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c +# Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c ${ZTST_DIR}/ztest.c diff --git a/test/bacnet/event/CMakeLists.txt b/test/bacnet/event/CMakeLists.txt index 0039d235..5e88da85 100644 --- a/test/bacnet/event/CMakeLists.txt +++ b/test/bacnet/event/CMakeLists.txt @@ -57,6 +57,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/lighting.c ${SRC_DIR}/bacnet/timestamp.c ${SRC_DIR}/bacnet/hostnport.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/event/src/main.c b/test/bacnet/event/src/main.c index 93ca06ee..62aa9128 100644 --- a/test/bacnet/event/src/main.c +++ b/test/bacnet/event/src/main.c @@ -291,8 +291,9 @@ static void testEventEventState(void) zassert_equal(data.notificationParams.changeOfValue.tag, data2.notificationParams.changeOfValue.tag, NULL); - zassert_equal(data.notificationParams.changeOfValue.newValue.changeValue, - data2.notificationParams.changeOfValue.newValue.changeValue, NULL); + zassert_false(islessgreater( + data.notificationParams.changeOfValue.newValue.changeValue, + data2.notificationParams.changeOfValue.newValue.changeValue), NULL); /* ** Event Type = EVENT_CHANGE_OF_VALUE - bitstring value @@ -462,14 +463,15 @@ static void testEventEventState(void) apdu_len, test_len, "apdu_len=%d test_len=%d", apdu_len, test_len); verifyBaseEventState(); - zassert_equal(data.notificationParams.floatingLimit.referenceValue, - data2.notificationParams.floatingLimit.referenceValue, NULL); - - zassert_equal(data.notificationParams.floatingLimit.setPointValue, - data2.notificationParams.floatingLimit.setPointValue, NULL); - - zassert_equal(data.notificationParams.floatingLimit.errorLimit, - data2.notificationParams.floatingLimit.errorLimit, NULL); + zassert_false(islessgreater( + data.notificationParams.floatingLimit.referenceValue, + data2.notificationParams.floatingLimit.referenceValue), NULL); + zassert_false(islessgreater( + data.notificationParams.floatingLimit.setPointValue, + data2.notificationParams.floatingLimit.setPointValue), NULL); + zassert_false(islessgreater( + data.notificationParams.floatingLimit.errorLimit, + data2.notificationParams.floatingLimit.errorLimit), NULL); zassert_true( bitstring_same(&data.notificationParams.floatingLimit.statusFlags, &data2.notificationParams.floatingLimit.statusFlags), @@ -508,14 +510,16 @@ static void testEventEventState(void) zassert_equal(apdu_len, test_len, NULL); verifyBaseEventState(); - zassert_equal(data.notificationParams.outOfRange.deadband, - data2.notificationParams.outOfRange.deadband, NULL); + zassert_false(islessgreater(data.notificationParams.outOfRange.deadband, + data2.notificationParams.outOfRange.deadband), NULL); - zassert_equal(data.notificationParams.outOfRange.exceededLimit, - data2.notificationParams.outOfRange.exceededLimit, NULL); + zassert_false(islessgreater( + data.notificationParams.outOfRange.exceededLimit, + data2.notificationParams.outOfRange.exceededLimit), NULL); - zassert_equal(data.notificationParams.outOfRange.exceedingValue, - data2.notificationParams.outOfRange.exceedingValue, NULL); + zassert_false(islessgreater( + data.notificationParams.outOfRange.exceedingValue, + data2.notificationParams.outOfRange.exceedingValue), NULL); zassert_true(bitstring_same(&data.notificationParams.outOfRange.statusFlags, &data2.notificationParams.outOfRange.statusFlags), NULL); diff --git a/test/bacnet/getalarm/CMakeLists.txt b/test/bacnet/getalarm/CMakeLists.txt index 8f2eb18b..e0105108 100644 --- a/test/bacnet/getalarm/CMakeLists.txt +++ b/test/bacnet/getalarm/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/getevent/CMakeLists.txt b/test/bacnet/getevent/CMakeLists.txt index 4c5a2c05..185c7445 100644 --- a/test/bacnet/getevent/CMakeLists.txt +++ b/test/bacnet/getevent/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/hostnport/CMakeLists.txt b/test/bacnet/hostnport/CMakeLists.txt index 76cf73cb..c8e5e664 100644 --- a/test/bacnet/hostnport/CMakeLists.txt +++ b/test/bacnet/hostnport/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/list_element/CMakeLists.txt b/test/bacnet/list_element/CMakeLists.txt index 52dd322c..ff062724 100644 --- a/test/bacnet/list_element/CMakeLists.txt +++ b/test/bacnet/list_element/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/lso/CMakeLists.txt b/test/bacnet/lso/CMakeLists.txt index c8549d65..6bfcce75 100644 --- a/test/bacnet/lso/CMakeLists.txt +++ b/test/bacnet/lso/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/ptransfer/CMakeLists.txt b/test/bacnet/ptransfer/CMakeLists.txt index 412d9b16..0eb72a88 100644 --- a/test/bacnet/ptransfer/CMakeLists.txt +++ b/test/bacnet/ptransfer/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/rpm/CMakeLists.txt b/test/bacnet/rpm/CMakeLists.txt index 01a717a7..dd91dd05 100644 --- a/test/bacnet/rpm/CMakeLists.txt +++ b/test/bacnet/rpm/CMakeLists.txt @@ -56,6 +56,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/specialevent/CMakeLists.txt b/test/bacnet/specialevent/CMakeLists.txt new file mode 100644 index 00000000..1fbdfa22 --- /dev/null +++ b/test/bacnet/specialevent/CMakeLists.txt @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: MIT + +cmake_minimum_required(VERSION 3.10 FATAL_ERROR) + +get_filename_component(basename ${CMAKE_CURRENT_SOURCE_DIR} NAME) +project(test_${basename} + VERSION 1.0.0 + LANGUAGES C) + + +string(REGEX REPLACE + "/test/bacnet/[a-zA-Z_/-]*$" + "/src" + SRC_DIR + ${CMAKE_CURRENT_SOURCE_DIR}) +string(REGEX REPLACE + "/test/bacnet/[a-zA-Z_/-]*$" + "/test" + TST_DIR + ${CMAKE_CURRENT_SOURCE_DIR}) +set(ZTST_DIR "${TST_DIR}/ztest/src") + +add_compile_definitions( + BIG_ENDIAN=0 + CONFIG_ZTEST=1 + BACAPP_ALL + ) + +include_directories( + ${SRC_DIR} + ${TST_DIR}/ztest/include + ) + +add_executable(${PROJECT_NAME} + # File(s) under test + ${SRC_DIR}/bacnet/special_event.c + # Support files and stubs (pathname alphabetical) + ${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/bactext.c + ${SRC_DIR}/bacnet/basic/sys/bigend.c + ${SRC_DIR}/bacnet/datetime.c + ${SRC_DIR}/bacnet/basic/sys/days.c + ${SRC_DIR}/bacnet/indtext.c + ${SRC_DIR}/bacnet/hostnport.c + ${SRC_DIR}/bacnet/lighting.c + ${SRC_DIR}/bacnet/timestamp.c + ${SRC_DIR}/bacnet/bactimevalue.c + ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/weeklyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c + # Test and test library files + ./src/main.c + ${ZTST_DIR}/ztest_mock.c + ${ZTST_DIR}/ztest.c + ) diff --git a/test/bacnet/specialevent/src/main.c b/test/bacnet/specialevent/src/main.c new file mode 100644 index 00000000..fc5e9ed9 --- /dev/null +++ b/test/bacnet/specialevent/src/main.c @@ -0,0 +1,377 @@ +/** + * @file + * @brief Unit test for BACnetSpecialEvent. This test also indirectly tests + * BACnetCalendarEntry + * @author Ondřej Hruška + * @date Aug 2023 + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include +#include +#include +#include +#include "bacnet/bactimevalue.h" +#include "bacnet/special_event.h" +#include "bacnet/calendar_entry.h" +#include "bacnet/datetime.h" +#include "bacnet/bacapp.h" + +/** + * @addtogroup bacnet_tests + * @{ + */ + +/** + * @brief Test encode/decode API + */ +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_CalendarRef) +#else +static void test_BACnetSpecialEvent_CalendarRef(void) +#endif +{ + int len, apdu_len, null_len; + uint8_t apdu[MAX_APDU] = { 0 }; + + BACNET_SPECIAL_EVENT in = { + .periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_REFERENCE, + .period = { + .calendarReference = { + .instance = 5, + .type = OBJECT_CALENDAR, + } + }, + .timeValues = { + .TV_Count = 2, + .Time_Values = { + { + .Time = { + .hour = 12, + .min = 30, + .sec = 15, + .hundredths = 5 + }, + .Value = { + .tag = BACNET_APPLICATION_TAG_UNSIGNED_INT, + .type = { + .Unsigned_Int = 15, + }, + } + }, + { + .Time = { + .hour = 16, + .min = 1, + .sec = 2, + .hundredths = 3 + }, + .Value = { + .tag = BACNET_APPLICATION_TAG_UNSIGNED_INT, + .type = { + .Unsigned_Int = 0, + }, + } + }, + } + }, + .priority = 5, + }; + BACNET_SPECIAL_EVENT out = { 0 }; + + len = bacnet_special_event_encode(apdu, &in); + null_len = bacnet_special_event_encode(NULL, &in); + zassert_equal(len, null_len, NULL); + + apdu_len = bacnet_special_event_decode(apdu, len, &out); + zassert_equal(len, apdu_len, NULL); + + zassert_equal(in.periodTag, out.periodTag, NULL); + zassert_equal(in.period.calendarReference.instance, + out.period.calendarReference.instance, NULL); + zassert_equal(in.period.calendarReference.type, + out.period.calendarReference.type, NULL); + zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL); + + zassert_equal(in.timeValues.Time_Values[0].Time.hour, + out.timeValues.Time_Values[0].Time.hour, NULL); + zassert_equal(in.timeValues.Time_Values[0].Time.min, + out.timeValues.Time_Values[0].Time.min, NULL); + zassert_equal(in.timeValues.Time_Values[0].Time.sec, + out.timeValues.Time_Values[0].Time.sec, NULL); + zassert_equal(in.timeValues.Time_Values[0].Time.hundredths, + out.timeValues.Time_Values[0].Time.hundredths, NULL); + + zassert_equal(in.timeValues.Time_Values[0].Value.tag, + out.timeValues.Time_Values[0].Value.tag, NULL); + zassert_equal(in.timeValues.Time_Values[0].Value.type.Unsigned_Int, + out.timeValues.Time_Values[0].Value.type.Unsigned_Int, NULL); + + zassert_equal(in.timeValues.Time_Values[1].Time.hour, + out.timeValues.Time_Values[1].Time.hour, NULL); + zassert_equal(in.timeValues.Time_Values[1].Time.min, + out.timeValues.Time_Values[1].Time.min, NULL); + zassert_equal(in.timeValues.Time_Values[1].Time.sec, + out.timeValues.Time_Values[1].Time.sec, NULL); + zassert_equal(in.timeValues.Time_Values[1].Time.hundredths, + out.timeValues.Time_Values[1].Time.hundredths, NULL); + + zassert_equal(in.timeValues.Time_Values[1].Value.tag, + out.timeValues.Time_Values[1].Value.tag, NULL); + zassert_equal(in.timeValues.Time_Values[1].Value.type.Unsigned_Int, + out.timeValues.Time_Values[1].Value.type.Unsigned_Int, NULL); + + zassert_equal(in.priority, out.priority, NULL); +} + +/** + * @brief Test encode/decode API with Calendar Entry (Date variant) + */ +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_Date) +#else +static void test_BACnetSpecialEvent_Date(void) +#endif +{ + int len, apdu_len, null_len; + uint8_t apdu[MAX_APDU] = { 0 }; + + BACNET_SPECIAL_EVENT in = { + .periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY, + .period = { + .calendarEntry = { + .tag = BACNET_CALENDAR_DATE, + .type = { + .Date = { + .year = 2155, + .month = 10, + .day = 0xff, + .wday = 0xff, + } + } + } + }, + .timeValues = { + .TV_Count = 0, + .Time_Values = { 0 } + }, + .priority = 16, + }; + BACNET_SPECIAL_EVENT out = { 0 }; + + len = bacnet_special_event_encode(apdu, &in); + null_len = bacnet_special_event_encode(NULL, &in); + zassert_equal(len, null_len, NULL); + + apdu_len = bacnet_special_event_decode(apdu, len, &out); + zassert_equal(len, apdu_len, NULL); + zassert_equal(in.periodTag, out.periodTag, NULL); + zassert_equal( + in.period.calendarEntry.tag, out.period.calendarEntry.tag, NULL); + zassert_equal(in.period.calendarEntry.type.Date.wday, + out.period.calendarEntry.type.Date.wday, NULL); + zassert_equal(in.period.calendarEntry.type.Date.year, + out.period.calendarEntry.type.Date.year, NULL); + zassert_equal(in.period.calendarEntry.type.Date.month, + out.period.calendarEntry.type.Date.month, NULL); + zassert_equal(in.period.calendarEntry.type.Date.day, + out.period.calendarEntry.type.Date.day, NULL); + + zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL); + zassert_equal(in.priority, out.priority, NULL); +} + +/** + * @brief Test encode/decode API with Calendar Entry (DateRange variant) + */ +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_DateRange) +#else +static void test_BACnetSpecialEvent_DateRange(void) +#endif +{ + int len, apdu_len, null_len; + uint8_t apdu[MAX_APDU] = { 0 }; + + BACNET_SPECIAL_EVENT in = { + .periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY, + .period = { + .calendarEntry = { + .tag = BACNET_CALENDAR_DATE_RANGE, + .type = { + .DateRange = { + .startdate = { + .day = 1, + .month = 12, + .year = 2155, + .wday = 0xff, + }, + .enddate = { + .day = 31, + .month = 12, + .year = 2155, + .wday = 0xff, + }, + } + } + } + }, + .timeValues = { + .TV_Count = 0, + .Time_Values = { 0 } + }, + .priority = 0, + }; + BACNET_SPECIAL_EVENT out = { 0 }; + + len = bacnet_special_event_encode(apdu, &in); + null_len = bacnet_special_event_encode(NULL, &in); + zassert_equal(len, null_len, NULL); + + apdu_len = bacnet_special_event_decode(apdu, len, &out); + zassert_equal(len, apdu_len, "apdu_len %d != len %d", apdu_len, len); + zassert_equal(in.periodTag, out.periodTag, NULL); + + zassert_equal( + in.period.calendarEntry.tag, out.period.calendarEntry.tag, NULL); + + zassert_equal(in.period.calendarEntry.type.DateRange.startdate.wday, + out.period.calendarEntry.type.DateRange.startdate.wday, NULL); + zassert_equal(in.period.calendarEntry.type.DateRange.startdate.year, + out.period.calendarEntry.type.DateRange.startdate.year, NULL); + zassert_equal(in.period.calendarEntry.type.DateRange.startdate.month, + out.period.calendarEntry.type.DateRange.startdate.month, NULL); + zassert_equal(in.period.calendarEntry.type.DateRange.startdate.day, + out.period.calendarEntry.type.DateRange.startdate.day, NULL); + + zassert_equal(in.period.calendarEntry.type.DateRange.enddate.wday, + out.period.calendarEntry.type.DateRange.enddate.wday, NULL); + zassert_equal(in.period.calendarEntry.type.DateRange.enddate.year, + out.period.calendarEntry.type.DateRange.enddate.year, NULL); + zassert_equal(in.period.calendarEntry.type.DateRange.enddate.month, + out.period.calendarEntry.type.DateRange.enddate.month, NULL); + zassert_equal(in.period.calendarEntry.type.DateRange.enddate.day, + out.period.calendarEntry.type.DateRange.enddate.day, NULL); + + zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL); + zassert_equal(in.priority, out.priority, NULL); +} + +/** + * @brief Test encode/decode API with Calendar Entry (Date variant) + */ +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_WeekNDate) +#else +static void test_BACnetSpecialEvent_WeekNDate(void) +#endif +{ + int len, apdu_len, null_len; + uint8_t apdu[MAX_APDU] = { 0 }; + + BACNET_SPECIAL_EVENT in = { + .periodTag = BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY, + .period = { + .calendarEntry = { + .tag = BACNET_CALENDAR_WEEK_N_DAY, + .type = { + .WeekNDay = { + .month = 0xff, + .dayofweek = 1, /* mondays */ + .weekofmonth = 0xff, + } + } + } + }, + .timeValues = { + .TV_Count = 0, + .Time_Values = { 0 } + }, + .priority = 16, + }; + BACNET_SPECIAL_EVENT out = { 0 }; + + len = bacnet_special_event_encode(apdu, &in); + null_len = bacnet_special_event_encode(NULL, &in); + zassert_equal(len, null_len, NULL); + + apdu_len = bacnet_special_event_decode(apdu, len, &out); + zassert_equal(len, apdu_len, NULL); + zassert_equal(in.periodTag, out.periodTag, NULL); + + zassert_equal( + in.period.calendarEntry.tag, out.period.calendarEntry.tag, NULL); + zassert_equal(in.period.calendarEntry.type.WeekNDay.month, + out.period.calendarEntry.type.WeekNDay.month, NULL); + zassert_equal(in.period.calendarEntry.type.WeekNDay.dayofweek, + out.period.calendarEntry.type.WeekNDay.dayofweek, NULL); + zassert_equal(in.period.calendarEntry.type.WeekNDay.weekofmonth, + out.period.calendarEntry.type.WeekNDay.weekofmonth, NULL); + + zassert_equal(in.timeValues.TV_Count, out.timeValues.TV_Count, NULL); + zassert_equal(in.priority, out.priority, NULL); +} + +/** @brief try decoding a real sample from Siemens, captured with wireshark */ +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST(BACnetSpecialEvent_tests, test_BACnetSpecialEvent_DecodeRealAPDU) +#else +static void test_BACnetSpecialEvent_DecodeRealAPDU(void) +#endif +{ + int len, apdu_len; + BACNET_SPECIAL_EVENT out = { 0 }; + uint8_t sample[18] = { 0x0e, 0x0c, 0xff, 0x0a, 0x1c, 0xff, 0x0f, 0x2e, 0xb4, + 0x00, 0x00, 0x00, 0x00, 0x91, 0x00, 0x2f, 0x39, 0x10 }; + + apdu_len = bacnet_special_event_decode(sample, sizeof(sample), &out); + zassert_equal(sizeof(sample), apdu_len, NULL); + + zassert_equal( + out.periodTag, BACNET_SPECIAL_EVENT_PERIOD_CALENDAR_ENTRY, NULL); + zassert_equal(out.period.calendarEntry.tag, BACNET_CALENDAR_DATE, NULL); + zassert_equal(out.period.calendarEntry.type.Date.day, 28, NULL); + zassert_equal(out.period.calendarEntry.type.Date.month, 10, NULL); + zassert_equal( + out.period.calendarEntry.type.Date.year, 2155 /* any */, NULL); + zassert_equal( + out.period.calendarEntry.type.Date.wday, 0xff /* any */, NULL); + + zassert_equal(out.timeValues.TV_Count, 1, NULL); + + zassert_equal(out.timeValues.Time_Values[0].Time.hour, 0, NULL); + zassert_equal(out.timeValues.Time_Values[0].Time.min, 0, NULL); + zassert_equal(out.timeValues.Time_Values[0].Time.sec, 0, NULL); + zassert_equal(out.timeValues.Time_Values[0].Time.hundredths, 0, NULL); + + zassert_equal(out.timeValues.Time_Values[0].Value.tag, + BACNET_APPLICATION_TAG_ENUMERATED, NULL); + zassert_equal( + out.timeValues.Time_Values[0].Value.type.Unsigned_Int, 0, NULL); + + zassert_equal(out.priority, 16, NULL); +} + +/** + * @} + */ + +#if defined(CONFIG_ZTEST_NEW_API) +ZTEST_SUITE(BACnetSpecialEvent_tests, NULL, NULL, NULL, NULL, NULL); +#else +void test_main(void) +{ + ztest_test_suite(BACnetSpecialEvent_tests, + ztest_unit_test(test_BACnetSpecialEvent_CalendarRef), + ztest_unit_test(test_BACnetSpecialEvent_Date), + ztest_unit_test(test_BACnetSpecialEvent_DateRange), + ztest_unit_test(test_BACnetSpecialEvent_WeekNDate), + ztest_unit_test(test_BACnetSpecialEvent_DecodeRealAPDU)); + + ztest_run_test_suite(BACnetSpecialEvent_tests); +} +#endif diff --git a/test/bacnet/timesync/CMakeLists.txt b/test/bacnet/timesync/CMakeLists.txt index fcc09f27..f39bded0 100644 --- a/test/bacnet/timesync/CMakeLists.txt +++ b/test/bacnet/timesync/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/weeklyschedule/CMakeLists.txt b/test/bacnet/weeklyschedule/CMakeLists.txt index a52d740f..ac48a78e 100644 --- a/test/bacnet/weeklyschedule/CMakeLists.txt +++ b/test/bacnet/weeklyschedule/CMakeLists.txt @@ -53,6 +53,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/hostnport.c ${SRC_DIR}/bacnet/lighting.c ${SRC_DIR}/bacnet/timestamp.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/wp/CMakeLists.txt b/test/bacnet/wp/CMakeLists.txt index 74fee63d..c73c2e2a 100644 --- a/test/bacnet/wp/CMakeLists.txt +++ b/test/bacnet/wp/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/test/bacnet/wp/src/main.c b/test/bacnet/wp/src/main.c index 63649196..6b955fc2 100644 --- a/test/bacnet/wp/src/main.c +++ b/test/bacnet/wp/src/main.c @@ -7,7 +7,7 @@ /* @file * @brief test BACnet integer encode/decode APIs */ - +#include #include #include @@ -129,7 +129,8 @@ static void testWritePropertyTag(BACNET_APPLICATION_DATA_VALUE *value) test_value.type.Signed_Int, value->type.Signed_Int, NULL); break; case BACNET_APPLICATION_TAG_REAL: - zassert_equal(test_value.type.Real, value->type.Real, NULL); + zassert_false(islessgreater(test_value.type.Real, value->type.Real), + NULL); break; case BACNET_APPLICATION_TAG_ENUMERATED: zassert_equal( diff --git a/test/bacnet/wpm/CMakeLists.txt b/test/bacnet/wpm/CMakeLists.txt index af211ce9..40358b0e 100644 --- a/test/bacnet/wpm/CMakeLists.txt +++ b/test/bacnet/wpm/CMakeLists.txt @@ -55,6 +55,8 @@ add_executable(${PROJECT_NAME} ${SRC_DIR}/bacnet/weeklyschedule.c ${SRC_DIR}/bacnet/bactimevalue.c ${SRC_DIR}/bacnet/dailyschedule.c + ${SRC_DIR}/bacnet/calendar_entry.c + ${SRC_DIR}/bacnet/special_event.c # Test and test library files ./src/main.c ${ZTST_DIR}/ztest_mock.c diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index f2e376e9..d01c5005 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -320,6 +320,10 @@ set(BACNETSTACK_SRCS ${BACNETSTACK_SRC}/bacnet/weeklyschedule.h ${BACNETSTACK_SRC}/bacnet/dailyschedule.c ${BACNETSTACK_SRC}/bacnet/dailyschedule.h + ${BACNETSTACK_SRC}/bacnet/calendar_entry.c + ${BACNETSTACK_SRC}/bacnet/calendar_entry.h + ${BACNETSTACK_SRC}/bacnet/special_event.c + ${BACNETSTACK_SRC}/bacnet/special_event.h ) set(BACNETSTACK_BASIC_SRCS diff --git a/zephyr/tests/bacnet/bacapp/CMakeLists.txt b/zephyr/tests/bacnet/bacapp/CMakeLists.txt index b21608fd..fa7ae3b2 100644 --- a/zephyr/tests/bacnet/bacapp/CMakeLists.txt +++ b/zephyr/tests/bacnet/bacapp/CMakeLists.txt @@ -46,6 +46,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/acc/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/acc/CMakeLists.txt index 04ee0f61..8f5ea077 100644 --- a/zephyr/tests/bacnet/basic/object/acc/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/acc/CMakeLists.txt @@ -49,6 +49,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/access_credential/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/access_credential/CMakeLists.txt index 47f0e25f..f5284218 100644 --- a/zephyr/tests/bacnet/basic/object/access_credential/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/access_credential/CMakeLists.txt @@ -53,6 +53,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/access_door/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/access_door/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/access_door/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/access_door/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/access_point/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/access_point/CMakeLists.txt index 04ee0f61..8f5ea077 100644 --- a/zephyr/tests/bacnet/basic/object/access_point/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/access_point/CMakeLists.txt @@ -49,6 +49,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/access_rights/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/access_rights/CMakeLists.txt index b21edaef..298a5e7d 100644 --- a/zephyr/tests/bacnet/basic/object/access_rights/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/access_rights/CMakeLists.txt @@ -51,6 +51,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/access_user/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/access_user/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/access_user/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/access_user/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/access_zone/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/access_zone/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/access_zone/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/access_zone/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/ai/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/ai/CMakeLists.txt index e1ad53a1..47c9f9f0 100644 --- a/zephyr/tests/bacnet/basic/object/ai/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/ai/CMakeLists.txt @@ -52,6 +52,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/ao/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/ao/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/ao/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/ao/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/av/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/av/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/av/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/av/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/bi/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/bi/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/bi/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/bi/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/bo/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/bo/CMakeLists.txt index 33a779e7..102c7211 100644 --- a/zephyr/tests/bacnet/basic/object/bo/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/bo/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ${BACNET_SRC}/basic/sys/keylist.c diff --git a/zephyr/tests/bacnet/basic/object/bv/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/bv/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/bv/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/bv/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/color_object/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/color_object/CMakeLists.txt index d33319d9..fe89821c 100644 --- a/zephyr/tests/bacnet/basic/object/color_object/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/color_object/CMakeLists.txt @@ -53,6 +53,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/wp.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/color_temperature/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/color_temperature/CMakeLists.txt index 4e181ea2..bcb2ab33 100644 --- a/zephyr/tests/bacnet/basic/object/color_temperature/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/color_temperature/CMakeLists.txt @@ -53,6 +53,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/command/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/command/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/command/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/command/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/credential_data_input/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/credential_data_input/CMakeLists.txt index 54f55318..cbb5609e 100644 --- a/zephyr/tests/bacnet/basic/object/credential_data_input/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/credential_data_input/CMakeLists.txt @@ -52,6 +52,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/device/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/device/CMakeLists.txt index afec99ce..50051e41 100644 --- a/zephyr/tests/bacnet/basic/object/device/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/device/CMakeLists.txt @@ -95,6 +95,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/datalink/bvlc.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/lc/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/lc/CMakeLists.txt index 75620c82..09f51a5f 100644 --- a/zephyr/tests/bacnet/basic/object/lc/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/lc/CMakeLists.txt @@ -52,6 +52,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/lo/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/lo/CMakeLists.txt index 062d0517..0b449e66 100644 --- a/zephyr/tests/bacnet/basic/object/lo/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/lo/CMakeLists.txt @@ -51,6 +51,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/basic/sys/linear.c ${BACNET_SRC}/basic/sys/keylist.c diff --git a/zephyr/tests/bacnet/basic/object/lsp/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/lsp/CMakeLists.txt index ec0dcf79..e34aecbc 100644 --- a/zephyr/tests/bacnet/basic/object/lsp/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/lsp/CMakeLists.txt @@ -51,6 +51,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/ms-input/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/ms-input/CMakeLists.txt index f1ca535b..36b01749 100644 --- a/zephyr/tests/bacnet/basic/object/ms-input/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/ms-input/CMakeLists.txt @@ -51,6 +51,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/mso/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/mso/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/mso/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/mso/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/msv/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/msv/CMakeLists.txt index 17306090..2ddca523 100644 --- a/zephyr/tests/bacnet/basic/object/msv/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/msv/CMakeLists.txt @@ -51,6 +51,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/netport/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/netport/CMakeLists.txt index 86b203d5..ad43fdb2 100644 --- a/zephyr/tests/bacnet/basic/object/netport/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/netport/CMakeLists.txt @@ -52,6 +52,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/objects/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/objects/CMakeLists.txt index f070a2af..da1ac352 100644 --- a/zephyr/tests/bacnet/basic/object/objects/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/objects/CMakeLists.txt @@ -51,6 +51,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/osv/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/osv/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/osv/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/osv/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/piv/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/piv/CMakeLists.txt index da4f3355..9f6c1a31 100644 --- a/zephyr/tests/bacnet/basic/object/piv/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/piv/CMakeLists.txt @@ -50,6 +50,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/basic/object/schedule/CMakeLists.txt b/zephyr/tests/bacnet/basic/object/schedule/CMakeLists.txt index 8d71505c..615bd184 100644 --- a/zephyr/tests/bacnet/basic/object/schedule/CMakeLists.txt +++ b/zephyr/tests/bacnet/basic/object/schedule/CMakeLists.txt @@ -51,6 +51,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/cov/CMakeLists.txt b/zephyr/tests/bacnet/cov/CMakeLists.txt index a22e1a30..0814b8e9 100644 --- a/zephyr/tests/bacnet/cov/CMakeLists.txt +++ b/zephyr/tests/bacnet/cov/CMakeLists.txt @@ -48,6 +48,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/event/CMakeLists.txt b/zephyr/tests/bacnet/event/CMakeLists.txt index 70d00ca9..cd1a3db7 100644 --- a/zephyr/tests/bacnet/event/CMakeLists.txt +++ b/zephyr/tests/bacnet/event/CMakeLists.txt @@ -47,6 +47,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/bactext.c ${BACNET_SRC}/indtext.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/bactimevalue.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/lighting.c diff --git a/zephyr/tests/bacnet/ptransfer/CMakeLists.txt b/zephyr/tests/bacnet/ptransfer/CMakeLists.txt index 36db48d6..9ae7e141 100644 --- a/zephyr/tests/bacnet/ptransfer/CMakeLists.txt +++ b/zephyr/tests/bacnet/ptransfer/CMakeLists.txt @@ -47,6 +47,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/rpm/CMakeLists.txt b/zephyr/tests/bacnet/rpm/CMakeLists.txt index 239677b4..df87cbf1 100644 --- a/zephyr/tests/bacnet/rpm/CMakeLists.txt +++ b/zephyr/tests/bacnet/rpm/CMakeLists.txt @@ -49,6 +49,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c ) diff --git a/zephyr/tests/bacnet/wp/CMakeLists.txt b/zephyr/tests/bacnet/wp/CMakeLists.txt index 95b33908..89af7d7d 100644 --- a/zephyr/tests/bacnet/wp/CMakeLists.txt +++ b/zephyr/tests/bacnet/wp/CMakeLists.txt @@ -47,6 +47,8 @@ if(BOARD STREQUAL unit_testing) ${BACNET_SRC}/hostnport.c ${BACNET_SRC}/dailyschedule.c ${BACNET_SRC}/weeklyschedule.c + ${BACNET_SRC}/calendar_entry.c + ${BACNET_SRC}/special_event.c ${BACNET_SRC}/basic/sys/bigend.c ${BACNET_SRC}/bactimevalue.c )