Commit Graph

280 Commits

Author SHA1 Message Date
Steve Karg 7f2690fd96 Fixed a regression in the rpm_ack_object_property_process() function that prevented proper parsing of multi-object ReadPropertyMultiple ACK responses. The bug was introduced in PR #765 and caused the function to incorrectly return ERROR_CODE_INVALID_TAG after processing the first object, even when additional valid objects were present in the response. Added tests that use rpm_ack_object_property_process() with a multi-object RPM ACK to verify the fix and prevent regression. (#1183) 2025-12-09 13:18:52 -06:00
Steve Karg 2b328266c8 Fixed Channel object coercion encoding of non-primitive data. (#1181)
* Refactored the object-id to and from 32-bit value so channel-value could re-use the same API.

* Expanded the BACnetChannelValue coercion function to include all the coercions, no coercions, and invalid datatypes described in Table 12-63 of the Channel object.  Expanded unit testing code coverage for BACnetChannelValue.
2025-12-09 11:02:58 -06:00
Steve Karg 95cdec459e Fix warnings during unit testing of BACnet secure connect node. (#1182) 2025-12-09 09:34:28 -06:00
Steve Karg b1c6a0e74b Fixed writing to the Channel object when no member value coercion was required. (#1176)
* Updated documentation for encode functions to accurately describe return values (0 on error instead of BACNET_STATUS_ERROR)

* Expanded property support, removed INPUT object types, added fallback encoding for non-coerced data types, and updated error handling in ReadProperty of present-value to check for 0 instead of BACNET_STATUS_ERROR.

* Expanded the validation tests and increased test code coverage.
2025-12-04 20:28:43 -06:00
Steve Karg 9378f7d1e7 Secured npdu_is_expected_reply() function where the MS/TP reply matcher could have an out-of-bounds read. (#1178) 2025-12-04 09:34:20 -06:00
Steve Karg 6993a7c0fd Bugfix/indtext-find-string-among-similar (#1173)
* Enhanced string comparison functions and update indtext API usage

- Added library specific case-sensitive and case-insensitive string comparison functions that mimic strcmp.
- Updated indtext_by_string and indtext_by_istring to use the new comparison functions.
- Improved documentation for return values in indtext functions.
- Expanded test data in main.c for comprehensive testing when beginning of string matches another string.
2025-12-03 11:08:32 -06:00
Ryan Mulder 0fd814867d Change prints to debug (#1168) 2025-12-03 10:59:30 -06:00
Steve Karg 73fbb400cb Fixed bacnet_snprintf() to be able to return the full length of a string when the size is zero. (#1164) 2025-12-01 13:45:30 -06:00
Steve Karg ca9836b099 Added BACnetRecipient and BACnetAddressBinding codecs for EPICS application (#1163)
* Added BACnetRecipient and BACnetAddressBinding encoding, decoding, ASCII conversion, comparison, and copy functions.

*  Added library specific string manipulation utilities including strcmp, strncmp, stptok, and snprintf with offset functions.

* Added test/README about verification and validation testing.
2025-11-27 23:12:39 -06:00
Amer 94b267d67e linux: cache netmask for accurate subnet prefix calculation to fix implementation which always returned 0 (#1155)
Co-authored-by: Syed Amer Gilani <syed.gilani@trilux.com>
2025-11-21 15:21:59 -06:00
Steve Karg 004aaf702d Fixed unit test stack corruption from using stack based message text characterstring pointer in multiple functions and setting the value in the global event and test event data structures. (#1154) 2025-11-20 06:56:04 -06:00
Steve Karg 8f0fe8c48e Fix timesync recipient encoding to check for OBJECT_DEVICE type before encoding. (#1153) 2025-11-20 05:14:52 -06:00
Steve Karg e9dd910b55 Convert the property list values into int32_t to support the larger property values when an int is 8-bit or 16-bit. (#1145) 2025-11-16 08:34:45 -06:00
Steve Karg 9d1abbeba5 Added postpone reply because transmission of the segmented ComplexACK cannot begin until the node holds the token. (#1116) 2025-11-15 13:08:27 -06:00
Steve Karg 25d14c7c15 Fixed BACnet/SC secure connect VMAC, UUID, and initialization sequence (#1142)
* Refactored the BACnet/SC datalink initialization order by moving certificate file checks and hub connection registration to occur after datalink initialization
* Replaced stdlib rand() with platform-specific cryptographically secure random functions (RtlGenRandom for Windows, getrandom for Linux, arc4random_buf for BSD) to generate UUID and VMAC addresses, preventing duplicates that broke connections
* Enabled conditional debug output in BACnet/SC components when BUILD=debug is specified
2025-11-14 15:41:17 -06:00
Steve Karg 74972bd025 Added a basic creatable loop object with PID control (#1141)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-13 16:11:19 -06:00
Steve Karg 356b4f72bf Bugfix/channel-object-type-all-enabled (#1135)
* Added datetime same API for unit testing.

* Added CHANNEL_VALUE_ALL define and fixed the API integration for the additional datatypes now supported.
2025-11-10 14:02:03 -06:00
Steve Karg 5574c9d3f1 Added getter API function to timer object for state-change-value (#1134)
* Added a new getter API function Timer_State_Change_Value_Get() to the timer object that returns state-change values by copying them to a caller-provided buffer, providing a safer alternative to the existing Timer_State_Change_Value() function which returns a direct pointer to internal data.
2025-11-10 12:12:23 -06:00
Steve Karg 28a30be5ec Fixed compiler warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] (#1133)
* Fixed compiler  warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]

* Fixed compile error found in pipeline build.

* Fixed pre-commit
2025-11-09 13:26:35 -06:00
Steve Karg 4e52f26823 Added Audit Log and Time Value objects to basic device. (#1128)
* Added ListElement service callback for storing data.  

* Added Audit Log and Time Value objects to basic device.

* Added Audit Log object to Makefile and CMake builds.
2025-11-06 14:10:07 -06:00
Steve Karg 2acde643fd Secured BACnetAuthenticationFactorFormat decoder and added unit testing (#1127) 2025-11-06 14:08:38 -06:00
Steve Karg 35f3964b5a Secured event decoding by refactoring deprecated functions. (#1126)
* Secured event and authentication decoding by removing deprecated functions.

* Added extended, discrete-value, double-out-of-range, signed-out-of-range, unsigned-out-of-range, change-of-characterstring, change-of-status-flags, change-of-reliability, and change-of-timer event notification encode, decode, and unit testing with #ifdef disabled by default.
2025-11-05 21:41:30 -06:00
Steve Karg 4dd13cf199 Added basic timer object, internal state machine, and unit tests (#1123)
* Added basic timer object, internal state machine, and unit tests

* Added BACnetTimerStateChangeValue encode, decode, parse, print, and diff with unit tests

* Changed handler of add/remove list element to check if the property is a BACnetLIST

* Added BACnetLIST utility for handling WriteProperty to a list.

* Fixed outlier ReadProperty object handlers to return zero when the RP parameter is NULL.
2025-11-05 15:11:45 -06:00
Steve Karg cf79515272 Fixed octetstring_copy_value() and added unit tests. (#1121) 2025-10-28 17:54:38 -05:00
Steve Karg d4d928a915 Added more unit testing for ReadProperty to increase code coverage. (#1118) 2025-10-15 10:24:08 -05:00
Steve Karg b357bca5dd Converted device object test to use common read-write property test. Extended the basic BACnet device object example API. (#1106)
* Converted device object test to use common read-write property test. Extended the basic BACnet device object example API.

* Created BACnet/IP and COV test mocks to enable device object testing with less dependencies.
2025-09-24 07:09:56 -05:00
Steve Karg af29c75075 Test/expanded-object-property-write-coverage (#1102)
* Expanded test coverage for WriteProperty in objects.

* Added common property tests for Lighting Output object and updated CMake configuration
2025-09-19 20:27:26 -05:00
Steve Karg 5921a28590 Fixed CMake Error in libwebsocket: Compatibility with CMake < 3.5 has been removed from CMake (#1095) 2025-09-17 12:48:27 -05:00
Steve Karg 0da61e52bb Added MS/TP statistics counters for BadCRC and Poll-For-Master. (#1081) 2025-09-11 10:53:16 -05:00
Steve Karg 7b727279bc Refactor Who-Am-I and You-Are JSON handlers to eliminate dynamic memory allocation for model and serial number strings, improving memory management and simplifying code. (#1089) 2025-09-11 10:52:36 -05:00
Steve Karg 71c03b29e8 Bugfix/lighting-output-internal-process-api (#1086)
* Fixed Lighting_Command to ignore write priority and use its own. 

* Fixed BACnetLightingOperation reserved range.

* Refactor overridden into the lighting command module. Added Overridden status flags API.  Added Lighting Output API to implement a momentary override to the output that is cleared at the next lighting command.  Integrated lighting command overridden behavior into the lighting output object.

* Added Trim_Fade_Time, High_End_Trim, Low_End_Trim, Last_On_Value and Default_On_Value properties to lighting output.
Added TRIM_ACTIVE flag to lighting command. Added Last_On_Value and Default_On_Value to lighting command for restore and toggle.
2025-09-04 15:04:42 -05:00
Steve Karg 8a9c808b76 Fixed test code headers to be consistent and accurate having been derived from original C files. (#1087) 2025-09-04 11:44:24 -05:00
Steve Karg 55107e96b7 Bugfix/issues 1082 AddListElement and RemoveListElement and Notification Class object (#1083)
* Fixed AddListElement and RemoveListElement which were checking the wrong return value from Device object.

* Fixed decoding of ListElement Tag 0: Object ID instance.

* Fixed Notification_Class_Add_List_Element() and Notification_Class_Remove_List_Element() element counter index, and empty slot detection.

* Added bacnet_recipient_device_set() and bacnet_recipient_address_set() API

* Added unit test coverage for Notification Class object.
2025-08-27 16:37:46 -05:00
Steve Karg 25c2aaa20d Secured I-Am request encoding and decoding, and updated the example apps and handlers to use secure version of I-Am decoder. (#1080) 2025-08-19 21:31:50 -05:00
Steve Karg 3f8b8b5619 Added dynamic and static RAM file systems to use with file objects. (#1058)
* Added dynamic RAM file system to use with basic bacnet file object.

* Added static RAM file system to use with basic bacnet file object.

* Added check for read-only during AtomicWriteFile service API for BACnet File object.

* Change stm32f4xx example to use static RAM file system.

* Fixed bacfile_count() function return type
2025-08-08 15:35:13 -05:00
Steve Karg 4095a7f335 Feature/mstp valid frame not for us stats (#1053)
* Fixed ISO C90 forbids mixed declarations and code warning.

* Fixed the MS/TP invalid frame counter that was incremented for valid frames not for us.
2025-08-01 09:58:45 -05:00
Steve Karg 1bebd6ac81 Refactored the bacnet file object to be storage agnostic with callbacks. (#1056) 2025-08-01 09:58:07 -05:00
Steve Karg f31193998c Add BACnet Zigbee VMAC table and unit test. (#1054) 2025-07-31 08:57:53 -05:00
Steve Karg b326563a3c Added BACnet Zigbee Link Layer (#1052) 2025-07-28 13:06:48 -05:00
Steve Karg 4f11defc4e Fixed MS/TP zero-config FSM getting stuck when duplicate address is detected. (#1048) 2025-07-16 10:04:45 -05:00
Ryan Mulder f010c8e2e8 add a debug print when tsm retries (#1040) 2025-07-05 22:01:47 -05:00
Mikhail Antropov 267db756b8 Added a basic example Auditlog object. (#458)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2025-06-23 12:18:13 -05:00
Steve Karg 464be15bae Refactor ReadRange by-position and by-sequence encoding into common module (#1028) 2025-06-23 10:50:48 -05:00
Steve Karg 5072fb5913 Feature/add who am i and you are services (#1024)
* Added Who-Am-I-Request encoding, decoding, unit tests, and command line application bacwhoami.

* Added You-Are-Request encoding, decoding, unit tests, and command line application bacyouare.

* Added Who-Am-I with Who-Is and You-Are handling into the example server application when run as device 4194303.
2025-06-23 10:49:59 -05:00
Steve Karg 14f033ceda Fixed GetEvent initialization of linked list (#1026)
* Fixed GetEvent usage of linked list by initializing next in all the examples and unit test.

* Secured GetEventInformation encoders by accepting NULL for APDU for determining the size, and exploit the NULL APDU for size checking during encoding. Secured the GetEventInformation decoders and removed the use of deprecated decoder API.
2025-06-20 13:34:39 -05:00
Steve Karg b0a97c6f75 Bugfix/bactext enumeration updates 2024 (#1020)
* Extended some BACnet enumerations from 135-2024 protocol-revision 25-30.  

* Changed usage of _FIRST and _LAST to _MIN and _MAX in some enumerations to be consistent.

* Added object type and services supported BACnetBitString sizes for protocol revision 25-30

*Added new BACnetPropertyIdentifier, BACnetEngineeringUnits, BACnetEventState, BACnetRestartReason, BACnetLifeSafetyMode, BACnetLifeSafetyOperation, BACnetLifeSafetyState, BACnet_Services_Supported, BACnetLightingOperation, BACnetBinaryLightingPV, BACnetNetworkPortCommand, BACnetAuthenticationDecision, BACnetAuthorizationPosture, BACnetFaultType, BACnetPriorityFilter, BACnetResultFlags, and BACnetSuccessFilter enumerations.

* Added BACnet text for BACnetLifeSafetyMode, BACnetLifeSafetyOperation, BACnetRestartReason, BACnetNetworkType, BACnetNetworkNumberQuality, BACnetNetworkPortCommand, BACnetAuthenticationDecision, BACnetAuthorizationPosture, BACnetFaultType, BACnetPriorityFilter, BACnetSuccessFilter, and BACnetResultFlags.
2025-06-17 14:36:57 -05:00
Steve Karg 5d45d43da5 Fixed BVLC Write Broadcast Distribution Table for protocol revision 17 and later. (#1005)
* Fixed BVLC Write Broadcast Distribution Table for protocol revision 17 and later.

* Added check for Network Port object bbmd-accept-fd-registrations property in BBMD handler.

* Added bvlc_foreign_device_table_decode() function and unit test.

* Added BDT and FTD write property to network port for IPv4
2025-06-10 09:48:10 -05:00
Steve Karg b3fd374c84 Fixed network port object to accept host name option of host-n-port writes. (#997) 2025-05-20 15:44:47 -05:00
Steve Karg 524fd162f9 Feature/basic-schedule-object-write-properties (#1000)
* Added schedule object WriteProperty handling for effective-period, list-of-object-property-references and exception-schedule properties.
2025-05-20 15:04:14 -05:00
Steve Karg 62bf8274f7 Fixed missing exports in bacnet/basic header files. (#996)
* Fixed missing exports in bacnet/basic header files.

* Refactor uBASIC for unique namespace and project define overrides.
2025-05-19 13:44:52 -05:00