* 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
* Removed BACnet objects from ports/zephyr. There should only be datalink and OS related interfaces in OS ports.
* Added Kconfig and bacnet-config.h options in ports/zephyr to keep small footprint for MCUs having less RAM
* Changed ports/zephry for BACnet/IP and date-time with latest zephyr OS
* 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
* Added dependent BACnet stack headers into bacdef.h file.
* Changed bacdef.h and other stack includes in c/h files to have a common pattern.
* Moved bits.h, bytes.h, and bacnet_stack_exports.h under bacnet/basic/sys/ folder.
* [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>
* Require bacdeps.h as first bacnet header to include
BACnet headers need to pull in optional configuration and
optional ecosystem overrides to allow integrators to control
builds. This commit changes bacnet header files to first
include bacnet/bacdep.h to consistently introduce integrator
header files.
Verified by:
1. make clean all test
2. ./zephyr/scripts/twister -p unit_testing \
-T bacnet-stack/zephyr/tests/
* Migrate BACNET_UNSIGNED_INTEGER defn to bacdef.h
Verified by:
1. make clean all test
2. ./zephyr/scripts/twister -p unit_testing \
-T bacnet-stack/zephyr/tests/
---------
Signed-off-by: Gregory Shue <gregory.shue@legrand.com>
Co-authored-by: Greg Shue <32416235+gregshue@users.noreply.github.com>
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.
* Fix routing to a remote network in the router-mstp example.
The net, len and adr fields of remote_dest are not initialized
although they are used by the npdu_encode_pdu function in
case of "Routing to another Router". Thank you, Eugene!
* Fixed handling of received MS/TP extended frames.
mstp_port->DataLength should be set to the actual length of decoded data.
* Fix MSTP_Master_Node_FSM and MSTP_Slave_Node_FSM for extended frames.
BACNET_EXTENDED_DATA frames should be treated the same as
their corresponding BACNET_DATA frames.
* Fixed MSTP COBS frame encoding
cobs_frame_encode writes the encoded data to the
beginning of the buffer, overwriting the frame header.
The frame header is constructed before COBS frame encoding,
so it contains the wrong Frame Type and Data Length.
* Added extended frame client unit test
* Fix router-ipv6 application for remote networks
* 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
* 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
* bi.c: add possibility to set custom object names
Add an array of MAX_BINARY_INPUTS values containing the custom object
names.
When calling Binary_Input_Object_Name, if no custom name has been set,
return a string with the object type and the object instance number.
Otherwise, return the custom object name.
When setting the object name, first check that the string is not NULL,
then set the name in the new array.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* bi.c: add possibility to set custom description
Implement functions Binary_Input_Description and
Binary_Input_Description_Set. Binary_Input_Description will return an
empty string if no custom description has been set yet.
In order to store the custom descriptions, we declare a new array with
MAX_BINARY_INPUTS amount of values.
When setting a new description using Binary_Input_Description_Set, we
first check that the new description is not NULL and then store it in
array at the object_instance position.
In the Binary_Input_Read_Property function, we need to split
PROP_DESCRIPTION from PROP_OBJECT_NAME in the switch case as before the
object name would be returned when the description was being read by a
client. Now we properly call Binary_Input_Description.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---------
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Co-authored-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* ao.c: set proper bounds for Analog_Output_Present_Value_Write
The lower and upper bounds to the value passed to this function were
hard-coded to 0 and 100 respectively. This meant that a client was not
able to write a value outside of these bounds, regardless of the values
of `Min_Pres_Value` and `Max_Pres_Value`.
Now properly compare the new value against `Min_Pres_Value` and
`Max_Pres_Value` and only return `ERROR_CODE_VALUE_OUT_OF_RANGE` when it
is outside of this range.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* ao.c: make Analog_Output_Present_Value_Set return 0 when out of range
Compare the new value passsed to `Analog_Output_Present_Value_Set`
against `Min_Pres_Value` and `Max_Pres_Value`. If the new value is
outside of these bounds, don't update the present value and return false.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---------
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Co-authored-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* 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
* ai.c: add possibility to set a custom object name
The Name_Set function is already declared in the header but not
implemented. With this implementation, one can set a custom object name
from a server application.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* av.c: add possibility to set a custom object name
The Name_Set function is already declared in the header but not
implemented. With this implementation, one can set a custom object name
from a server application.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* ai.c: implement function to set custom description
For now the hard-coded behaviour was to return the object name whenever
a client requested the value for the description.
Therefore implement the functions Description and Description_Set already
declared in the header and add a Description property to the data
structure used. We also need to properly implement PROP_DESCRIPTION in
the Read_Property function.
This way we can set and read a custom decsription from a server application
and send the appropriate response to a read-property request asking for
PROP_DESCRIPTION.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* av.c: implement function to set custom description
For now the hard-coded behaviour was to return the object name whenever
a client requested the value for the description.
Therefore implement the functions Description and Description_Set already
declared in the header and add a Description property to the data
structure used. We also need to properly implement PROP_DESCRIPTION in
the Read_Property function.
This way we can set and read a custom decsription from a server application
and send the appropriate response to a read-property request asking for
PROP_DESCRIPTION.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* ai.c: implement function to set custom units
Implement the object functions related to Units already declared in the
header.
By default Analog Inputs will have the Unit UNITS_PERCENT. Add
functionality to be able to set and read custom units from a server
application.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
* av.c: implement function to set custom units
Implement the object functions related to Units already declared in the
header.
By default Analog Values will have the Unit UNITS_NO_UNIT. Add
functionality to be able to set and read custom units from a server
application.
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
---------
Signed-off-by: Sebastian Weyer <sebastian.weyer@smile.fr>
Co-authored-by: Sebastian Weyer <sebastian.weyer@smile.fr>