* Fixed WriteProperty error code for PROP_FD_BBMD_ADDRESS and PROP_FD_SUBSCRIPTION_LIFETIME properties.
* Fixed dead-code warning after enabling all datalinks for basic network port object using the property list as the R/W checking for the port type.
* Changed ATmega168 example for ATmega328 on Arduino Uno R3 with DFR0259 RS485 shield. Added ADC interface from BDK port and mapped to some AV objects. Removed MS/TP MAC address DIP switch GPIO and moved MS/TP configuration to AV objects. Added AV units property. Added some Uno R3 Digital Inputs and outputs mapped to some BV. Added AVR EEPROM from BDK port and mapped some non-volatile data including MAC address and max manager and baud rate, device ID and names and description and location.
* Add editorconfig and pre-commit config
Editorconfig is widly used and supported file. It says basic things how
files should be formatted.
pre-commit is tool which can automatically check some basic checks like
code formatting everytime someone makes commit. This can also be used in
CI to run these things. Then it is very easy to do same things locally
as in CI. This also makes easy to select clang-format version so
everyone is using same one.
* clang-format: Ignore folders where are external code
We should not format external code. Add clang-format files to exclude
those. We should move external code always to example external/ folder
so we can exclude those more easily.
* clang-format: Remove custom zephyr/.clang-gormat
This clang-format file where introduces before our root clang-format. It
does not make sense anymore as we have root clang-format. Removing this
will unifie formatting in whole repo.
* clang-format: Add couple new rules
Add couple new formatting rules.
Always align const to left side. We did have only one place where it was
right side so this make sense as it is already rule for us.
I choose also insertbraces becuase when I run this I notice that we have
lot of multiline code without braces. So very error prone places. This
will take error possibility away. Repo also always use braces even with
single line statments so this does not matter much.
* ci: Add pre-commit validation
Validate pre-commit in CI.
* format: Convert spaces to tabs in Makefiles
Makefile normally use tabs. We enforce that with editorconfig. Fix
couple places where spaces where still in use.
---------
Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
* Refactored and secured BACnetActionCommand codec into bacaction.c module for command object and added to bacapp module encode/decode with define for enabling and pseudo application tag for internal use.
* Simplified bacapp_data_len() and moved into bacdcode module as bacnet_enclosed_data_len() function.
* Secured ReadProperty-REQUEST and -ACK decoding.
* Removed deprecated Keylist_Key() functions from usage.
* Removed pseudo application datatypes from bacapp_data_decode() which only uses primitive application tag encoded values.
* Defined INT_MAX when it is not already defined by compiler or libc.
* Deprecated bacapp_decode_application_data_len() and bacapp_decode_context_data_len() as they are no longer used in any code in the library.
* Added BACnetScale to bacapp module. Improved complex property value decoding. Refactored bacapp_decode_known_property() function.
* Refactored and improved the bacapp_snprintf() function for printing EPICS.
* Fixed Lighting Output WriteProperty to handle known property decoding.
* Fixed example app router-ipv6 to build under ports/win32
* Fixed example app router-mstp to build under ports/win32 with MinGW
* Added win32 builds of router-ipv6 and router-mstp to the Github pipeline
* Added required linux Ethernet library for ethernet build
* Added .obj to gitignore
* Fixed BACnet port for APPLE to use BSD in CMake
* Changed format in CMake to enable cleaner SC merge
* Added create-object and delete-object recipes in GCC Makefile
* Added datalink timer to all example OS apps
* Changed most microcontroller ports to use BACAPP_MINIMAL to specify which datatypes can be written.
* Fixed zephyr OS for BACnet/IP warning
* Fixed zephyr OS log to not require log_strdup
* Added writefile API to file object example
* Added API to device-client to make it more robust.
* Added API in network-port object for getting the ASCII object-name
* Added debug print with a timestamp option
* Added debug print with hex dump print
* Added API to network port object for activate and discard
* Added default define for debug with timestamp
* Added prototype in header for disabled debug printf.
* Added fifo peek ahead function to peek at more than one byte.
* Added get-mac value for network port that uses buffer rather than octetstring
* Added an example application to discover devices and their objects and properties on a specific destination network. The application uses a BACnet Discovery FSM module along with the BACnet R/W FSM. The BACnet Discovery module stores the binary property data in Keylists and includes device object property queries and iterators.
* Added callback from BACnet R/W FSM module for I-Am messages.
* Removed dependency in BACnet R/W FSM module on rpm_ack_decode_service_request() which uses calloc/free value lists. Created an alternate RPM-ACK to RP-ACK processing function.
* Changed RPM handler to skip over unknown property values
* Added a MS/TP zero-config (automatically choose an unused MAC address) using an algorithm that starts with MAC=64 and waits for a random number of PFM (minimum of 8 plus modulo 64) before attempting to choose a MAC sequentially from 64..127. The confirmation uses a 128-bit UUID with the MSTP Test Request frame. The modifications are in src/bacnet/datalink/mstp.c and src/bacnet/datalink/dlmstp.c modules enabling any device to use zero-config if enabled. A working demonstration is in the ports/stm32f4xx for the NUCLEO board. Complete unit testing is included. Options include lurking forever (wait for a router or another master node before joining) or lurking for a minimum time (enables self forming automatic MAC addressing device nodes).
* fixed BACnetXYcolor and BACnetColorCommand encode and decoding and improved unit test coverage. Refactored BACnetXYcolor to/from ascii into lighting module.
* added to the color, color temperature, and lighting output objects a fade/ramp/step engine. Added color and color command coercion into the channel object and enabled color temperature object coercion. Added CreateObject and DeleteObject service handling to the color, color temperature, lighting output, and channel objects.
* added blinkt demo app for Raspberry Pi [WIP]
* updated gitignore to simplify handling of apps folder contents
* fixed piface demo build
* added RaspiOS to pipeline for piface and blinkt! demo builds
* added device object timer function for child object types into example Device object. Refactored device object to increment database revision for create or delete object services. Refactored example app/server to use mstimer library and device child object timers.
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* fix ports/xplained build under Linux
* fix network port object link-speeds property
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* added or updated secure the BACnet primitive value decoders - the core codecs - named bacnet_x_decode(), bacnet_x_application_decode() and bacnet_x_context_decode where x is one of the 13 BACnet primitive value names. The updated API includes an APDU size to prevent over-reading of an APDU buffer while decoding. Improved or added unit test code coverage for the BACnet primitive value decoders.
* marked the insecure decoding API as 'deprecated' which is defined in src/bacnet/basic/sys/platform.h and can be disabled during a build.
* added secure decoders for BACnetTimeValue, BACnetHostNPort, BACnetTimeStamp, BACnetAddress, and Weekly_Schedule and improved unit test code coverage.
* improved test code coverage for BACnet objects and properties.
* secured AtomicReadFile and AtomicWriteFile service decoders and improved unit test code coverage.
* secured BACnet Error service decoder and improved unit test code coverage.
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* Added AddListElement and RemoveListElement services
Added list-element codec and unit tests.
Added BACnetDestination codec and unit tests.
Added RecipientList handling to NotificationClass object.
Added AddListElement and RemoveListElement client example app.
* Fix defects found by scan-build and CPPCHECK
* Update ports errors found during CI builds
* Update zephy os test build missing files in CMakeLists
---------
Co-authored-by: Ondřej Hruška <ondra@ondrovo.com>
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* Add What-Is-Network-Number handling.
Add What-Is-Network-Number and Network-Number-Is network layer handling.
Refactor npdu_encode_npdu_network() from router specific code.
Add unit test for NDPU network message
Add app for What-Is-Network-Number
Add app for Network-Number-Is
Add send helper for What-Is-Network-Number
Add send helper for Network-Number-Is
* added sys/debug.c to ports builds for use of debug_printf() in npdu handler.
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* added BACnetColorCommand and BACnetxyColor encoding and unit testing
* Added Color object and unit testing.
* Added Color Temperature object and Unit test
* Fix BVLC unit test warning.
* add port Makefile for extra types
* added RGB to and from CIE xy utility in sys folder, and add unit tests.
* added cmake-win32 target
* Change RP and RPM to use known property decoder.
Add color object RP and RPM decoding and printing
Fix RPM print for new reserved range above 4194303
Change default protocol-revision to 24 for Color object
* Integrate Color and Color Temperature objects into demo apps
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* Add APDU as NULL to get BACnet type lengths.
* Fix bacapp copy test to succeed
* fix BACnet REAL and DOUBLE decode
* Add unit test for NULL APDU encoding for length
* Add unit tests for bacapp context
* refactor host-n-port to hostnport.c module
* fix BVLC decoder
* additional unit testing for bacapp
* include bacdevobjpropref module in builds
* simplify bacapp snprintf to be able to return length
* adjust compiler for variable-length arrays
* fix bug found by scan-build
Authored-by: Steve Karg <skarg@users.sourceforge.net>
* Fix SPLINT to perform static defect analysis
Fix the SPLINT invocation in Makefile
Fix C files where SPLINT detected problems.
Remove UCIX check from SPLINT
Use SPLINT friendly parsing code disable for bacsec
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* Add flawfinder. Add error code for exit status.
* fix errors found by cppcheck
* fix initialization warning in unit test compile
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* Enable lcov coverage in unit testing via cmake.
* fix pipeline build error
* add compile options for unit test to silence some warnings
* remove all BAC_TEST unit tests in src/bacnet/ folder. They are now in test/bacnet/ folders using ztest.
* removed key.c - only used for unit test.
* produce XML test result output for parsing
* produce junit XML test result output
* change lint workflow to quality
* update readme badge for quality results
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* added make targets spell and codespell for spelling checks
* fix spelling errors detected by codespell
* added codespell to github workflow
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* added COBS encode and decode from BACnet standard
* Add unit tests for COBS encoding and decoding
* Improve COBS unit test and API.
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>