Skip to content

Commit 297cd38

Browse files
authored
Increased the API for BACnet basic device configuration. (#29)
2 parents 78b993f + f021b81 commit 297cd38

File tree

9 files changed

+133
-139
lines changed

9 files changed

+133
-139
lines changed
Lines changed: 10 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Zephyr OS BACnet Sample Builds
1+
permissions:
2+
contents: read
3+
name: Zephyr OS Samples
24
# For Zephyr 3.7 LTS, use the v0.26-branch
35
# or the latest v0.26.x release Docker image.
46
# Docker image was built on Ubuntu 22.04
5-
67
on:
78
push:
89
branches: [ "default" ]
@@ -12,89 +13,8 @@ on:
1213
workflow_dispatch:
1314

1415
jobs:
15-
sample-hello-world:
16-
name: Build Hello BACnet Stack
17-
runs-on: ubuntu-22.04
18-
container: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
19-
env:
20-
CMAKE_PREFIX_PATH: /opt/toolchains
21-
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v4
24-
with:
25-
path: bacnet
26-
- name: Initialize
27-
working-directory: bacnet
28-
run: |
29-
west init -l .
30-
west update
31-
- name: Samples - Hello World
32-
working-directory: bacnet
33-
run: |
34-
pwd
35-
west build -p always -b native_posix ./zephyr/samples/hello_bacnet_stack
36-
- name: Archive Firmware
37-
uses: actions/upload-artifact@v4
38-
with:
39-
name: hello_bacnet_stack
40-
path: bacnet/build
41-
42-
sample-bacnet-profile-b-ss:
43-
name: Build BACnet Sample Profile B-SS
44-
runs-on: ubuntu-22.04
45-
container: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
46-
env:
47-
CMAKE_PREFIX_PATH: /opt/toolchains
48-
steps:
49-
- name: Checkout
50-
uses: actions/checkout@v4
51-
with:
52-
path: bacnet
53-
- name: Initialize
54-
working-directory: bacnet
55-
run: |
56-
west init -l .
57-
west update
58-
- name: Sample - BACnet Profile B-SS
59-
working-directory: bacnet
60-
run: |
61-
pwd
62-
west build -b nucleo_f429zi -p always ./zephyr/samples/profiles/b-ss
63-
- name: Archive Firmware
64-
uses: actions/upload-artifact@v4
65-
with:
66-
name: b-ss
67-
path: bacnet/build
68-
69-
sample-bacnet-profile-b-sa:
70-
name: Build BACnet Sample Profile B-SA
71-
runs-on: ubuntu-22.04
72-
container: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
73-
env:
74-
CMAKE_PREFIX_PATH: /opt/toolchains
75-
steps:
76-
- name: Checkout
77-
uses: actions/checkout@v4
78-
with:
79-
path: bacnet
80-
- name: Initialize
81-
working-directory: bacnet
82-
run: |
83-
west init -l .
84-
west update
85-
- name: Sample - BACnet Profile B-SA
86-
working-directory: bacnet
87-
run: |
88-
pwd
89-
west build -b nucleo_f429zi -p always ./zephyr/samples/profiles/b-sa
90-
- name: Archive Firmware
91-
uses: actions/upload-artifact@v4
92-
with:
93-
name: b-sa
94-
path: bacnet/build
95-
96-
sample-bacnet-profile-b-ld:
97-
name: Build BACnet Sample Profile B-LD
16+
test:
17+
name: Twister Tests
9818
runs-on: ubuntu-22.04
9919
container: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
10020
env:
@@ -109,40 +29,14 @@ jobs:
10929
run: |
11030
west init -l .
11131
west update
112-
- name: Sample - BACnet Profile B-LD
32+
- name: Twister Tests samples
11333
working-directory: bacnet
11434
run: |
11535
pwd
116-
west build -b nucleo_f429zi -p always ./zephyr/samples/profiles/b-ld
117-
- name: Archive Firmware
118-
uses: actions/upload-artifact@v4
119-
with:
120-
name: b-ld
121-
path: bacnet/build
36+
./samples.sh
12237
123-
sample-bacnet-profile-b-ls:
124-
name: Build BACnet Sample Profile B-LS
125-
runs-on: ubuntu-22.04
126-
container: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
127-
env:
128-
CMAKE_PREFIX_PATH: /opt/toolchains
129-
steps:
130-
- name: Checkout
131-
uses: actions/checkout@v4
132-
with:
133-
path: bacnet
134-
- name: Initialize
135-
working-directory: bacnet
136-
run: |
137-
west init -l .
138-
west update
139-
- name: Sample - BACnet Profile B-LS
140-
working-directory: bacnet
141-
run: |
142-
pwd
143-
west build -b nucleo_f429zi -p always ./zephyr/samples/profiles/b-ls
144-
- name: Archive Firmware
38+
- name: Archive Test Results
14539
uses: actions/upload-artifact@v4
14640
with:
147-
name: b-ls
148-
path: bacnet/build
41+
name: samples
42+
path: bacnet/twister-out.samples

.github/workflows/zephyr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
permissions:
2+
contents: read
13
name: Zephyr OS Tests
24
# For Zephyr 3.7 LTS, use the v0.26-branch
35
# or the latest v0.26.x release Docker image.

samples.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Set the path to the twister executable
4+
TWISTER_EXE="../zephyr/scripts/twister"
5+
6+
# Set the path to the test cases directory
7+
TEST_CASES_DIR="zephyr/samples"
8+
9+
# Set the output directory for test results
10+
OUTPUT_DIR="twister-out.samples"
11+
12+
# Remove the output directory
13+
rm -rf "$OUTPUT_DIR"
14+
15+
# Run twister with the specified test cases and output directory
16+
"$TWISTER_EXE" -O "$OUTPUT_DIR" -T "$TEST_CASES_DIR"
17+
18+
# Check if twister ran successfully
19+
if [ $? -eq 0 ]; then
20+
echo "Twister testing completed successfully."
21+
else
22+
echo "Twister testing failed."
23+
exit 1
24+
fi

zephyr/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ set(BACNETSTACK_SRCS
169169
${BACNETSTACK_SRC}/bacnet/basic/service/h_arf.h
170170
${BACNETSTACK_SRC}/bacnet/basic/service/h_awf.h
171171
${BACNETSTACK_SRC}/bacnet/basic/service/h_ccov.h
172+
${BACNETSTACK_SRC}/bacnet/basic/service/h_ccov.c
172173
${BACNETSTACK_SRC}/bacnet/basic/service/h_cov.c
173174
${BACNETSTACK_SRC}/bacnet/basic/service/h_cov.h
174175
${BACNETSTACK_SRC}/bacnet/basic/service/h_dcc.c
@@ -291,15 +292,18 @@ set(BACNETSTACK_SRCS
291292
${BACNETSTACK_SRC}/bacnet/datalink/bvlc6.h
292293
${BACNETSTACK_SRC}/bacnet/datalink/bvlc.h
293294
${BACNETSTACK_SRC}/bacnet/datalink/bvlc.c
295+
${BACNETSTACK_SRC}/bacnet/datalink/cobs.h
296+
${BACNETSTACK_SRC}/bacnet/datalink/cobs.c
294297
${BACNETSTACK_SRC}/bacnet/datalink/crc.h
295298
${BACNETSTACK_SRC}/bacnet/datalink/crc.c
296299
${BACNETSTACK_SRC}/bacnet/datalink/datalink.c
297300
${BACNETSTACK_SRC}/bacnet/datalink/datalink.h
301+
${BACNETSTACK_SRC}/bacnet/datalink/dlmstp.c
298302
${BACNETSTACK_SRC}/bacnet/datalink/dlmstp.h
299303
${BACNETSTACK_SRC}/bacnet/datalink/ethernet.h
304+
${BACNETSTACK_SRC}/bacnet/datalink/mstp.c
300305
${BACNETSTACK_SRC}/bacnet/datalink/mstp.h
301306
${BACNETSTACK_SRC}/bacnet/datalink/mstpdef.h
302-
${BACNETSTACK_SRC}/bacnet/datalink/mstp.h
303307
${BACNETSTACK_SRC}/bacnet/datalink/mstptext.c
304308
${BACNETSTACK_SRC}/bacnet/datalink/mstptext.h
305309
${BACNETSTACK_SRC}/bacnet/datetime.c
@@ -427,7 +431,6 @@ set(BACNETSTACK_BASIC_SRCS
427431
${BACNETSTACK_SRC}/bacnet/basic/service/h_arf_a.c
428432
${BACNETSTACK_SRC}/bacnet/basic/service/h_arf.c
429433
${BACNETSTACK_SRC}/bacnet/basic/service/h_awf.c
430-
${BACNETSTACK_SRC}/bacnet/basic/service/h_ccov.c
431434
${BACNETSTACK_SRC}/bacnet/basic/service/h_gas_a.c
432435
${BACNETSTACK_SRC}/bacnet/basic/service/h_get_alarm_sum.c
433436
${BACNETSTACK_SRC}/bacnet/basic/service/h_getevent_a.c
@@ -514,7 +517,6 @@ zephyr_compile_definitions(
514517
$<$<BOOL:${CONFIG_BACDL_MSTP}>:BACDL_MSTP>
515518
$<$<BOOL:${CONFIG_BACDL_ETHERNET}>:BACDL_ETHERNET>
516519
$<$<BOOL:${CONFIG_BACDL_CUSTOM}>:BACDL_CUSTOM>
517-
518520
# library features
519521
$<$<BOOL:${CONFIG_BACNET_BASIC_OBJECTS}>:BACNET_BASIC_OBJECTS>
520522
$<$<BOOL:${CONFIG_BACNET_PROPERTY_LISTS}>:BACNET_PROPERTY_LISTS=1>
@@ -526,6 +528,8 @@ zephyr_compile_definitions(
526528
MAX_ADDRESS_CACHE=${CONFIG_BACNET_MAX_ADDRESS_CACHE}
527529
MAX_CHARACTER_STRING_BYTES=${CONFIG_BACNET_MAX_CHARACTER_STRING_BYTES}
528530
MAX_OCTET_STRING_BYTES=${CONFIG_BACNET_MAX_OCTET_STRING_BYTES}
531+
$<$<BOOL:${CONFIG_BACNET_BASIC_COV_SUBSCRIPTIONS_SIZE}>:MAX_COV_SUBCRIPTIONS=${CONFIG_BACNET_BASIC_COV_SUBSCRIPTIONS_SIZE}>
532+
$<$<BOOL:${CONFIG_BACNET_BASIC_COV_ADDRESSES_SIZE}>:MAX_COV_ADDRESSES=${CONFIG_BACNET_BASIC_COV_ADDRESSES_SIZE}>
529533
# BACnet data types supported for WriteProperty: all = minimal + extra
530534
$<$<BOOL:${CONFIG_BACAPP_ALL}>:BACAPP_ALL>
531535
$<$<BOOL:${CONFIG_BACAPP_MINIMAL}>:BACAPP_MINIMAL>

zephyr/Kconfig

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,48 @@ config BACNET_BASIC_OBJECT_TRENDLOG
641641
help
642642
Use the BACnet basic trendlog object
643643

644+
config BACNET_BASIC_DEVICE_OBJECT_VERSION
645+
string "BACnet Device default Object Version string"
646+
default "1.0.0"
647+
help
648+
BACnet Device Object Version string
649+
650+
config BACNET_BASIC_DEVICE_OBJECT_NAME
651+
string "BACnet Device default Object Name string"
652+
default "BACnet Device"
653+
help
654+
BACnet Device Object Name string
655+
656+
config BACNET_BASIC_DEVICE_DESCRIPTION
657+
string "BACnet Device default Description string"
658+
default "BACnet Device"
659+
help
660+
BACnet Device default Description string
661+
662+
config BACNET_BASIC_DEVICE_LOCATION_NAME
663+
string "BACnet Device default Location Name string"
664+
default "BACnet Device"
665+
help
666+
BACnet Device default Location Name string
667+
668+
config BACNET_BASIC_COV_SUBSCRIPTIONS_SIZE
669+
int "BACnet Device maximum number of COV Subscriptions"
670+
default 0
671+
help
672+
BACnet Device maximum number of COV Subscriptions
673+
674+
config BACNET_BASIC_COV_ADDRESSES_SIZE
675+
int "BACnet Device maximum number of COV Addresses"
676+
default 0
677+
help
678+
BACnet Device maximum number of COV Addresses
679+
680+
config BACNET_BASIC_DEVICE_SERIAL_NUMBER
681+
string "BACnet Device default Serial Number string"
682+
default "BACnet Device"
683+
help
684+
BACnet Device default Serial Number string
685+
644686
# MINIMAL CONFIG_NET_RX_STACK_SIZE
645687
config NET_TX_STACK_SIZE
646688
int
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
sample:
22
name: BACnet Lighting Device (B-LD)
33

4+
common:
5+
platform_allow:
6+
- nucleo_f429zi
7+
build_only: true
8+
49
tests:
10+
511
bacnet-stack.sample.profile.b-ld.bacdl_none:
612
tags: bacnet
7-
platform_allow: qemu_x86 native_posix native_posix_64 native_sim
13+
814
bacnet-stack.sample.profile.b-ld.bacdl_mstp:
9-
platform_allow: native_sim
1015
extra_configs:
1116
- CONFIG_BACDL_MSTP=y
1217
tags: introduction
18+
1319
bacnet-stack.sample.profile.b-ld.bacdl_bip:
14-
platform_allow: native_sim
1520
extra_configs:
1621
- CONFIG_BACDL_BIP=y
1722
tags: introduction
23+
1824
bacnet-stack.sample.profile.b-ld.bacdl_bip6:
19-
platform_allow: native_sim
25+
skip: true
2026
extra_configs:
2127
- CONFIG_BACDL_BIP6=y
2228
tags: introduction
29+
2330
bacnet-stack.sample.profile.b-ld.bacdl_ethernet:
24-
platform_allow: native_sim
31+
skip: true
2532
extra_configs:
2633
- CONFIG_BACDL_ETHERNET=y
2734
tags: introduction
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
sample:
22
name: BACnet Lighting Supervisor (B-LS)
33

4+
common:
5+
platform_allow:
6+
- nucleo_f429zi
7+
build_only: true
8+
49
tests:
10+
511
bacnet-stack.sample.profile.b-ls.bacdl_none:
612
tags: bacnet
7-
platform_allow: qemu_x86 native_posix native_posix_64 native_sim
13+
814
bacnet-stack.sample.profile.b-ls.bacdl_mstp:
9-
platform_allow: native_sim
1015
extra_configs:
1116
- CONFIG_BACDL_MSTP=y
1217
tags: introduction
18+
1319
bacnet-stack.sample.profile.b-ls.bacdl_bip:
14-
platform_allow: native_sim
1520
extra_configs:
1621
- CONFIG_BACDL_BIP=y
1722
tags: introduction
23+
1824
bacnet-stack.sample.profile.b-ls.bacdl_bip6:
19-
platform_allow: native_sim
25+
skip: true
2026
extra_configs:
2127
- CONFIG_BACDL_BIP6=y
2228
tags: introduction
29+
2330
bacnet-stack.sample.profile.b-ls.bacdl_ethernet:
24-
platform_allow: native_sim
31+
skip: true
2532
extra_configs:
2633
- CONFIG_BACDL_ETHERNET=y
2734
tags: introduction

0 commit comments

Comments
 (0)