* Add and remove compiler warning compile options
Add some new compiler warnings. Some of those does not build clean so
ignore them for now. This also helps if some user use those options so
we ignore those for them also.
Also remove following ignores as they do not produce any warnings:
- Wno-attributes
- Wno-long-long
- Wno-implicit-fallthrough
* Fix -Wmissing-declarations compiler warnings
Fix new -Wmissing-declarations compiler warnings. I tried to look which
should be in headers and which should be static. Might be that some
statics should be in header as it is not easy to choose if something
should be exported or not.
* Fix -Wmissing-field-initializers compiler warnings
If we use { { 0 } } compiler thinks we might have mean that we only
meant initialize first member of struct or have forgotton to add second
one. We could do { { 0 }, 0 } but we can just do { 0 } which tells
compiler that hey just intialize this whole thing to zero.
* tests: Fix couple -Wfloat-conversion warnings
Add f prefix to floating point numbers to get some double to float
warnings away.
* ci: Make warnings as errors with cmake main build
To keep repo more clean from warnings use Werror flag when building main
project.
Windows should need -DCMAKE_C_FLAGS="/WX" but we have not ignore errors
for that yet so let's not yet take it in use.
* ci: Build also tests in matrix build
Enable also tests to be builded in our main matrix build. This way tests
will be builded also with clang and in future also with MSVC. We also
keep build very clean now as all warnings as catched.
With this we can also take out -Werror from compile_options as we add
that in CI. It is not good practice to keep that option always on. It
makes development lot harder. See example this blog post [1].
[1]: https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend/
* getevent: Deprecate getevent_encode_apdu()
Steve suggested that we should deprecate getevent_encode_apdu() [1].
Suggested-by: Steve Karg
[1]: https://github.com/bacnet-stack/bacnet-stack/pull/718#discussion_r1715821735
---------
Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
* Change MIT license texts to SPDX-License-Identifier
SPDX-License-Identifier is much easier to understand and grep than
license text so use that instead.
* Change GPL exception license texts to SPDX-License-Identifier
SPDX-License-Identifier is much easier to understand and grep than
license text so use that instead.
* Change misc license texts to SPDX-License-Identifier
There are some external code in repo which are not licenses as most of
the stuff in this repo. We still want every file to have SPDX identifier
to easily grep licenses.
* Add currently used license files
Even though Bacnet-Stack is using SPDX identifiers we still need to give
those license files with source. For this reason add all license files
to license/ folder.
SPDX has also files which would make same thing but this is style which
example Linux kernel is using and it is quite clear so I choose that one
for now.
I choosed not yet bring CC-PDDC as that is not right license for those
files.
---------
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.
* Added basic structured view object and unit test. Added example structured view into server example.
* Removed creation of objects from basic device object into the server example
* 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 Create/Delete object services to Analog Input, Analog Value, Binary Input, Binary Value, Multistate Input, Multistate Value object examples, and updated their units tests.
* Refactor property lists member function for WriteProperty default case.
* Refactor time-value object unit testing
* Added test for unsupported property to common property test
* Fixed compile warnings from double-float promotions.
* Changed zephyr compile to suppress deprecation warnings
* Fixed CreateObject API return value in many objects header files
* Changed zephyr build defines as strdup is no longer required for log print of strings
* [WIP] update manifest to zephyr v3.6.0
* [WIP] Deprecated ZTEST_NEW_API adjustments
Zephyr v3.6.0 removed Kconfig ZTEST_NEW_API.
The old ZTEST API is still used by non-Zephyr builds,
so the config setting is moved from `prj.conf` to
the test's CMakeLists.txt as `add_compile_definitions()`.
Verified by:
1. make clean all test
2. ./zephyr/scripts/twister -p unit_testing \
-T bacnet-stack/zephyr/tests/
---------
Co-authored-by: Gregory Shue <gregory.shue@legrand.com>
* Added Keylist_Data_Free function to free all nodes and data in a list
* Added basic Life Safety Zone object type in the apps/server example, with unit testing.
* Secured bacapp_decode_application_data_safe(), bacapp_decode_application_data_len(), bacapp_decode_context_data(), bacapp_decode_known_property() for timestamp, bacapp_decode_context_data_len(), and bacapp_data_len() functions.
* Fixed Command, Credential Data Input, and Schedule objects unit test
* Updated keylist to use bool and stdint value for key not found.
* Added Keylist_Index_Key to deprecate Keylist_Key function
* Changed the deprecated Keylist_Key API to Keylist_Index_Key
* Added unit test for Keylist_Index_Key API
* Added basic Calendar object, unit tests, and integration with example device object.
* Added basic Time Value object, unit tests, and integration with example device object.
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* 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 <skarg@users.sourceforge.net>
* Added Binary Lighting Output object example.
* Changed piface example app to support binary-lighting-output object type and blink warn
* Changed example device object to not create objects when device object-table is overridden
* Fixed unit testing for device object
* Fix device object ReinitializeDevice service handling examples of no-password in the device. Add unit testing of device object ReinitializeDevice service. Add API for setting ReinitializeDevice device object password.
* Fix DeviceCommunicationControl service handling example of no-password in the device.
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* object/nc: Fix incorrect apdu_len calculation when encoding Recipient_List which had resulted in malformed APDU.
* enabled unit testing on notification-class object example
---------
Co-authored-by: Tomasz Kazimierz Motyl <butterfly_tm666@yahoo.com>
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* refactor WriteProperty of object-name property rules into device object.
* remove dependence on device object inside some dynamic objects
* improve device object unit test coverage
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* 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>
* 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 BACnet CreateObject and DeleteObject services
* refactored codec for BACnetPropertyValue into bacapp module
* added unit tests for BACnetPropertyValue
* refactored COV and Events to use BACnetPropertyValue codec API
* added unit tests for COV
* added overrun safe decoders for tag numbers and boolean context
* added unit tests and codecs for CreateObject and DeleteObject services
* added APDU service handers and senders for CreateObject and DeleteObject services
* added command line apps bacco and bacdo for CreateObject and DeleteObject services
* added CreateObject and DeleteObject service handling in example server app and device object
* added new BACnetRejectReason, Error Class, and BACnetAbortReason enumerations and conversions
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* [WIP] Remove unit testcases duplicated under non-unit tree
* [WIP] Update west.yml to Zephyr v3.3.0 (twister verified)
* Update CI to Zephyr v3.4.0 w/ reduced module set
- Update zephyr/module.yml to use Zephyr v3.4.0 + cmsis;
- Update tests to use ZTEST_NEW_API for zephyr builds
Verified by:
1. make clean test
2. ./zephyr/scripts/twister -p unit_testing -T bacnet/zephyr/tests/bacnet
---------
Co-authored-by: Gregory Shue <gregory.shue@legrand.com>
* Update address in VMAC table for IPv6
* fix compile warnings in IPv6 handler
* cleanup BIP6 PRINTF
* enable unit test for BBMD6 hander
* keylist should only return FALSE when growing fails
---------
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>
Updating to integrate with Zephyr v3.2.0 required:
- Update `west.yml` to import Zephyr v3.2.0 manifest
- Prefix include pathname of ztest.h with `zephyr/`
- Prefix every Zephyr header included pathname with `zephyr/`
- Change all Zephyr tests/samples to use `find_package`
- For unit_testing, use a distinct prj.conf which only references
Kconfigs defined in the Zephyr repo. (Zephyr constraint.)
- Move ztest headers into a zephyr-prefixed pathname
Co-authored-by: Gregory Shue <gregory.shue@legrand.com>
* Enable dynamic BACnet POSIX files for example
* Add basic unit test for BACnet File object.
* Use example file pathname in demo app.
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* Enable extra GCC warnings to discover subtle bugs
* convert c++ comments to c comments
* cleanup pedantic compiler warnings
* Compile apps with GNU89 GNU99 GNU11 and GNU17
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
* schedule: add decode_daily_schedule() and encode_daily_schedule()
* schedule: encode/decode implemented + add to bacapp
* add safe encode/decode functions for timevalue, schedule function renaming
* fix unit tests build failing
* add IDEA and test temporary files to .gitignore
* try to make "deprecated" work in MSVC
* add WeeklySchedule compare function
* add bacnet_weeklyschedule_context_decode()
* Add basic test for WeeklySchedule
* Fix WeeklySchedule parsing and snprintf, decoder verified with real hardware
* try to fix windows build
* improve boolean parsing in 'bacapp_parse_application_data'
* add parse function for weekly schedule
* allow types > 16 in bacwp, show the decoded value before sending
* add bacapp binaries to gitignore
* remove bacwp logging
* Add error checking to bacapp_parse_application_data
* try to fix windows build
* fix avr build
* Fix error handling in RP Ack
* add singleDay flag
* show day name in single day weeklyschedule snprintf
* show weeklyschedule inner tag in snprintf
* improve weeklyschedule parsing and printing, supports type names now
* add weekly schedule to bacapp_decode_data
* move bacnet/bacnet_plat_compat.h to bacnet/basic/sys/platform.h
* disable tag limit also in bacwpm
* add ifdef's around strtoX helper functions in bacapp
* move strtox to BACAPP_PRINT_ENABLED ifdef in bacapp
* fix stm32 makefiles
* fix at91sam7s build
* use BACNET_UNSIGNED_INTEGER in BACnet_Short_Application_Data_Value
* fix capitalization in BACnet_Daily_Schedule
* add name to BACNET_TIME_VALUE struct
* change bacwp bacwpm to use bacapp_known_property_tag()
* fix some macros in bacdcode missing parentheses
* Remove dummy fields from BACNET_SHORT_APPLICATION_DATA_VALUE, replace remaining uses of upcasting (adds extra overhead but is maybe safer), rename short DV to Primitive
* fix new ci warnings
* more fixes for ancient C
* fix tests no longer building
* primitive value renamed to shorter name
- misprint in ports/zephyr/bip-init.c
- error processing PROP_TRACKING_VALUE for the Color Temperature object in
src/bacnet/bacapp.c
- misprint MSV test
- add hostnport.c for each zephyr tests
- fix colors and ms-input tests - remove mocking Device_Inc_Database_Revision()
for zephyr tests
- debug the color temperature test
* Fix EPICS property name proprietary range
* Fix Lighting Command decode length
* add function to determine property name and units proprietary range
* improve test coverage for AI, AO, AV, BI, BO, BV, LO
* refactor common property encoding to proplist module
* add decoder for priority array
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>