Skip to content

Commit d2a4990

Browse files
authored
Fixed missing objects in Basic Device. Added B-ASC sample. (#51)
* Added BACnet Application Specific Control (B-ASC) sample. * Added timer and audit-log objects to basic server.
2 parents 69f8aba + f02a0b2 commit d2a4990

File tree

15 files changed

+620
-7
lines changed

15 files changed

+620
-7
lines changed

CHANGELOG.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,18 @@ The git repository is hosted at the following site:
1515
### Security
1616

1717
### Removed
18-
* Removed BACnet basic objects and server framework into BACnet libraray
19-
and removed zephyr version.
18+
* Removed zephyr version of the BACnet basic objects and server framework
19+
and placed them into BACnet Protocol Stack library.
2020

2121
### Fixed
22+
* Fixed compile in BACnet/IP subsys using CONFIG_POSIX_API=y. (#47)
23+
* Fixed missing const in bip6-init.c and used zsock API.
24+
Replaced inet_ntoa with net_addr_ntop. Removed unnecessary select NET_SOCKETS_POSIX_NAMES. (#46)
25+
* Fixed the BACnet light override clear shell command. (#44)
26+
* Fixed our interface to Zephyr net manager API changes in v4.2.0. (#40)
27+
* Fixed samples: subsys: nvs: stm32 overlays fixup.
28+
Don't try to delete storage partitions that doesn't exist anymore. (#39)
29+
* Fixed warning from using FD_ISSET instead of ZSOCK_FD_ISSET. (#37)
2230
* Fixed readme for sample projects. Fixed JSON for bacnet objects
2331
sub command in shell. (#31)
2432
* Fixed network port object all datalink builds. (#26)
@@ -28,6 +36,8 @@ The git repository is hosted at the following site:
2836
to avoid stack overflow.
2937

3038
### Changed
39+
* Change the settings restore to load only BACnet settings by using
40+
bacnet_storage_handler.name feature.
3141
* Changed the number of sample board builds for twister to reduce minutes.
3242
* Changed pipeline to use container ghcr.io/zephyrproject-rtos/ci:v0.26-branch
3343
and build tests and samples using twister for Zephyr OS version 3.7 LTS
@@ -38,8 +48,14 @@ The git repository is hosted at the following site:
3848
* Changed gitignore to ignore the build folder.
3949

4050
### Added
51+
* Added BACnet Application Specific Control (B-ASC) sample. (#51)
52+
* Added timer and audit-log objects to basic server. (#51)
53+
* Added Model_Name config to the Kconfig for basic BACnet device. (#50)
4154
* Added KERNEL_VERSION_MAJOR check in samples DTS overlay files to handle
42-
changes in Zephyr OS version 4
55+
changes in Zephyr OS version 4. (#48)
56+
* Added shell command for lighting output overridden and tracking value. (#41)
57+
* Added BACnet zephyr shell for device date, time, and lighting
58+
output object. (#36)
4359
* Added BACDL ZIGBEE and BSC datalink defines to Kconfig & CMakeLists.txt (#35)
4460
* Added baclog, you-are, who-am-i, create-object, delete-object, write-group,
4561
bramfs, bsramfs, and color-rgb modules to cmake. (#35)

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ A device application demonstrating configuration of a
122122
[BACnet Lighting Supervisor (B-LS) device profile](./zephyr/samples/profiles/b-ls/README.rst)
123123
that can be used with any supported boards.
124124
125+
### Device Profile - BACnet Application Specific Controller (B-ASC)
126+
127+
A device application demonstrating configuration of a
128+
[BACnet Application Specific Controller (B-ASC) device profile](./zephyr/samples/profiles/b-asc/README.rst)
129+
that can be used with any supported boards.
130+
125131
# Coding Style and Guidelines
126132
127133
See Zephyr Project [Coding Guidelines](https://docs.zephyrproject.org/latest/contribute/coding_guidelines/index.html)

zephyr/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ set(BACNETSTACK_SRCS
9393
${BACNETSTACK_SRC}/bacnet/bacaddr.h
9494
${BACNETSTACK_SRC}/bacnet/bacapp.c
9595
${BACNETSTACK_SRC}/bacnet/bacapp.h
96+
${BACNETSTACK_SRC}/bacnet/bacaudit.c
97+
${BACNETSTACK_SRC}/bacnet/bacaudit.h
9698
${BACNETSTACK_SRC}/bacnet/bacdcode.c
9799
${BACNETSTACK_SRC}/bacnet/bacdcode.h
98100
${BACNETSTACK_SRC}/bacnet/bacdef.h
@@ -190,6 +192,7 @@ set(BACNETSTACK_SRCS
190192
${BACNETSTACK_SRC}/bacnet/basic/object/schedule.h
191193
${BACNETSTACK_SRC}/bacnet/basic/object/structured_view.h
192194
${BACNETSTACK_SRC}/bacnet/basic/object/time_value.h
195+
${BACNETSTACK_SRC}/bacnet/basic/object/timer.h
193196
${BACNETSTACK_SRC}/bacnet/basic/object/trendlog.h
194197
${BACNETSTACK_SRC}/bacnet/basic/service/h_alarm_ack.h
195198
${BACNETSTACK_SRC}/bacnet/basic/service/h_apdu.c
@@ -407,6 +410,8 @@ set(BACNETSTACK_SRCS
407410
${BACNETSTACK_SRC}/bacnet/secure_connect.h
408411
${BACNETSTACK_SRC}/bacnet/special_event.c
409412
${BACNETSTACK_SRC}/bacnet/special_event.h
413+
${BACNETSTACK_SRC}/bacnet/timer_value.c
414+
${BACNETSTACK_SRC}/bacnet/timer_value.h
410415
${BACNETSTACK_SRC}/bacnet/timestamp.c
411416
${BACNETSTACK_SRC}/bacnet/timestamp.h
412417
${BACNETSTACK_SRC}/bacnet/timesync.c
@@ -454,6 +459,7 @@ set(BACNETSTACK_BASIC_SRCS
454459
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_ANALOG_INPUT}>:${BACNETSTACK_SRC}/bacnet/basic/object/ai.c>
455460
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_ANALOG_OUTPUT}>:${BACNETSTACK_SRC}/bacnet/basic/object/ao.c>
456461
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_ANALOG_VALUE}>:${BACNETSTACK_SRC}/bacnet/basic/object/av.c>
462+
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_AUDIT_LOG}>:${BACNETSTACK_SRC}/bacnet/basic/object/auditlog.c>
457463
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_FILE}>:${BACNETSTACK_SRC}/bacnet/basic/object/bacfile.c>
458464
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_BINARY_INPUT}>:${BACNETSTACK_SRC}/bacnet/basic/object/bi.c>
459465
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_BINARY_OUTPUT}>:${BACNETSTACK_SRC}/bacnet/basic/object/bo.c>
@@ -484,6 +490,7 @@ set(BACNETSTACK_BASIC_SRCS
484490
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_SCHEDULE}>:${BACNETSTACK_SRC}/bacnet/basic/object/schedule.c>
485491
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_STRUCTURED_VIEW}>:${BACNETSTACK_SRC}/bacnet/basic/object/structured_view.c>
486492
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_TIME_VALUE}>:${BACNETSTACK_SRC}/bacnet/basic/object/time_value.c>
493+
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_TIMER}>:${BACNETSTACK_SRC}/bacnet/basic/object/timer.c>
487494
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECT_TRENDLOG}>:${BACNETSTACK_SRC}/bacnet/basic/object/trendlog.c>
488495
${BACNETSTACK_SRC}/bacnet/basic/service/h_alarm_ack.c
489496
${BACNETSTACK_SRC}/bacnet/basic/service/h_arf_a.c

zephyr/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,12 +655,24 @@ config BACNET_BASIC_OBJECT_TIME_VALUE
655655
help
656656
Use the BACnet basic time value object
657657

658+
config BACNET_BASIC_OBJECT_TIMER
659+
bool "Use the BACnet basic timer object"
660+
default false
661+
help
662+
Use the BACnet basic timer
663+
658664
config BACNET_BASIC_OBJECT_TRENDLOG
659665
bool "Use the BACnet basic trendlog object"
660666
default false
661667
help
662668
Use the BACnet basic trendlog object
663669

670+
config BACNET_BASIC_OBJECT_AUDIT_LOG
671+
bool "Use the BACnet basic audit log object"
672+
default false
673+
help
674+
Use the BACnet basic audit log object
675+
664676
config BACNET_BASIC_DEVICE_OBJECT_VERSION
665677
string "BACnet Device default Object Version string"
666678
default "1.0.0"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# @brief CMake for BACnet basic sample
2+
# @author Steve Karg <[email protected]>
3+
# @date November 2025
4+
# @copyright SPDX-License-Identifier: Apache-2.0
5+
6+
cmake_minimum_required(VERSION 3.13.1)
7+
8+
get_filename_component(MY_PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
9+
10+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
11+
project(${MY_PROJECT_NAME})
12+
13+
target_sources(app PRIVATE src/main.c)
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
.. _b-asc_sample:
2+
3+
BACnet Profile B-ASC Sample
4+
###########################
5+
6+
Overview
7+
********
8+
9+
This is a simple application demonstrating configuration of a
10+
BACnet Application Specific Controller (B-ASC) device profile.
11+
12+
L.4.3 BACnet Application Specific Controller (B-ASC)
13+
****************************************************
14+
15+
A B-ASC is a controller with limited resources relative to an
16+
Advanced Application Controller (B-AAC).
17+
A B-ASC is intended for use in a specific application
18+
and supports limited programmability.
19+
20+
Data Sharing
21+
************
22+
23+
* Ability to provide the values of any of its BACnet objects
24+
* Ability to allow modification of some or all of its BACnet
25+
objects by another device
26+
27+
Device and Network Management
28+
*****************************
29+
30+
* Ability to respond to queries about its status
31+
* Ability to respond to requests for information about any of its objects
32+
* Ability to respond to communication control messages
33+
34+
Requirements
35+
************
36+
37+
* A board with Ethernet support, for instance: nucleo_f429zi
38+
39+
Building and Running
40+
********************
41+
42+
This sample can be found under :bacnet_file:`samples/profiles/b-asc` in
43+
the BACnet tree.
44+
45+
The sample can be built for several platforms - use `west boards` to
46+
list the supported boards.
47+
48+
Compile this sample for the `nucleo_f429zi` board:
49+
50+
west build -b nucleo_f429zi -p always bacnet/zephyr/samples/profiles/b-asc/
51+
52+
Compile this sample for the `rpi_pico` board:
53+
54+
west build -b rpi_pico -p always bacnet/zephyr/samples/profiles/b-asc/
55+
56+
Compile this sample for the `adafruit_grand_central_m4_express` board with
57+
58+
west build -b adafruit_grand_central_m4_express -p always bacnet/zephyr/samples/profiles/b-asc/
59+
60+
Using the Shell
61+
***************
62+
63+
The shell is available on some boards via virtual communication port:
64+
65+
picocom --baud 115200 /dev/ttyACM0
66+
67+
Terminal ready
68+
*** Booting Zephyr OS build v3.7.1 ***
69+
uart:~$
70+
bacnet clear device devmem help history kernel net
71+
rem resize retval shell stats
72+
uart:~$ bacnet object list
73+
{"object-list": [
74+
{"object-identifier":{"device":260127}},
75+
{"object-identifier":{"analog-input":1}},
76+
{"object-identifier":{"analog-output":1}},
77+
{"object-identifier":{"analog-value":1}},
78+
{"object-identifier":{"audit-log":1}},
79+
{"object-identifier":{"binary-input":1}},
80+
{"object-identifier":{"binary-output":1}},
81+
{"object-identifier":{"binary-value":1}},
82+
{"object-identifier":{"multi-state-input":1}},
83+
{"object-identifier":{"multi-state-output":1}},
84+
{"object-identifier":{"multi-state-value":1}},
85+
{"object-identifier":{"network-port":1}},
86+
{"object-identifier":{"calendar":1}},
87+
{"object-identifier":{"integer-value":1}},
88+
{"object-identifier":{"life-safety-point":1}},
89+
{"object-identifier":{"load-control":1}},
90+
{"object-identifier":{"lighting-output":1}},
91+
{"object-identifier":{"channel":1}},
92+
{"object-identifier":{"binary-lighting-output":1}},
93+
{"object-identifier":{"color":1}},
94+
{"object-identifier":{"color-temperature":1}},
95+
{"object-identifier":{"file":1}},
96+
{"object-identifier":{"structured-view":1}},
97+
{"object-identifier":{"characterstring-value":1}},
98+
{"object-identifier":{"time-value":1}},
99+
{"object-identifier":{"timer":1}}],
100+
"object-list-size": 26}
101+
uart:~$
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (c) 2020 Google LLC.
3+
* Copyright (c) 2024 Daikin Comfort Technologies North America, Inc.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
&flash0 {
8+
partitions {
9+
compatible = "fixed-partitions";
10+
#address-cells = <1>;
11+
#size-cells = <1>;
12+
13+
boot_partition: partition@0 {
14+
label = "uf2";
15+
reg = <0x00000000 DT_SIZE_K(16)>;
16+
read-only;
17+
};
18+
19+
code_partition: partition@4000 {
20+
label = "code";
21+
reg = <0x4000 DT_SIZE_K(512-16-16)>;
22+
read-only;
23+
};
24+
25+
/*
26+
* The final 16 KiB is reserved for the application.
27+
* Storage partition will be used by FCB/LittleFS/NVS
28+
* if enabled.
29+
*/
30+
storage_partition: partition@7c000 {
31+
label = "storage";
32+
reg = <0x7c000 DT_SIZE_K(16)>;
33+
};
34+
};
35+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2022 STMicroelectronics
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#if KERNEL_VERSION_MAJOR < 4
7+
/delete-node/ &storage_partition;
8+
#endif
9+
10+
&flash0 {
11+
partitions {
12+
/* Set 48KB of storage at the beginning of bank2 in order to have 3 sectors smaller than 32K
13+
* (nvs.h: uint16_t sector_size)
14+
*/
15+
storage_partition: partition@100000 {
16+
label = "storage";
17+
reg = <0x000100000 DT_SIZE_K(48)>;
18+
};
19+
};
20+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2021 Yonatan Schachter
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&flash0 {
8+
reg = <0x10000000 DT_SIZE_M(2)>;
9+
10+
partitions {
11+
compatible = "fixed-partitions";
12+
#address-cells = <1>;
13+
#size-cells = <1>;
14+
15+
/* Reserved memory for the second stage bootloader */
16+
second_stage_bootloader: partition@0 {
17+
label = "second_stage_bootloader";
18+
reg = <0x00000000 0x100>;
19+
read-only;
20+
};
21+
22+
slot0_partition: partition@100 {
23+
label = "image-0";
24+
reg = <0x100 (DT_SIZE_M(1) - 0xF000)>;
25+
};
26+
27+
storage_partition: partition@1f9000 {
28+
label = "storage";
29+
reg = <0x1F9000 0x00007000>;
30+
};
31+
};
32+
};

0 commit comments

Comments
 (0)