diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0f667b..9518dd3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,7 @@ -# Build the B-BC example against the CAS BACnet Stack STATIC library and publish a GitHub -# Release (binaries + metrics.json) when a vX.Y.Z tag is pushed. PRs and pushes to main run -# the same build + smoke test without publishing. +# Build the B-BC example and publish a GitHub Release (binaries + metrics.json) when a +# vX.Y.Z tag is pushed. PRs and pushes to main run the same build + smoke test without +# publishing. The build is exactly what README.md tells a customer to run: plain CMake in +# the adapter's default SOURCE mode, which compiles the stack into the executable. # # The CAS BACnet Stack is a PRIVATE git submodule: the repository secret CAS_STACK_PAT must # hold a PAT with read access to chipkin/cas-bacnet-stack. @@ -29,12 +30,10 @@ jobs: - os: windows-2022 artifact: BACnetExampleBBC-windows-x64 exe: build/Release/BACnetExampleBBC.exe - lib: submodules/cas-bacnet-stack/bin/CASBACnetStack_x64_Release.lib metrics: metrics-windows.json - os: ubuntu-latest artifact: BACnetExampleBBC-linux-x64 exe: build/BACnetExampleBBC - lib: submodules/cas-bacnet-stack/bin/libCASBACnetStack_x64_Release.a metrics: metrics-linux.json steps: - name: Enable git long paths (Windows) @@ -47,52 +46,23 @@ jobs: submodules: recursive token: ${{ secrets.CAS_STACK_PAT || github.token }} - - name: Stack commit (cache key) + - name: Stack commit (recorded in metrics.json) id: stack shell: bash run: echo "sha=$(git -C submodules/cas-bacnet-stack rev-parse HEAD)" >> "$GITHUB_OUTPUT" - # The static library depends only on the stack commit, so it is cached on that SHA. - # A moved pin therefore always rebuilds it - a stale library against a new header is - # an ABI mismatch that links and misbehaves. - - name: Restore the prebuilt static library - id: libcache - uses: actions/cache@v4 - with: - path: submodules/cas-bacnet-stack/bin - key: cas-stack-static-${{ runner.os }}-${{ steps.stack.outputs.sha }} - - - name: Build the CAS BACnet Stack static library (ReleaseLib, customer surface only) - if: steps.libcache.outputs.cache-hit != 'true' - shell: bash - run: | - set -e - if [ "$RUNNER_OS" = "Windows" ]; then - # microsoft/setup-msbuild's PATH update does not reach this Git-Bash step - # (msbuild: command not found even after that step ran), so resolve it - # directly the same way tools/build-stack-static.sh does locally. - vswhere='/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe' - MSBUILD=$("$vswhere" -latest -requires Microsoft.Component.MSBuild -find 'MSBuild\**\Bin\MSBuild.exe' | head -1) - # The vcxproj names PlatformToolset=v145; windows-2022 only carries the VS 2022 - # v143 build tools, so force v143 (MSB8020 otherwise: "build tools for v145 ... - # cannot be found"). CMake's own "Visual Studio 17 2022" generator resolves to - # the same v143 toolset on this runner, so the two stay compiler-matched. - "$MSBUILD" submodules/cas-bacnet-stack/projects/msvs/CASBACnetStack/CASBACnetStack.vcxproj -p:Configuration=ReleaseLib -p:Platform=x64 -p:PlatformToolset=v143 -m -v:minimal - else - make -C submodules/cas-bacnet-stack/projects/linux/Release/x64 -j"$(nproc)" all - make -C submodules/cas-bacnet-stack/projects/linux/Release/x64 install - fi - ls -l "${{ matrix.lib }}" - - - name: Configure (STATIC link mode) - run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCAS_BACNET_STACK_LINK=STATIC + - name: Configure + run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release + # The README documents `cmake -B build -S .` with no link-mode flag, so assert the + # adapter's default really is SOURCE. If that default ever changes, the documented + # build silently starts needing a prebuilt library and fails for customers first. - name: Confirm the link mode CMake actually used shell: bash run: | mode=$(grep -E '^CAS_BACNET_STACK_LINK:' build/CMakeCache.txt | cut -d= -f2) echo "CAS_BACNET_STACK_LINK=$mode" - [ "$mode" = "STATIC" ] || { echo "FAIL: expected STATIC, got '$mode'"; exit 1; } + [ "$mode" = "SOURCE" ] || { echo "FAIL: expected SOURCE, got '$mode'"; exit 1; } - name: Build run: cmake --build build --config Release @@ -128,7 +98,7 @@ jobs: "example": "BACnetExampleBBC", "app_version": "$appver", "os": "${{ matrix.os }}", - "link_mode": "STATIC", + "link_mode": "SOURCE", "stack_commit": "${{ steps.stack.outputs.sha }}", "stack_version": "$stackver", "binary_bytes": $bytes, @@ -147,7 +117,8 @@ jobs: run: | mkdir -p dist cp "${{ matrix.exe }}" "${{ matrix.metrics }}" dist/ - cp README.md LICENSE dist/ 2>/dev/null || true + cp README.md TUTORIAL.md LICENSE dist/ 2>/dev/null || true + cp docs/PICS.md dist/ 2>/dev/null || true - name: Upload build artifact uses: actions/upload-artifact@v4 diff --git a/AGENTS.md b/AGENTS.md index 6215a6d..b77596c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,22 +2,21 @@ Guidance for AI coding agents working in this repository. See for the format. Human contributors should read -[README.md](README.md) first. +[README.md](README.md) first, then [TUTORIAL.md](TUTORIAL.md). ## What this project is A **tutorial** C++ example that implements **as much of** the BACnet **B-BC (Building Controller)** profile as the standard CAS BACnet Stack supports. It -is the series **capstone** - one git repo per BACnet profile - grafting -together features already proven by six sibling examples (commandable -outputs, DeviceCommunicationControl, intrinsic alarming, a writable -event-recipient list, time synchronisation, ReinitializeDevice, Backup and -Restore, external-write scheduling) plus one genuinely new feature this -example defines: **trending** (Trend Log, Trend Log Multiple, ReadRange). -What B-BC requires but the stack cannot yet do, or a defect the stack has, -is documented in [TODO.md](TODO.md) - keep that file honest and current. The -top priority is that the code reads like a tutorial a customer can learn -from and copy-paste. Favour clarity over cleverness. +is the series' largest single example - combining commandable outputs, +DeviceCommunicationControl, intrinsic alarming, a writable event-recipient +list, time synchronisation, ReinitializeDevice, Backup and Restore, external- +write scheduling (SCHED-E-B), and trending (Trend Log, Trend Log Multiple, +ReadRange). What B-BC requires but the stack cannot yet do, or a defect the +stack has, is documented in [TODO.md](TODO.md) and [TUTORIAL.md](TUTORIAL.md) +- keep both honest and current. The top priority is that the code reads like +a tutorial a customer can learn from and copy-paste. Favour clarity over +cleverness. ## Layout @@ -25,34 +24,44 @@ This repository is self-contained: - `main.cpp` - the example device. - `common/` - the shared helper (vendored). +- `README.md` - what this example is. Keep it short and about THIS example + only. +- `TUTORIAL.md` - how to extend and review the example, including every + known silent-failure trap and this example's filed stack gaps. Long-form + material that would bloat the README belongs here. +- `docs/PICS.md` - the Protocol Implementation Conformance Statement. Its + objects-and-properties section is GENERATED from `docs/objects.json`; do + not hand-edit between the `OBJECTS-PROPERTIES` markers. +- `docs/objects.json` - the input to that generator. Update it in the same + change as any `main.cpp` change that adds an object or a `GetProperty*` + branch. The Device object's entry must stay first. - `submodules/cas-bacnet-stack/` - the **CAS BACnet Stack** as a git submodule (private; compiled from source). After cloning, run `git submodule update --init --recursive`. +The `PROFILE-TABLE` block in README.md is also generated, from the +example-series repository's `docs/profile-table.md`. Edit it there, not here, +and re-sync with `./tools/sync-profile-table.sh BACnetProfileExample-B-BC-CPP` +(always with the repo argument - omitting it rewrites every sibling repo). + ## Build -This example links the CAS BACnet Stack as a prebuilt **STATIC** library (the -only mode it ships in - see the README's "Link mode" section): +Plain CMake, identical on every platform, in the adapter's default SOURCE mode +(the stack's sources are compiled into the executable - no prebuilt library, no +DLL, no per-platform pre-step): ```bash git submodule update --init --recursive # once, if not cloned with --recursive -tools/build-stack-static.sh BACnetProfileExample-B-BC-CPP # from the series root -cmake -B build -S . -DCAS_BACNET_STACK_LINK=STATIC +cmake -B build -S . cmake --build build --config Release ``` -The stack library build takes several minutes the first time - it compiles -the whole stack (~600 files) once, via the stack's own project files; the -example itself then builds in seconds against that library. Use -`-D CAS_STACK_DIR=...` only if your stack lives outside the bundled -submodule. - -**Toolset note for a machine with multiple Visual Studio installs:** if -linking fails with `LINK : fatal error C1900: Il mismatch`, the stack -library and the example were built with different physical compiler copies. -Pass `TOOLSET=` and -`MSBUILD=` to `build-stack-static.sh` to -pin both builds to the same copy. +The first build compiles the whole stack (~600 files) and takes a few minutes; +rebuilds after that are incremental and fast. Use `-D CAS_STACK_DIR=...` only if +your stack lives outside the bundled submodule. Do not reintroduce a link-mode +flag, `tools/build-stack-static.sh`, or a series-root build script into the +documented build: a customer downloads this repository on its own and must be +able to build it with the two commands above. ## Run @@ -61,27 +70,24 @@ pin both builds to the same copy. .\build\Release\BACnetExampleBBC.exe [--port 47808] [--deviceID 389005] # Windows ``` -Interactive keys while running: `h` help, `q` quit, up/down nudge Analog Input 1, -`s` advance Schedule 1 (Saffron) to a transition right now. +Interactive keys while running: `h` help, `q` quit, up/down nudge Analog +Input 1, `s` advance Schedule 1 (Saffron) to a transition right now. ## Conventions - Device is named "Rainbow"; objects use the series' colour names; vendor id 389. - Implement the B-BC services the stack supports; expose **every required property** of each object for Protocol_Revision 24. Anything B-BC requires - that is NOT implemented must be listed in [TODO.md](TODO.md) and the README. -- Intrinsic alarming, commandable outputs, DeviceCommunicationControl, time - sync and ReinitializeDevice follow the same patterns as B-AAC (this - example's seed) - see its own AGENTS.md if working on those sections. -- **Trending (new in this example):** `BACnetStack_AddTrendLogObject` / - `AddTrendLogMultipleObject` + `AddLoggedObjectToTrendLogMultiple` + - `SetTrendLogTypeToPolled` create and drive a Trend Log; the stack stores - and serves almost everything (`Enable`, `Buffer_Size`, `Log_Buffer`, - `Record_Count`, etc.) - only `Object_Name` needs an app callback. - `Log_Buffer` is **ReadRange-only** (a plain ReadProperty is rejected). - **KNOWN STACK DEFECT:** calling `SetTrendLogStartStopTime` on a Trend Log - (not Trend Log Multiple) reproducibly blocks `Record_Count` from ever - incrementing - filed as + that is NOT implemented must be listed in [TODO.md](TODO.md) and + [TUTORIAL.md](TUTORIAL.md). +- **Trending:** `BACnetStack_AddTrendLogObject` / `AddTrendLogMultipleObject` + + `AddLoggedObjectToTrendLogMultiple` + `SetTrendLogTypeToPolled` create and + drive a Trend Log; the stack stores and serves almost everything (`Enable`, + `Buffer_Size`, `Log_Buffer`, `Record_Count`, etc.) - only `Object_Name` + needs an app callback. `Log_Buffer` is **ReadRange-only** (a plain + ReadProperty is rejected). **KNOWN STACK DEFECT:** calling + `SetTrendLogStartStopTime` on a Trend Log (not Trend Log Multiple) + reproducibly blocks `Record_Count` from ever incrementing - filed as [cas-bacnet-stack#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051). Don't "fix" this by silently dropping the call from Lilac - it demonstrates correct API usage on purpose; Magenta (which never calls it) is the working @@ -106,8 +112,12 @@ Interactive keys while running: `h` help, `q` quit, up/down nudge Analog Input 1 the four Prepare/Complete Backup/Restore callbacks + `ReadFile`/`WriteFile` callbacks on File 1 (Ivory); `ReinitializeDevice` must accept states 2-6 (STARTBACKUP..ABORTRESTORE) as well as COLDSTART/WARMSTART. -- Match the surrounding code style: `const`-correct parameters, check every stack - return value, keep `main.cpp` linear and well-commented. +- An OPTIONAL property needs `BACnetStack_SetPropertyEnabled`, not just a + `GetProperty*` callback branch - the stack checks whether a property is + enabled before it ever calls your callback. This example shipped that exact + bug once for the Device's `Description`. See TUTORIAL.md. +- Match the surrounding code style: `const`-correct parameters, check every + stack return value, keep `main.cpp` linear and well-commented. - **Never edit `common/` in this repo alone** - it is a vendored copy shared by every example in the series, with its own version (`COMMON_VERSION`) and changelog (`common/CHANGELOG.md`). To change it: edit, bump the version, add @@ -142,6 +152,10 @@ There are no unit tests; verification is behavioural: 9. **Device management**: ReinitializeDevice WARMSTART SimpleACKs; DCC `disable-initiation`/`enable` SimpleACK; a wrong password (if set) is rejected. +10. If you changed the objects or their properties, regenerate + `docs/PICS.md` (`python tools/gen-objects-properties.py + BACnetProfileExample-B-BC-CPP` from the series root) and confirm no row + comes out flagged with ⚠. Verification is manual (no in-repo test suite ships). @@ -152,6 +166,5 @@ then tag `vX.Y.Z`. The GitHub Actions workflow builds and publishes the release. ## License -The example source code is dedicated to the public domain under -[CC0-1.0](LICENSE). The CAS BACnet Stack is a separate, commercially licensed -product and is not covered by that dedication. +See [LICENSE](LICENSE). The CAS BACnet Stack is a separate, commercially +licensed product and is not covered by it. diff --git a/CHANGELOG.md b/CHANGELOG.md index 172990a..b6f91ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Restructured documentation to match the series' shared shape: `README.md` + is cut down to what this example is and how to build/run/verify it; + `TUTORIAL.md` (new) carries the extending/reviewing material and every + silent-failure trap and filed stack gap (SetTrendLogStartStopTime blocking + Lilac's Record_Count - #2051, the AddTrendLogObject log flood - #2050, the + SCHED-E-B remote-write test-topology limitation, and the Calendar Date_List + gap - #963); `docs/PICS.md` (new) is the ANSI/ASHRAE 135 Annex A conformance + statement, generated in part from `docs/objects.json`. +- `docs/objects.json` gained a `Device` entry (previously the generated tables + omitted the Device object). +- Build documentation switched from the prebuilt **STATIC** library + (`tools/build-stack-static.sh` + `-DCAS_BACNET_STACK_LINK=STATIC`) to the + adapter's default **SOURCE** mode: `cmake -B build -S .` then + `cmake --build build --config Release`, identical on every platform, no + series-root script or prebuilt library step. `.github/workflows/release.yml` + dropped the static-library cache/build steps and the matrix `lib:` entries, + configures without a link-mode flag, asserts `CAS_BACNET_STACK_LINK=SOURCE`, + records `"link_mode": "SOURCE"` in the published metrics, and packages + `TUTORIAL.md` / `docs/PICS.md` alongside the binary. The published v1.0.0 + footprint numbers were measured under the STATIC build; the next release + refreshes them under the SOURCE build documented here. +- `main.cpp`'s `CHANGE ALL OF THIS BEFORE YOU SHIP` block gained a per-field + comment for every ship-checklist item, including the `DEVICE_NAME` + uniqueness warning. + ## [1.0.0] - 2026-09-15 ### Added diff --git a/CMakeLists.txt b/CMakeLists.txt index 324f139..ca56d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,16 +3,15 @@ # # This example links the CAS BACnet Stack through the CASBACnetStack::Adapter CMake # target (submodules/cas-bacnet-stack/adapters/cpp) and calls the stack's C API -# (BACnetStack_*, via CASBACnetStackAdapter.h) directly. This example builds and -# ships in STATIC mode: CAS_BACNET_STACK_LINK=STATIC links a prebuilt -# CASBACnetStack_x64_Release.lib / libCASBACnetStack_x64_Release.a, built first by -# tools/build-stack-static.sh from the stack's own project files. (The adapter also -# offers a SOURCE mode that compiles the stack's source/ straight into the -# executable with no separate library build; this example is not built that way.) +# (BACnetStack_*, via CASBACnetStackAdapter.h) directly. It builds and ships in the +# adapter's default SOURCE mode: the stack's source/*.cpp are compiled straight into +# the executable, so there is no library or DLL to build, ship, or install first and +# the build is the same two commands on every platform. (The adapter also offers +# STATIC and DLL modes - see its CMakeLists.txt - but they need a prebuilt library +# and this example does not use them.) # # Build: -# tools/build-stack-static.sh BACnetProfileExample-B-BC-CPP (from the series root) -# cmake -B build -S . -DCAS_BACNET_STACK_LINK=STATIC +# cmake -B build -S . # cmake --build build --config Release --parallel # Run (from the example folder): # ./build/BACnetExampleBBC (Linux/macOS) @@ -60,8 +59,9 @@ endif() # --- The CAS BACnet Stack, via its CMake adapter target --------------------- # CAS_BACNET_STACK_LINK is the adapter's own cache variable (SOURCE/STATIC/DLL, -# default SOURCE) - set it BEFORE add_subdirectory() so the adapter target picks it up. -# See submodules/cas-bacnet-stack/adapters/cpp/CMakeLists.txt for what each mode does. +# default SOURCE, which is what this example builds with). To override it, set it +# BEFORE add_subdirectory() so the adapter target picks it up. See +# submodules/cas-bacnet-stack/adapters/cpp/CMakeLists.txt for what each mode does. add_subdirectory("${CAS_STACK_DIR}/adapters/cpp" cas-bacnet-stack-adapter) # --- The shared example helper ---------------------------------------------- diff --git a/README.md b/README.md index 7f8ef35..b1203a3 100644 --- a/README.md +++ b/README.md @@ -3,48 +3,40 @@ A tutorial example showing how to implement **as much of the BACnet B-BC (Building Controller)** device profile as the [CAS BACnet Stack](https://store.chipkin.com/services/stacks/bacnet-stack) -supports today, in C++. This is the series **capstone** - the largest single -profile - combining every shared feature already proven by sibling examples -(commandable outputs, DeviceCommunicationControl, intrinsic alarming, a -writable event-recipient list, time synchronisation, ReinitializeDevice, -Backup and Restore, a Schedule that writes a remote object) plus one genuinely -new capability this example **defines** for the series: **trending** (Trend -Log, Trend Log Multiple, and ReadRange). +supports today, in C++. This is the largest single profile in the CAS BACnet +Stack example set: commandable outputs, DeviceCommunicationControl, intrinsic +alarming with a writable event-recipient list, time synchronisation, +ReinitializeDevice, Backup and Restore, a Schedule that writes a **remote** +device's object (SCHED-E-B), and **trending** (Trend Log, Trend Log Multiple, +and ReadRange). It listens on **BACnet/IP (UDP 47808)** and claims only B-BC. -Part of the CAS BACnet Stack **BACnet profile example series** - one repository -per BACnet device profile. This example claims **only** B-BC. +**[Download a prebuilt binary](https://github.com/chipkin/BACnetProfileExample-B-BC-CPP/releases)** +(Windows and Linux x64) - or build it yourself, see [Build](#build) below. + +- **[TUTORIAL.md](TUTORIAL.md)** - how to extend this example and how to review + it for conformance. Read it when you start turning this into your own device. +- **[docs/PICS.md](docs/PICS.md)** - the Protocol Implementation Conformance + Statement: every object, every property, and who answers it. > **Versions:** this document describes **example v1.0.0**, built and verified -> against **CAS BACnet Stack 6.0.21 (`6.x` @ `abd4cee1`)**, linked as a static -> library, at **Protocol_Revision 24**, with the vendored `common/` helper at -> **v2.5.0**. Running the example prints all three - if what it prints disagrees -> with this line, trust the program and check `CHANGELOG.md`. +> against **CAS BACnet Stack 6.0.21** (`6.x` @ `abd4cee1`), at +> **Protocol_Revision 24**, with the vendored `common/` helper at **v2.5.0**. +> Running the example prints all three - if what it prints disagrees with this +> line, trust the program and check `CHANGELOG.md`. > **B-BC is not fully claimable with the standard stack yet.** This example > implements every B-BC capability the standard CAS BACnet Stack exposes, and -> clearly marks what it cannot do. **See [TODO.md](TODO.md)**. In summary: Trend -> Log 1 ("Lilac") demonstrates `SetTrendLogStartStopTime`'s correct usage but a -> confirmed stack defect ([#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051)) -> leaves its `Record_Count` at 0 - Trend Log Multiple 1 ("Magenta") is the -> live-verified, working polled-logging + ReadRange demonstration instead; -> `AddTrendLogObject` also causes a non-fatal internal log flood +> clearly marks what it cannot do - see [TUTORIAL.md](TUTORIAL.md) and +> [TODO.md](TODO.md). In summary: Trend Log 1 ("Lilac") demonstrates +> `SetTrendLogStartStopTime`'s correct usage but a confirmed stack defect +> ([#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051)) leaves its +> `Record_Count` at 0 - Trend Log Multiple 1 ("Magenta") is the live-verified, +> working polled-logging + ReadRange demonstration instead; `AddTrendLogObject` +> also causes a non-fatal internal log flood > ([#2050](https://github.com/chipkin/cas-bacnet-stack/issues/2050)); Calendar 1 -> ("Cream")'s `Date_List` cannot be populated (issue #963, inherited from every -> prior example that carries a Calendar); and Schedule 1's SCHED-E-B remote -> write is correctly wired but not wire-verified cross-instance in this -> session's single-host test topology. - -This example is grafted together from six sibling examples, each already -proven: [B-SA](https://github.com/chipkin/BACnetProfileExample-B-SA-CPP) -(commandable outputs), [B-ASC](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP) -(DeviceCommunicationControl), [B-AAC](https://github.com/chipkin/BACnetProfileExample-B-AAC-CPP) -(the seed: intrinsic alarming, a writable recipient list, time sync, -ReinitializeDevice, internal scheduling), [B-LSC](https://github.com/chipkin/BACnetProfileExample-B-LSC-CPP) -(confirmed: its own ReinitializeDevice is unchanged from B-AAC/B-ASC, so no -separate graft was needed there), [B-ACC](https://github.com/chipkin/BACnetProfileExample-B-ACC-CPP) -(Backup and Restore), and [B-LS](https://github.com/chipkin/BACnetProfileExample-B-LS-CPP) -(external-write scheduling). Trending (Trend Log / Trend Log Multiple / -ReadRange) is new here. +> ("Cream")'s `Date_List` cannot be populated (issue #963); and Schedule 1's +> SCHED-E-B remote write is correctly wired but was not wire-verified +> cross-instance in a single-host test topology. ## What is a B-BC (Building Controller) profile? @@ -53,13 +45,10 @@ A B-BC is the flagship BACnet controller: it serves and commands data, **remote** device's object, **trends** values over time, **synchronises time**, accepts **DeviceCommunicationControl** and **ReinitializeDevice**, and supports **Backup and Restore**. Required BIBBs at Protocol_Revision 24: - `DS-RP-A,B, DS-RPM-A,B, DS-WP-A,B, DS-WPM-B; AE-N-I-B, AE-ACK-B, AE-INFO-B, AE-CRL-B; SCHED-E-B; T-VMT-I-B, T-ATR-B; DM-DDB-A,B, DM-DOB-B, DM-DCC-B, -DM-TS-B (or DM-UTC-B), DM-RD-B, DM-BR-B`. - -**Deliberately omitted:** AE-ESUM-B (GetAlarmSummary) is not required at or -above Protocol_Revision 13. +DM-TS-B (or DM-UTC-B), DM-RD-B, DM-BR-B`. AE-ESUM-B (GetAlarmSummary) is +deliberately omitted - it is not required at or above Protocol_Revision 13. ## The device this example creates @@ -75,193 +64,205 @@ Analog Value 1 "Diamond" (REAL, WRITABLE; intrinsic OutOfRange ala Notification Class 1 "Crimson" (routes Diamond's alarms; Recipient_List WRITABLE) Network Port 1 "Vermilion" (BACnet/IP - required) Schedule 1 "Saffron" (drives Chartreuse locally AND a remote peer - SCHED-E-B) -Calendar 1 "Cream" (see TODO.md - Date_List not evaluated) +Calendar 1 "Cream" (see TUTORIAL.md - Date_List not evaluated) File 1 "Ivory" (backup/restore payload - DM-BR-B) -Trend Log 1 "Lilac" (polls Bronze; see TODO.md for a known gap) +Trend Log 1 "Lilac" (polls Bronze; see TUTORIAL.md for a known gap) Trend Log Multiple 1 "Magenta" (polls Bronze/Diamond/Chartreuse - the working demo) ``` -## Intrinsic alarming (inherited from B-AAC) - -Analog Value 1 ("Diamond") has an intrinsic OutOfRange algorithm armed -(10-90% band). A WriteProperty of `Present_Value` outside that band fires an -`EventNotification` to Notification Class 1 ("Crimson")'s recipients -(AE-N-I-B); AcknowledgeAlarm (AE-ACK-B) and GetEventInformation (AE-INFO-B) -are accepted; Crimson's `Recipient_List` is WRITABLE (AE-CRL-B), so a client -can redirect it at run time. **Verified live this session:** writing `95.0` -transitions `Event_State` to `high-limit`. - -## Scheduling (SCHED-E-B) - -Schedule 1 ("Saffron") writes **two** targets on every transition - -`List_Of_Object_Property_References` has two entries (each -`BACnetStack_AddScheduleObjectPropertyReference` call appends, per the stack -header's own doc comment): a **local** one at Analog Output 1 (Chartreuse) -`Present_Value` (inherited from B-AAC's internal scheduling, proven), and a -**remote** one at a peer device's Analog Output 1 (default target instance -389002, e.g. a locally-built [B-SA-CPP](https://github.com/chipkin/BACnetProfileExample-B-SA-CPP)) - -this is what makes it SCHED-E-B rather than SCHED-I-B. The remote write's -mechanism (a `refDeviceInstance` other than this device's own instance, which -the header documents as adding that device to the stack's own Device Address -Binding table) is correct, documented, customer-facing API usage, but was -**not** wire-verified end-to-end this session: two example instances on this -one host had to run on different UDP ports to avoid a bind conflict, and -BACnet/IP broadcast Who-Is/I-Am does not cross ports, so Device Address -Binding cannot resolve the peer in that topology. See TODO.md item 3. - -## Trending (T-VMT-I-B / T-ATR-B) - new in this example - -Trend Log 1 ("Lilac", type 20) polls Analog Input 1 (Bronze)'s `Present_Value` -every second (`BACnetStack_AddTrendLogObject` + `SetTrendLogTypeToPolled`). -Trend Log Multiple 1 ("Magenta", type 27) polls three points every second: -Bronze, Diamond and Chartreuse (`BACnetStack_AddTrendLogMultipleObject` + -three `AddLoggedObjectToTrendLogMultiple` calls). `Log_Buffer` on either is -readable only via **ReadRange** (service 35) - a plain ReadProperty of it is -rejected with `Error(OBJECT, READ_ACCESS_DENIED)`, exactly as -`CASBACnetStackDLL.h` documents (**verified live**). - -`BACnetStack_InsertTrendLogRecord` (the backup/restore half of a Trend Log, -used to write a record back after reading it out with -`BACnetStack_ReadTrendLogRecord`) was confirmed **genuinely customer-facing** -at this pin - it lives in `CASBACnetStackDLL.h`, not the test-tool header - -before this example relied on any assumption about it. Its Event Log -counterpart, `InsertEventLogRecord`, stayed test-tool-only (`#1506`); this is -the same trap the B-ALSC example found for a similarly-named function. - -**Live-verified this session:** Trend Log Multiple 1 (Magenta)'s -`Record_Count` climbed from 0 to 150+ across several runs, and `ReadRange` -(`RangeByPosition`, first=1, count=5) returned real `LogMultipleRecord` -entries. **Known gap:** Trend Log 1 (Lilac) also calls -`SetTrendLogStartStopTime` (to demonstrate bounding the logging window) - this -reproducibly leaves its own `Record_Count` at 0 forever, a confirmed stack -defect filed as -[cas-bacnet-stack#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051). -Separately, `AddTrendLogObject` alone causes a non-fatal internal log flood -(filed as [#2050](https://github.com/chipkin/cas-bacnet-stack/issues/2050), -the same class of defect B-ACC found for `AddEventLogObject` as -[#2045](https://github.com/chipkin/cas-bacnet-stack/issues/2045)). See -[TODO.md](TODO.md) for full detail on both. - -## Backup and Restore (DM-BR-B, from B-ACC) - -File 1 ("Ivory") is a small in-memory STREAM-access file. -`BACnetStack_SetBackupAndRestoreEnabled` and all four Prepare/Complete -Backup/Restore callbacks are registered; `ReinitializeDevice` accepts the five -backup/restore states (STARTBACKUP/ENDBACKUP/STARTRESTORE/ENDRESTORE/ -ABORTRESTORE, values 2-6) in addition to COLDSTART/WARMSTART. AtomicReadFile -and AtomicWriteFile (services 6/7) operate on Ivory directly. **Verified -live:** `File_Size` reads `0` (nothing written this session) and a -WriteProperty of `Archive = true` reads back correctly. - -## Device management (from B-ASC / B-AAC, unchanged) - -DeviceCommunicationControl (DM-DCC-B), TimeSynchronization / UTCTimeSynchronization -(DM-TS-B / DM-UTC-B), and ReinitializeDevice (DM-RD-B) are all inherited -unchanged from the B-AAC seed. B-LSC's own port of `ReinitializeDevice` -states in its file header "unchanged from B-AAC/B-ASC" - confirming this -example's copy (extended here only with the DM-BR-B backup/restore states) is -already the same code a sibling profile relies on, so no separate graft was -needed. - -## What this example does NOT do yet - -See **[TODO.md](TODO.md)** for full detail, evidence, and issue links. In -summary: - -- **Trend Log 1 (Lilac)'s `Record_Count`** never increments because of - `SetTrendLogStartStopTime` (#2051) - Trend Log Multiple 1 (Magenta) is the - working demonstration instead. -- **`AddTrendLogObject`** causes a non-fatal internal log flood (#2050). -- **Schedule 1's remote (SCHED-E-B) write** is correctly wired but not - cross-instance wire-verified in this session's test topology. -- **Calendar 1 (Cream)'s `Date_List`** cannot be populated (issue #963, - inherited from every prior example with a Calendar). - -## Before you ship - -This example is a tutorial, and it identifies itself as one. Everything in -this table is read by clients and shown to the operator in **every discovery -tool on the network**. Left as-is, your product appears on a real site -announcing itself as a Chipkin demo. None of it is cosmetic. - -| Constant (`main.cpp`) | Ships as | Change it to | -|---|---|---| -| `VENDOR_IDENTIFIER` | `389` (Chipkin) | **Your** company's vendor ID. Assigned by ASHRAE, free: | -| `VENDOR_NAME` | `Chipkin Automation Systems` | Your company name - must match the vendor ID above. | -| `DEVICE_NAME` | `"Rainbow"` | Your device's `Object_Name`. **Must be unique across the BACnet internetwork.** | -| `MODEL_NAME` | `CAS BACnet Stack Example - B-BC` | Your model designation. | -| `DEVICE_DESCRIPTION` | a description of *this example* | What your device actually is. | -| `FIRMWARE_REVISION` / `APPLICATION_SOFTWARE_VERSION` | `1.0.0` | Your real versions - wire them to your build. | -| `DCC_PASSWORD` | `""` (no password) | Set your device's secret, or leave empty to accept any DeviceCommunicationControl/ReinitializeDevice. It crosses the wire in **plaintext** - a guard against accidents, not a security boundary. | -| Device instance | `389005` (`--deviceID` overrides) | Must be unique on the internetwork. | - -`main.cpp` marks this block with a `CHANGE ALL OF THIS BEFORE YOU SHIP` banner. +## What this example supports + +### BIBBs (BACnet Interoperability Building Blocks) + +| BIBB | Description | Supported | +|------|-------------|:---------:| +| DS-RP-A | Data Sharing - ReadProperty - A | ✅ | +| DS-RP-B | Data Sharing - ReadProperty - B | ✅ | +| DS-RPM-A | Data Sharing - ReadPropertyMultiple - A | ✅ | +| DS-RPM-B | Data Sharing - ReadPropertyMultiple - B | ✅ | +| DS-WP-A | Data Sharing - WriteProperty - A | ✅ | +| DS-WP-B | Data Sharing - WriteProperty - B | ✅ | +| DS-WPM-B | Data Sharing - WritePropertyMultiple - B | ✅ | +| AE-N-I-B | Alarm and Event - Notification Internal - B | ✅ | +| AE-ACK-B | Alarm and Event - ACK - B | ✅ | +| AE-INFO-B | Alarm and Event - Information - B | ✅ | +| AE-CRL-B | Alarm and Event - Recipient List - B | ✅ | +| SCHED-E-B | Scheduling - External - B | ✅ (wiring verified; remote write not cross-instance wire-tested - see [TUTORIAL.md](TUTORIAL.md)) | +| T-VMT-I-B | Trending - Viewing and Modifying Trends - Internal - B | ✅ (Trend Log Multiple; plain Trend Log has a known gap - see [TUTORIAL.md](TUTORIAL.md)) | +| T-ATR-B | Trending - Automated Trend Retrieval - B | ✅ (via ReadRange on Trend Log Multiple) | +| DM-DDB-A | Device Management - Dynamic Device Binding - A | ✅ | +| DM-DDB-B | Device Management - Dynamic Device Binding - B | ✅ | +| DM-DOB-B | Device Management - Dynamic Object Binding - B | ✅ | +| DM-DCC-B | Device Management - Device Communication Control - B | ✅ | +| DM-TS-B / DM-UTC-B | Device Management - Time Synchronization / UTC - B | ✅ | +| DM-RD-B | Device Management - ReinitializeDevice - B | ✅ | +| DM-BR-B | Device Management - Backup and Restore - B | ✅ | + +### Services (executed / B-side, unless noted) + +| Service | Notes | +|---------|-------| +| ReadProperty / ReadPropertyMultiple | Responds to property reads (DS-RP-B / DS-RPM-B). | +| WriteProperty / WritePropertyMultiple | Accepts writes to commandable outputs, Diamond, and Crimson's `Recipient_List` (DS-WP-B / DS-WPM-B). | +| WriteProperty (initiate) | Schedule 1 writes Chartreuse locally and a remote peer's Analog Output 1 (SCHED-E-B / DS-WP-A). | +| Who-Is / I-Am | Answers Who-Is with I-Am; broadcasts I-Am at start-up and on restart; also initiates Who-Is at start-up (DM-DDB-A,B). | +| Who-Has / I-Have | Answers Who-Has with I-Have (DM-DOB-B). | +| (Un)ConfirmedEventNotification | Sends alarm/event notifications for Diamond to Crimson's recipients (AE-N-I-B). | +| AcknowledgeAlarm | Accepts an acknowledgement for Diamond's alarm (AE-ACK-B). | +| GetEventInformation | Reports active events (AE-INFO-B). | +| DeviceCommunicationControl | Accepts `disable-initiation` / `enable`, optionally password-gated (DM-DCC-B). | +| ReinitializeDevice | Accepts COLDSTART/WARMSTART plus the five backup/restore states (DM-RD-B / DM-BR-B). | +| TimeSynchronization / UTCTimeSynchronization | Accepts a time sync request (DM-TS-B / DM-UTC-B). | +| AtomicReadFile / AtomicWriteFile | Reads and writes File 1 "Ivory" (DM-BR-B). | +| ReadRange | Retrieves `Log_Buffer` from a Trend Log / Trend Log Multiple (T-ATR-B). A plain ReadProperty of `Log_Buffer` is rejected. | + +### Object types + +| Object type | Instance | Name | +|-------------|:--------:|------| +| Device | 389005 | Rainbow | +| Analog Input | 1 | Bronze | +| Binary Input | 1 | Emerald | +| Multi-state Input | 1 | Hot Pink | +| Analog Output | 1 | Chartreuse | +| Binary Output | 1 | Fuchsia | +| Multi-state Output | 1 | Indigo | +| Analog Value | 1 | Diamond | +| Notification Class | 1 | Crimson | +| Network Port | 1 | Vermilion | +| Schedule | 1 | Saffron | +| Calendar | 1 | Cream | +| File | 1 | Ivory | +| Trend Log | 1 | Lilac | +| Trend Log Multiple | 1 | Magenta | + +Every required property of every object, and who answers it, is in +[docs/PICS.md](docs/PICS.md). ## Requires the CAS BACnet Stack (licensed product) -This example **builds against the CAS BACnet Stack, a commercial Chipkin product** - -not free or open source, no public/trial build. The stack is the **private** git -submodule `submodules/cas-bacnet-stack`; you can only fetch and build it with a CAS -BACnet Stack license. **To get the stack, contact Chipkin:** - or sales@chipkin.com. You -do not need a stack licence to *read* this example's own source: every file outside -submodules/ is CC0 public domain. The licence is what lets you *build* it. +This example **builds against the CAS BACnet Stack, which is a commercial Chipkin +product** - it is not free or open source, and there is no public/trial build. +The stack is referenced here as the **private** git submodule +`submodules/cas-bacnet-stack`; you can only fetch and build it once you have a CAS +BACnet Stack license and access to that repository. + +**To get the CAS BACnet Stack (and access to build this example), contact +Chipkin:** or +sales@chipkin.com. + +You do not need a stack licence to *read* this example, or to run a +[prebuilt release binary](https://github.com/chipkin/BACnetProfileExample-B-BC-CPP/releases). +The licence is what lets you *build* it - that is the part the stack submodule +gates. + +## What's in this repository + +This is a **self-contained** project. It ships: + +- `main.cpp` - the example device. +- `common/` - the shared helper (UDP, callbacks, CLI, keyboard) vendored in. +- `CMakeLists.txt` - the build, the same on Windows, Linux, and macOS. +- `docs/PICS.md` - the conformance statement. +- `submodules/cas-bacnet-stack/` - the **CAS BACnet Stack as a git submodule** + (private; requires a license - see above). Its sources are compiled into the + executable, so there is no library or DLL to build, ship, or install. + +## Prerequisites + +- A C++17 compiler (MSVC, GCC, or Clang). +- CMake >= 3.15. +- Git (to fetch the stack submodule). + +### Windows + +- **C++ compiler** - install + [Visual Studio Community](https://visualstudio.microsoft.com/downloads/) + (free) and select the **"Desktop development with C++"** workload. +- **CMake** - from , or `winget install Kitware.CMake`. + +### Linux / macOS + +- Debian/Ubuntu: `sudo apt install build-essential cmake git` +- macOS: `xcode-select --install` and `brew install cmake` ## Build -This example links the CAS BACnet Stack as a prebuilt **STATIC** library. Build -the library once from the pinned submodule commit, then configure and build the -example against it: +CMake only, and the same two commands on every platform: ```bash git clone --recursive https://github.com/chipkin/BACnetProfileExample-B-BC-CPP.git cd BACnetProfileExample-B-BC-CPP -git submodule update --init --recursive # if not cloned with --recursive -tools/build-stack-static.sh BACnetProfileExample-B-BC-CPP # from the series root; builds - # submodules/cas-bacnet-stack/bin/... -cmake -B build -S . -DCAS_BACNET_STACK_LINK=STATIC + +cmake -B build -S . cmake --build build --config Release -./build/BACnetExampleBBC # Linux/macOS -.\build\Release\BACnetExampleBBC.exe # Windows ``` -> **The stack library build takes several minutes** the first time - it -> compiles the entire CAS BACnet Stack (~600 source files) once, via the -> stack's own project files (`msbuild` on Windows, `make` on Linux). The -> example itself (`main.cpp` + `common/`) then builds in seconds against that -> library, and rebuilds after that are incremental. -> -> **Windows toolset note:** if `cmake --build` fails linking with -> `LINK : fatal error C1900: Il mismatch`, the machine has more than one -> Visual Studio install and the stack library was built with a different -> physical compiler copy than CMake's generator resolves. Pass -> `TOOLSET=` and -> `MSBUILD=` to `build-stack-static.sh` to -> pin both to the same copy - see the script's own comments. - -Use `-D CAS_STACK_DIR=/path` to point at a stack elsewhere. Options: `--port ` -(default 47808), `--deviceID ` (default 389005), `--help` (show usage and exit), -`--version` (print the example, stack, and `common/` versions and exit). -Interactive keys: `h` help, `q` quit, up/down nudge Analog Input 1, `s` advance -Schedule 1 (Saffron) to a transition right now. - -### Link mode - -This example links the stack through the `CASBACnetStack::Adapter` CMake target -(`submodules/cas-bacnet-stack/adapters/cpp`) in **STATIC** mode - -`-DCAS_BACNET_STACK_LINK=STATIC` links the prebuilt -`CASBACnetStack_x64_Release.lib` / `libCASBACnetStack_x64_Release.a` built by -`tools/build-stack-static.sh` above. **Application code is identical -regardless of link mode** - `main.cpp` and `common/` call `BACnetStack_AddDevice(...)` -and friends by the exact export name. Every mode requires calling -`LoadBACnetFunctions()` once at the top of `main()` before any other -`BACnetStack_*` call, which runs a version handshake; if it fails, -`CASBACnetStackAdapter_LastError()` says why and the program exits with a -message rather than crashing. - -The adapter also offers a **SOURCE** mode (compiles the stack's `source/*.cpp` -straight into the executable, no library build step) - this example is built -and published in **STATIC** mode only. +Already cloned without `--recursive`? Run `git submodule update --init --recursive` +first - the build needs the stack submodule. + +> **The first build takes a few minutes** - it compiles the entire CAS BACnet +> Stack (~600 source files) into the executable. Rebuilds after that are +> incremental and take seconds. + +If your CAS BACnet Stack lives somewhere other than the bundled submodule, point +CMake at it: `cmake -B build -S . -D CAS_STACK_DIR=/path/to/cas-bacnet-stack`. + +## Run + +```bash +# Linux / macOS +./build/BACnetExampleBBC + +# Windows +.\build\Release\BACnetExampleBBC.exe +``` + +Expected output: + +``` +BACnet B-BC (Building Controller) Example - C++ v1.0.0 +CAS BACnet Stack version: 6.0.21.0 +Common helper (common/) version: 2.5.0 +FYI: Listening for BACnet/IP on UDP port 47808 (Network Port 1). +TX 21 bytes to 192.168.3.255:47808 (broadcast) (Network Port 1) +FYI: Device 389005 ("Rainbow") ready. Vendor ID 389. Press 'h' for help. +``` + +The `TX` line is the start-up I-Am the device broadcasts to announce itself, to +the **local subnet broadcast** address (computed from the Network Port's +interface). As clients talk to the device you'll see `RX ... bytes from ...` +and `TX ... bytes to ...` lines showing the traffic. + +The device listens on UDP **47808** (BACnet/IP). Allow that port through your +firewall. To use a different port, pass `--port` (see below). + +> **A wall of red `Error:` lines at start-up is expected and is not your bug** - +> it is the stack's own debug logging (the device hearing its own broadcast I-Am, +> a one-time BACnet/SC UUID notice, and - once trending starts - a continuous, +> non-fatal internal log flood, [#2050](https://github.com/chipkin/cas-bacnet-stack/issues/2050)). +> [TUTORIAL.md](TUTORIAL.md#troubleshooting) explains all three. + +### Command-line options + +| Option | Default | Meaning | +|--------|---------|---------| +| `--port ` | `47808` | UDP port to listen on (BACnet/IP). | +| `--deviceID ` | `389005` | The device's BACnet instance number (BACnet requires this to be configurable). | +| `--help`, `-h` | - | Show usage and exit. | +| `--version` | - | Print the example, stack, and `common/` helper versions, then exit. | + +### Interactive commands + +While the example runs, these keys are available: + +| Key | Action | +|-----|--------| +| `h` | Show the version information and this command list. | +| `q` | Quit. | +| up arrow | Increase Analog Input 1 (`Bronze`) by 1.1. | +| down arrow | Decrease Analog Input 1 (`Bronze`) by 1.1. | +| `s` | Add a Weekly_Schedule transition for Schedule 1 (`Saffron`) right now, so it can be observed without waiting for the wall clock. | ## Verify @@ -282,347 +283,139 @@ or any client: 5. **Acknowledge / redirect (AE-ACK-B / AE-CRL-B)** - AcknowledgeAlarm for Diamond; GetEventInformation; WriteProperty Crimson's `Recipient_List` with a new destination and confirm the next alarm goes there. *Recipient_List - read verified live; write not re-tested this session (inherited from - B-AAC, which does verify the write).* + read verified live; write not re-tested this session.* 6. **Trend (T-VMT-I-B / T-ATR-B)** - wait a few seconds, then ReadRange Magenta's `Log_Buffer`; confirm `Record_Count` climbs and records decode. - *Verified live.* (Lilac's own `Record_Count` stays 0 - see TODO.md #1.) + *Verified live.* (Lilac's own `Record_Count` stays 0 - see + [TUTORIAL.md](TUTORIAL.md).) 7. **Backup (DM-BR-B)** - AtomicWriteFile then AtomicReadFile against Ivory; round-trip the bytes; drive ReinitializeDevice through STARTBACKUP/ENDBACKUP. - *File_Size/Archive verified live; the Atomic*File round-trip itself and the - ReinitializeDevice backup states were not re-tested this session (logic is - copied unchanged from B-ACC's verified implementation).* + *File_Size/Archive verified live; the Atomic*File round-trip and the + ReinitializeDevice backup states were not re-tested this session.* 8. **Device management** - DeviceCommunicationControl `disable-initiation` / `enable`; ReinitializeDevice `WARMSTART`; TimeSynchronization - each - accepted (inherited unchanged from B-AAC/B-ASC; not re-tested this session). + accepted (not re-tested this session). -## What's in this repository +For a property-by-property review against the conformance statement, see +[TUTORIAL.md](TUTORIAL.md). + +## Footprint + +Release-build sizes and start-up timing, from the latest tagged release's CI +run (`metrics-windows.json` / `metrics-linux.json`): + + +| Platform | Binary | Size | SHA-256 (prefix) | Start-up to `ready` | Stack commit | Link mode | Compiler | +|---|---|---|---|---|---|---|---| +| Windows x64 (windows-2022) | `BACnetExampleBBC.exe` | 3,457,536 bytes (~3.3 MiB) | `fc06ece93ad8983d` | 540 ms | `abd4cee1` | STATIC | Visual Studio 17 2022 | +| Linux x64 (ubuntu-latest) | `BACnetExampleBBC` | 64,216 bytes (~63 KiB) | `88daf21f620cedeb` | 109 ms | `abd4cee1` | STATIC | `/usr/bin/c++` | -`main.cpp` (the example), `common/` (the vendored shared helper), and -`submodules/cas-bacnet-stack/` (the CAS BACnet Stack as a private git submodule, -compiled from source). Self-contained: clone with `--recursive` and build. - -## Objects and properties - - -Every object this example creates, and every REQUIRED property of each (per ANSI/ASHRAE 135-2024 clause 12 and the stack's `docs/property-profile-reference.md`), plus the optional properties the example turns on. **Served by** says who answers a ReadProperty: the **stack** generates it, or the **app** serves it from a `GetProperty*` callback in `main.cpp`. A ⚠ row is a required property the app does not serve and the stack would fill with a default - that is a defect, not a feature. - -### Analog Input 1 "Bronze" - REAL, degrees Celsius; starts at 21.5. Also the logged point for Trend Log 1 (Lilac) and one of the three logged points for Trend Log Multiple 1 (Magenta) - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | Real | app | no | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Units | BACnetEngineeringUnits | app | no | - -### Binary Input 1 "Emerald" - starts inactive - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | BACnetBinaryPV | app | no | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Polarity | BACnetPolarity | app | no | - -### Multi-state Input 1 "Hot Pink" - state 1 of 3: On, Off, Auto - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | Unsigned | app | no | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Number_Of_States | Unsigned | app | no | -| State_Text *(optional, enabled)* | BACnetARRAY[N] of CharacterString | app | no | - -### Analog Output 1 "Chartreuse" - commandable; 16-slot Priority_Array, Relinquish_Default 20.0 C, served by GetPropertyReal. Present_Value, Priority_Array and Current_Command_Priority are resolved by the stack from the priority array; also Schedule 1 (Saffron)'s local write target at priority 8, and one of the three logged points for Trend Log Multiple 1 (Magenta). Verified live: a WriteProperty of 42.5 at priority 8 reads back correctly - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | Real | stack | yes | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Units | BACnetEngineeringUnits | app | no | -| Priority_Array | BACnetARRAY[16] of BACnetOptionalReal | stack | no | -| Relinquish_Default | Real | app | no | -| Current_Command_Priority | BACnetOptionalUnsigned | stack | no | - -### Binary Output 1 "Fuchsia" - commandable; 16-slot Priority_Array, Relinquish_Default inactive, served by GetPropertyEnumerated - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | BACnetBinaryPV | stack | yes | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Polarity | BACnetPolarity | app | no | -| Priority_Array | BACnetARRAY[16] of BACnetOptionalBinaryPV | stack | no | -| Relinquish_Default | BACnetBinaryPV | app | no | -| Current_Command_Priority | BACnetOptionalUnsigned | stack | no | - -### Multi-state Output 1 "Indigo" - commandable; 16-slot Priority_Array, Relinquish_Default state 1 of 3, served by GetPropertyUnsignedInteger - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | Unsigned | stack | yes | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Number_Of_States | Unsigned | app | no | -| Priority_Array | BACnetARRAY[16] of BACnetOptionalUnsigned | stack | no | -| Relinquish_Default | Unsigned | app | no | -| Current_Command_Priority | BACnetOptionalUnsigned | stack | no | - -### Analog Value 1 "Diamond" - the alarm-capable process value (AE-N-I-B). Event_State is NOT a stack default here - it is genuinely computed, because this example arms an intrinsic OutOfRange algorithm on Diamond (SetIntrinsicOutOfRangeAlgorithm + SetAlarmsAndEventsForObjectEnabled); it is marked accepted only because property-profile-reference.md's generic table does not know an algorithm was armed. A client writes Present_Value across 10-90 percent to fire an EventNotification to Notification Class 1 (Crimson). Verified live: writing 95.0 transitions Event_State to high-limit. Also one of the three logged points for Trend Log Multiple 1 (Magenta) - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | Real | stack | yes | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Units | BACnetEngineeringUnits | app | no | - -### Notification Class 1 "Crimson" - AE-CRL-B. Priority, Ack_Required and Recipient_List are NOT stack DEFAULTS - they are genuinely populated, by BACnetStack_AddNotificationClassObject (Priority, Ack_Required) and BACnetStack_AddRecipientToNotificationClass (Recipient_List) at start-up. They are marked accepted only because property-profile-reference.md's generic per-type table does not know about this object-specific host-configuration API and so cannot credit them as stack-served. Recipient_List is also registered writable (BACnetStack_SetPropertyWritable) so a client can redirect it at run time; the stack decodes and stores a WriteProperty to it itself. Verified live: Recipient_List reads back the seeded destination. Named Crimson (not Jade, the B-AAC seed's naming defect for this object type - see colour-table.md, Jade is lighting_output's colour) per docs/colour-table.md - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Priority | BACnetARRAY[3] of Unsigned | stack default, accepted (Generic UnsignedInteger default: `0`) | no | -| Ack_Required | BACnetEventTransitionBits | stack default, accepted (Generic BitString default: empty bitstring (zero bits - NOT ) | no | -| Recipient_List | BACnetLIST of BACnetDestination | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | yes | - -### Network Port 1 "Vermilion" - BACnet/IP; Network_Type and Protocol_Level are set from BACnetStack_AddNetworkPortObject()'s arguments (IPv4, BACnet Application) at start-up, not a GetProperty callback like the object's other app-served rows; Changes_Pending is likewise computed and answered natively by the stack's Network Port object. Reliability has no fault condition this example detects, so it is accepted at the generic default (normal) - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Status_Flags | BACnetStatusFlags | stack | no | -| Reliability | BACnetReliability | stack default, accepted (Generic Enumerated default: `0`) | no | -| Out_Of_Service | Boolean | app | no | -| Network_Type | BACnetNetworkType | app | no | -| Protocol_Level | BACnetProtocolLevel | app | no | -| Changes_Pending | Boolean | app | no | - -### Schedule 1 "Saffron" - SCHED-E-B. Present_Value, Effective_Period, Schedule_Default, List_Of_Object_Property_References, Priority_For_Writing and Status_Flags are NOT stack DEFAULTS - they are genuinely held and served by the stack's Schedule engine (BACnetStack_AddScheduleObject plus the BACnetStack_SetSchedule*/AddSchedule* configuration calls in main.cpp). List_Of_Object_Property_References has TWO entries (each BACnetStack_AddScheduleObjectPropertyReference call appends): a LOCAL one at Analog Output 1 (Chartreuse) Present_Value, and a REMOTE one at a peer device's (default instance 389002, e.g. a locally-built B-SA-CPP) Analog Output 1 Present_Value - the SCHED-E-B / F-EXTWRITE remote fan-out. The local write is proven (inherited from B-AAC's SCHED-I-B); the remote write is correct, documented API usage but was not wire-verified end-to-end this session because two example instances on different UDP ports on one host cannot discover each other by broadcast - see TODO.md item 3. One weekly transition (Monday 08:00) and one calendar-date exception (2026-12-25, via the inline calendar-entry form) are seeded at start-up; the 's' key (common/'s DemoAdvance) adds a transition for right now so the change can be observed without waiting for the wall clock - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | Any | stack default, accepted (Stack-generated if commandable (resolves the priority array)) | no | -| Effective_Period | BACnetDateRange | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | no | -| Schedule_Default | Any | stack | no | -| List_Of_Object_Property_References | BACnetLIST of BACnetDeviceObjectPropertyReference | stack | no | -| Priority_For_Writing | Unsigned(1..16) | stack default, accepted (Generic UnsignedInteger default: `0`) | no | -| Status_Flags | BACnetStatusFlags | stack | no | -| Reliability | BACnetReliability | app | no | -| Out_Of_Service | Boolean | app | no | - -### Calendar 1 "Cream" - exists for SCHED-E-B completeness alongside Saffron's exception, but its Date_List cannot be populated through the customer API (cas-bacnet-stack issue #963 - no read path for a Calendar object's Date_List; the only generic constructed-property callback is test-tool-only). Present_Value therefore always answers false rather than evaluating a Date_List that is never populated - see TODO.md - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Present_Value | Boolean | app | no | -| Date_List | BACnetLIST of BACnetCalendarEntry | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | no | - -### File 1 "Ivory" - DM-BR-B. A small in-memory STREAM-access file that AtomicReadFile/AtomicWriteFile operate on, and the backup/restore payload for ReinitializeDevice's STARTBACKUP/ENDBACKUP/STARTRESTORE/ENDRESTORE/ABORTRESTORE states (2-6), all accepted by ReinitializeDevice alongside COLDSTART/WARMSTART. BACnetStack_SetBackupAndRestoreEnabled plus the four Prepare/Complete Backup/Restore callbacks are registered. Verified live: File_Size reads 0 (nothing written yet this session) and a WriteProperty of Archive=true reads back correctly - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| File_Type | CharacterString | app | no | -| File_Size | Unsigned | app | no | -| Modification_Date | BACnetDateTime | app | no | -| Archive | Boolean | app | yes | -| Read_Only | Boolean | app | no | -| File_Access_Method | BACnetFileAccessMethod | stack | no | - -### Trend Log 1 "Lilac" - T-VMT-I-B / T-ATR-B. Enable, Stop_When_Full, Buffer_Size, Log_Buffer, Record_Count, Total_Record_Count and Logging_Type are NOT stack defaults - they are genuinely held and served by the stack's Trend Log engine (BACnetStack_AddTrendLogObject + SetTrendLogTypeToPolled + SetTrendLogStartStopTime), marked accepted only because property-profile-reference.md's generic table does not know about this host-configuration API. Polls Analog Input 1 (Bronze) Present_Value every second. Log_Buffer is readable only via ReadRange (a plain ReadProperty is rejected with Error(OBJECT, READ_ACCESS_DENIED) - verified live); ReadRange itself was verified live against Trend Log Multiple 1 (Magenta), not this object - see the note there and TODO.md item 1. KNOWN GAP: calling SetTrendLogStartStopTime on this object reproducibly leaves Record_Count at 0 forever regardless of the values passed (filed as cas-bacnet-stack#2051); this object therefore demonstrates the SetTrendLogStartStopTime call's correct usage but will read Record_Count=0 in a live demo. Also KNOWN: BACnetStack_AddTrendLogObject alone causes a continuous non-fatal internal log flood (cas-bacnet-stack#2050, same class as B-ACC's #2045 for Event Log) - device functionality is unaffected - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Enable | Boolean | stack default, accepted (Generic Boolean default: `false`) | no | -| Stop_When_Full | Boolean | stack default, accepted (Generic Boolean default: `false`) | no | -| Buffer_Size | Unsigned32 | stack default, accepted (Generic UnsignedInteger default: `0`) | no | -| Log_Buffer | BACnetLIST of BACnetLogRecord | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | no | -| Record_Count | Unsigned32 | stack default, accepted (Generic UnsignedInteger default: `0`) | no | -| Total_Record_Count | Unsigned32 | stack default, accepted (Generic UnsignedInteger default: `0`) | no | -| Logging_Type | BACnetLoggingType | stack default, accepted (Generic Enumerated default: `0`) | no | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | - -### Trend Log Multiple 1 "Magenta" - T-VMT-I-B / T-ATR-B. Enable is NOT a stack default - it is genuinely held and served by the stack's Trend Log Multiple engine (BACnetStack_AddTrendLogMultipleObject + AddLoggedObjectToTrendLogMultiple x3 + SetTrendLogTypeToPolled), marked accepted only because property-profile-reference.md's generic table does not know about this host-configuration API. Polls three points every second: Analog Input 1 (Bronze), Analog Value 1 (Diamond) and Analog Output 1 (Chartreuse) Present_Value. THIS is the example's working, live-verified polled-logging + ReadRange demonstration (unlike Lilac - see TODO.md item 1): Record_Count climbed from 0 to 150+ across several live runs, and ReadRange (RangeByPosition, first=1, count=5) returned real LogMultipleRecord entries. Also affected by the same AddTrendLogObject-family log-flood as Lilac (cas-bacnet-stack#2050) - non-fatal - -| Property | Datatype | Served by | Writable | -|---|---|---|:---:| -| Object_Identifier | BACnetObjectIdentifier | stack | no | -| Object_Name | CharacterString | app | no | -| Object_Type | BACnetObjectType | stack | no | -| Status_Flags | BACnetStatusFlags | stack | no | -| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | -| Enable | Boolean | stack default, accepted (Generic Boolean default: `false`) | no | - - +From release [v1.0.0](https://github.com/chipkin/BACnetProfileExample-B-BC-CPP/releases/tag/v1.0.0). +v1.0.0 was built with `CAS_BACNET_STACK_LINK=STATIC`; the next release refreshes +these numbers from the SOURCE-mode build documented above. ## The BACnet profile example series -The CAS BACnet Stack supports every standardized device profile in ASHRAE 135-2024 Annex L. One example repository per profile shows how. ✅ = the required BIBB (service) is supported by the CAS BACnet Stack; the **Example** column is the state of that profile's tutorial repository. +The CAS BACnet Stack supports every standardized device profile in ASHRAE 135-2024 Annex L, and there is one example repository per profile. Pick the profile your device claims, then the language you build in. ### Controllers (Annex L.4) -| Profile | Example | Required BIBBs (services) | +| Profile | C++ | Node.js | |---|---|---| -| **B-SS** Smart Sensor | [B-SS-CPP](https://github.com/chipkin/BACnetProfileExample-B-SS-CPP) ✅ | ✅ DS-RP-B · ✅ DM-DDB-B · ✅ DM-DOB-B | -| **B-SA** Smart Actuator | [B-SA-CPP](https://github.com/chipkin/BACnetProfileExample-B-SA-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DM-DDB-B · ✅ DM-DOB-B | -| **B-ASC** Application Specific Controller | [B-ASC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP) ✅ · [B-ASC-Node](https://github.com/chipkin/BACnetProfileExample-B-ASC-Node) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B | -| **B-AAC** Advanced Application Controller | [B-AAC-CPP](https://github.com/chipkin/BACnetProfileExample-B-AAC-CPP) ✅ | ✅ DS-RP-B · ✅ DS-RPM-B · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ AE-N-I-B · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ AE-CRL-B · ✅ SCHED-I-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-RD-B | -| **B-BC** Building Controller | [B-BC-CPP](https://github.com/chipkin/BACnetProfileExample-B-BC-CPP) ✅ | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-RPM-B · ✅ DS-WP-A · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ AE-N-I-B · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ AE-CRL-B · ✅ SCHED-E-B · ✅ T-VMT-I-B · ✅ T-ATR-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-RD-B · ✅ DM-BR-B | +| **B-SS** Smart Sensor | [B-SS-CPP](https://github.com/chipkin/BACnetProfileExample-B-SS-CPP) | — | +| **B-SA** Smart Actuator | [B-SA-CPP](https://github.com/chipkin/BACnetProfileExample-B-SA-CPP) | — | +| **B-ASC** Application Specific Controller | [B-ASC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP) | [B-ASC-Node](https://github.com/chipkin/BACnetProfileExample-B-ASC-Node) | +| **B-AAC** Advanced Application Controller | [B-AAC-CPP](https://github.com/chipkin/BACnetProfileExample-B-AAC-CPP) | — | +| **B-BC** Building Controller | [B-BC-CPP](https://github.com/chipkin/BACnetProfileExample-B-BC-CPP) | — | ### Life safety controllers (Annex L.5) -| Profile | Example | Required BIBBs (services) | +| Profile | C++ | Node.js | |---|---|---| -| **B-LSC** Life Safety Controller | [B-LSC-CPP](https://github.com/chipkin/BACnetProfileExample-B-LSC-CPP) 🚧 (blocked: [cas-bacnet-stack#2036](https://github.com/chipkin/cas-bacnet-stack/issues/2036)) | ✅ DS-RP-B · ✅ DS-RPM-B · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ DS-COV-B · ✅ AE-LS-B · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-RD-B | -| **B-ALSC** Advanced Life Safety Controller | [B-ALSC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ALSC-CPP) ✅ | ✅ DS-RP-B · ✅ DS-RPM-B · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ DS-COV-B · ✅ AE-LS-B · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ AE-EL-I-B · ✅ SCHED-I-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-RD-B | +| **B-LSC** Life Safety Controller | [B-LSC-CPP](https://github.com/chipkin/BACnetProfileExample-B-LSC-CPP) 🚧 | — | +| **B-ALSC** Advanced Life Safety Controller | [B-ALSC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ALSC-CPP) | — | ### Access control controllers (Annex L.6) -| Profile | Example | Required BIBBs (services) | +| Profile | C++ | Node.js | |---|---|---| -| **B-ACC** Access Control Controller | [B-ACC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ACC-CPP) ✅ | ✅ DS-RP-B · ✅ DS-RPM-B · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ DS-COV-B · ✅ DS-ACUC-B · ✅ DS-ACSC-B · ☐ AE-AC-B ([cas-bacnet-stack#2044](https://github.com/chipkin/cas-bacnet-stack/issues/2044)) · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ AE-EL-I-B · ✅ SCHED-I-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-RD-B · ✅ DM-BR-B | -| **B-AACC** Advanced Access Control Controller | [B-AACC-CPP](https://github.com/chipkin/BACnetProfileExample-B-AACC-CPP) ✅ | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-RPM-B · ✅ DS-WP-A · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ DS-COV-A · ✅ DS-COV-B · ✅ DS-ACAD-A · ☐ DS-ACCDI-A · ✅ DS-ACUC-B · ✅ DS-ACSC-B · ☐ AE-AC-B ([cas-bacnet-stack#2044](https://github.com/chipkin/cas-bacnet-stack/issues/2044)) · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ AE-EL-I-B · ✅ SCHED-I-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-RD-B · ✅ DM-BR-B | +| **B-ACC** Access Control Controller | [B-ACC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ACC-CPP) | — | +| **B-AACC** Advanced Access Control Controller | [B-AACC-CPP](https://github.com/chipkin/BACnetProfileExample-B-AACC-CPP) | — | ### Lighting controllers (Annex L.11) -| Profile | Example | Required BIBBs (services) | +| Profile | C++ | Node.js | |---|---|---| -| **B-LD** Lighting Device | [B-LD-CPP](https://github.com/chipkin/BACnetProfileExample-B-LD-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DS-LO-B / DS-BLO-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B | -| **B-LS** Lighting Supervisor | [B-LS-CPP](https://github.com/chipkin/BACnetProfileExample-B-LS-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-A · ✅ DS-WP-B · ✅ DS-WG-E-B · ✅ DS-ALO-A · ✅ SCHED-E-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B | +| **B-LD** Lighting Device | [B-LD-CPP](https://github.com/chipkin/BACnetProfileExample-B-LD-CPP) | — | +| **B-LS** Lighting Supervisor | [B-LS-CPP](https://github.com/chipkin/BACnetProfileExample-B-LS-CPP) | — | ### Elevator controllers (Annex L.13) -| Profile | Example | Required BIBBs (services) | +| Profile | C++ | Node.js | |---|---|---| -| **B-EM** Elevator Monitor | [B-EM-CPP](https://github.com/chipkin/BACnetProfileExample-B-EM-CPP) ✅ | ✅ DS-RP-B · ✅ DS-RPM-B · ✅ DS-COV-B · ✅ DS-COVM-B · ✅ AE-N-I-B · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B | -| **B-EC** Elevator Controller | [B-EC-CPP](https://github.com/chipkin/BACnetProfileExample-B-EC-CPP) ✅ | ✅ DS-RP-B · ✅ DS-RPM-B · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ DS-COV-B · ✅ DS-COVM-B · ✅ AE-N-I-B · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-RD-B | -| **B-AEC** Advanced Elevator Controller | [B-AEC-CPP](https://github.com/chipkin/BACnetProfileExample-B-AEC-CPP) ✅ | ✅ DS-RP-B · ✅ DS-RPM-B · ✅ DS-WP-B · ✅ DS-WPM-B · ✅ DS-COV-B · ✅ DS-COVM-B · ✅ AE-N-I-B · ✅ AE-ACK-B · ✅ AE-INFO-B · ✅ AE-EL-I-B · ✅ SCHED-I-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B · ✅ DM-OCD-B · ✅ DM-RD-B · ✅ DM-BR-B | +| **B-EM** Elevator Monitor | [B-EM-CPP](https://github.com/chipkin/BACnetProfileExample-B-EM-CPP) | — | +| **B-EC** Elevator Controller | [B-EC-CPP](https://github.com/chipkin/BACnetProfileExample-B-EC-CPP) | — | +| **B-AEC** Advanced Elevator Controller | [B-AEC-CPP](https://github.com/chipkin/BACnetProfileExample-B-AEC-CPP) | — | ### Authentication and authorization (Annex L.14) -| Profile | Example | Required BIBBs (services) | +| Profile | C++ | Node.js | |---|---|---| -| **B-AS** Authorization Server | [B-AS-CPP](https://github.com/chipkin/BACnetProfileExample-B-AS-CPP) ✅ | ✅ DS-RP-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ☐ AA-AS-B ([cas-bacnet-stack#2043](https://github.com/chipkin/cas-bacnet-stack/issues/2043)) | +| **B-AS** Authorization Server | [B-AS-CPP](https://github.com/chipkin/BACnetProfileExample-B-AS-CPP) | — | ### Miscellaneous (Annex L.7, combinable with any one family) -| Profile | Example | Required BIBBs (services) | -|---|---|---| -| **B-BBMD** Broadcast Management Device | [B-BBMD-CPP](https://github.com/chipkin/BACnetProfileExample-B-BBMD-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ NM-BBMDC-B | -| **B-ACDC** Access Control Door Controller | [B-ACDC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ACDC-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DS-ACAD-B · ✅ DM-DDB-B · ✅ DM-DOB-B | -| **B-ACCR** Access Control Credential Reader | [B-ACCR-CPP](https://github.com/chipkin/BACnetProfileExample-B-ACCR-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DS-COV-B · ✅ DS-ACCDI-B · ✅ DM-DDB-B · ✅ DM-DOB-B | -| **B-RTR** Router | [B-RTR-CPP](https://github.com/chipkin/BACnetProfileExample-B-RTR-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DM-DDB-A · ✅ DM-DOB-B · ☐ DM-LM-B · ✅ NM-RC-B | -| **B-GW** Gateway | [B-GW-CPP](https://github.com/chipkin/BACnetProfileExample-B-GW-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ GW-EO-B / GW-VN-B | -| **B-DAP** Device Address Proxy | [B-DAP-CPP](https://github.com/chipkin/BACnetProfileExample-B-DAP-CPP) ✅ | ✅ DS-RP-B · ✅ DS-WP-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DAB-B | -| **B-SCHUB** BACnet/SC Hub | [B-SCHUB-CPP](https://github.com/chipkin/BACnetProfileExample-B-SCHUB-CPP) ✅ | ✅ DS-RP-B · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ NM-SCH-B | -| **B-GENERAL** General device (Annex L.8) | *(satisfied by every example above)* | ✅ DS-RP-B · ✅ DM-DDB-B · ✅ DM-DOB-B | - -### Operator interfaces and workstations (Annex L.1–L.3, L.9–L.10, L.12) — client-side profiles - -| Profile | Example | Required BIBBs (services) | +| Profile | C++ | Node.js | |---|---|---| -| **B-OD** Operator Display | [B-OD-CPP](https://github.com/chipkin/BACnetProfileExample-B-OD-CPP) ✅ | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-WP-A · ✅ DS-V-A · ✅ DS-M-A · ✅ AE-N-A · ✅ AE-VN-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B | -| **B-OWS** Operator Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-WP-A · ✅ DS-V-A · ✅ DS-M-A · ✅ AE-N-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-VM-A · ✅ AE-VN-A · ✅ SCHED-VM-A · ✅ T-V-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-MTS-A | -| **B-AWS** Advanced Operator Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-AV-A · ✅ DS-AM-A · ✅ AE-N-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-AVM-A · ✅ AE-AVN-A · ✅ AE-ELVM-A · ✅ SCHED-AVM-A · ✅ T-AVM-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A · ✅ DM-OCD-A · ✅ DM-RD-A · ✅ DM-BR-A · ✅ DM-DDA-A · ✅ NM-CC-A · ✅ AR-AVM-A | -| **B-XAWS** Extended Advanced Operator Workstation | planned | ✅ union of B-AWS + B-AACWS + B-ALWS + B-AEWS | -| **B-LSAP** Life Safety Annunciator Panel | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-WP-A · ✅ DS-LSV-A · ✅ AE-N-A · ✅ AE-LS-A · ✅ AE-ACK-A · ✅ AE-LSVN-A | -| **B-LSWS** Life Safety Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-LSV-A · ✅ DS-LSM-A · ✅ AE-N-A · ✅ AE-LS-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-LSVM-A · ✅ AE-LSAVN-A · ✅ AE-ELV-A · ✅ SCHED-VM-A · ✅ T-V-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A · ✅ DM-OCD-A · ✅ DM-RD-A · ✅ DM-BR-A | -| **B-ALSWS** Advanced Life Safety Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-LSAV-A · ✅ DS-LSAM-A · ✅ AE-N-A · ✅ AE-LS-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-LSAVM-A · ✅ AE-LSAVN-A · ✅ AE-ELVM-A · ✅ SCHED-AVM-A · ✅ T-AVM-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A · ✅ DM-OCD-A · ✅ DM-RD-A · ✅ DM-BR-A · ✅ AR-AVM-A | -| **B-ACSD** Access Control Security Display | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-ACV-A · ✅ DS-ACM-A · ✅ AE-N-A · ✅ AE-AC-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-ACAVN-A · ✅ AE-ELV-A · ✅ SCHED-VM-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-MTS-A | -| **B-ACWS** Access Control Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-ACAV-A · ✅ DS-ACM-A · ✅ DS-ACUC-A · ✅ AE-N-A · ✅ AE-AC-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-ACVM-A · ✅ AE-ACAVN-A · ✅ AE-ELV-A · ✅ SCHED-VM-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A · ✅ DM-OCD-A · ✅ DM-RD-A · ✅ DM-BR-A | -| **B-AACWS** Advanced Access Control Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-ACAV-A · ✅ DS-ACAM-A · ✅ DS-ACUC-A · ✅ DS-ACSC-A · ✅ AE-N-A · ✅ AE-AC-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-ACAVM-A · ✅ AE-ACAVN-A · ✅ AE-ELVM-A · ✅ SCHED-AVM-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A · ✅ DM-OCD-A · ✅ DM-RD-A · ✅ DM-BR-A · ✅ AR-AVM-A | -| **B-LOD** Lighting Operator Display | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-WP-A · ✅ DS-LV-A · ✅ DS-WG-A · ✅ DS-ALO-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B | -| **B-ALWS** Advanced Lighting Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-LAV-A · ✅ DS-LAM-A · ✅ DS-WG-A · ✅ DS-ALO-A · ✅ AE-N-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-AVM-A · ✅ AE-AVN-A · ✅ AE-ELVM-A · ✅ SCHED-AVM-A · ✅ T-AVM-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A · ✅ DM-OCD-A · ✅ DM-RD-A · ✅ DM-BR-A | -| **B-LCS** Lighting Control Station | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-WP-A · ✅ DS-LO-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B | -| **B-ALCS** Advanced Lighting Control Station | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-WG-A · ✅ DS-ALO-A · ✅ SCHED-E-B · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B · ✅ DM-DCC-B · ✅ DM-TS-B / DM-UTC-B | -| **B-ED** Elevator Display | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-WP-A · ✅ DS-EV-A · ✅ AE-N-A · ✅ AE-ACK-A · ✅ AE-EVN-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-DOB-B | -| **B-EWS** Elevator Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-COVM-A · ✅ DS-EV-A · ✅ DS-EM-A · ✅ AE-N-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-EVM-A · ✅ AE-EAVN-A · ✅ SCHED-VM-A · ✅ T-V-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A | -| **B-AEWS** Advanced Elevator Workstation | planned | ✅ DS-RP-A · ✅ DS-RP-B · ✅ DS-RPM-A · ✅ DS-WP-A · ✅ DS-WPM-A · ✅ DS-COVM-A · ✅ DS-EAV-A · ✅ DS-EAM-A · ✅ AE-N-A · ✅ AE-ACK-A · ✅ AE-AS-A · ✅ AE-EAVM-A · ✅ AE-EAVN-A · ✅ AE-ELVM-A · ✅ SCHED-AVM-A · ✅ T-AVM-A · ✅ DM-DDB-A · ✅ DM-DDB-B · ✅ DM-ANM-A · ✅ DM-ADM-A · ✅ DM-DOB-B · ✅ DM-DCC-A · ✅ DM-MTS-A · ✅ DM-OCD-A · ✅ DM-RD-A · ✅ DM-BR-A | - -Profile definitions: ANSI/ASHRAE 135-2024 Annex L. BIBB definitions: Annex K. Get the stack: . - +| **B-BBMD** Broadcast Management Device | [B-BBMD-CPP](https://github.com/chipkin/BACnetProfileExample-B-BBMD-CPP) | — | +| **B-ACDC** Access Control Door Controller | [B-ACDC-CPP](https://github.com/chipkin/BACnetProfileExample-B-ACDC-CPP) | — | +| **B-ACCR** Access Control Credential Reader | [B-ACCR-CPP](https://github.com/chipkin/BACnetProfileExample-B-ACCR-CPP) | — | +| **B-RTR** Router | [B-RTR-CPP](https://github.com/chipkin/BACnetProfileExample-B-RTR-CPP) | — | +| **B-GW** Gateway | [B-GW-CPP](https://github.com/chipkin/BACnetProfileExample-B-GW-CPP) | — | +| **B-DAP** Device Address Proxy | [B-DAP-CPP](https://github.com/chipkin/BACnetProfileExample-B-DAP-CPP) | — | +| **B-SCHUB** BACnet/SC Hub | [B-SCHUB-CPP](https://github.com/chipkin/BACnetProfileExample-B-SCHUB-CPP) | — | +| **B-GENERAL** General device (Annex L.8) | *(satisfied by every example above)* | — | -## Footprint +### Operator interfaces and workstations (Annex L.1–L.3, L.9–L.10, L.12) -Release-build sizes and start-up timing, from the latest tagged release's CI -run (`metrics-windows.json` / `metrics-linux.json`), both built with -`CAS_BACNET_STACK_LINK=STATIC`: +Client-side profiles. - -| Platform | Binary | Size | SHA-256 (prefix) | Start-up to `ready` | Stack commit | Link mode | Compiler | -|---|---|---|---|---|---|---|---| -| Windows x64 (windows-2022) | `BACnetExampleBBC.exe` | 3,457,536 bytes (~3.3 MiB) | `fc06ece93ad8983d` | 540 ms | `abd4cee1` | STATIC | Visual Studio 17 2022 | -| Linux x64 (ubuntu-latest) | `BACnetExampleBBC` | 64,216 bytes (~63 KiB) | `88daf21f620cedeb` | 109 ms | `abd4cee1` | STATIC | `/usr/bin/c++` | - -From release [v1.0.0](https://github.com/chipkin/BACnetProfileExample-B-BC-CPP/releases/tag/v1.0.0) (`metrics-windows.json` / `metrics-linux.json`). +| Profile | C++ | Node.js | +|---|---|---| +| **B-OD** Operator Display | [B-OD-CPP](https://github.com/chipkin/BACnetProfileExample-B-OD-CPP) | — | +| **B-OWS** Operator Workstation | planned | — | +| **B-AWS** Advanced Operator Workstation | planned | — | +| **B-XAWS** Extended Advanced Operator Workstation | planned | — | +| **B-LSAP** Life Safety Annunciator Panel | planned | — | +| **B-LSWS** Life Safety Workstation | planned | — | +| **B-ALSWS** Advanced Life Safety Workstation | planned | — | +| **B-ACSD** Access Control Security Display | planned | — | +| **B-ACWS** Access Control Workstation | planned | — | +| **B-AACWS** Advanced Access Control Workstation | planned | — | +| **B-LOD** Lighting Operator Display | planned | — | +| **B-ALWS** Advanced Lighting Workstation | planned | — | +| **B-LCS** Lighting Control Station | planned | — | +| **B-ALCS** Advanced Lighting Control Station | planned | — | +| **B-ED** Elevator Display | planned | — | +| **B-EWS** Elevator Workstation | planned | — | +| **B-AEWS** Advanced Elevator Workstation | planned | — | + +🚧 = in progress. Profile definitions: ANSI/ASHRAE 135-2024 Annex L. BIBB definitions: Annex K. Get the stack: . + ## References -- **ANSI/ASHRAE 135** - object model (Clause 12), alarming/events (Clause 13), - trending (Clause 12.25/12.29), services (Clause 16), device profiles (Annex L). -- **CAS BACnet Stack** - . -- **Sibling examples this one grafts from** - - [B-SA](https://github.com/chipkin/BACnetProfileExample-B-SA-CPP), - [B-ASC](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP), - [B-AAC](https://github.com/chipkin/BACnetProfileExample-B-AAC-CPP) (seed), - [B-LSC](https://github.com/chipkin/BACnetProfileExample-B-LSC-CPP), - [B-ACC](https://github.com/chipkin/BACnetProfileExample-B-ACC-CPP), - [B-LS](https://github.com/chipkin/BACnetProfileExample-B-LS-CPP). -- **[TODO.md](TODO.md)** - what is not implemented and why. -- **[CHANGELOG.md](CHANGELOG.md)**, **[AGENTS.md](AGENTS.md)**, - **[`common/README.md`](common/README.md)**. - -## Use this in your own project - -Self-contained: clone (with the submodule) and build, then copy what you need. The -example source is **CC0-1.0** (public domain). The CAS BACnet Stack is a separate, -commercially licensed product not covered by CC0. +- **ANSI/ASHRAE Standard 135** (BACnet) - the protocol standard. Object model + (Clause 12), alarming/events (Clause 13), trending (Clause 12.25/12.29), + services (Clause 15/16), device profiles (Annex L). +- **What is BACnet?** - Chipkin's introduction: + . +- **CAS BACnet Stack** - product page and documentation: + . +- **CAS BACnet Explorer** - client for testing this device: + . +- **Shared helper used by this example** - [`common/README.md`](common/README.md). + +See also [TUTORIAL.md](TUTORIAL.md), [docs/PICS.md](docs/PICS.md), +[TODO.md](TODO.md), [CHANGELOG.md](CHANGELOG.md), and [AGENTS.md](AGENTS.md). diff --git a/TUTORIAL.md b/TUTORIAL.md new file mode 100644 index 0000000..4039be1 --- /dev/null +++ b/TUTORIAL.md @@ -0,0 +1,295 @@ +# Tutorial - extending and reviewing the B-BC example + +[README.md](README.md) says what this example *is*. This document is the *how*: +how to extend it into your own device, what each object type needs you to +serve, who serves what for a representative object, how to review the result +for conformance, and what goes wrong when you get it subtly right. This is the +series' largest example, and it has more silent-failure traps than any other - +read this once before you start changing `main.cpp`. + +- [Extending the example](#extending-the-example) +- [What each object type needs you to serve](#what-each-object-type-needs-you-to-serve) +- [Who serves what: Trend Log Multiple "Magenta"](#who-serves-what-trend-log-multiple-magenta) +- [Known gaps in this example](#known-gaps-in-this-example) +- [Reviewing your device](#reviewing-your-device) +- [Troubleshooting](#troubleshooting) + +## Extending the example + +The example is intentionally organised as one file so it's easy to trace, even +though it is the largest in the series. + +**Change a point's value or name** - edit the constants / callbacks in +`main.cpp` (e.g. the initial value of `g_analogInput1Value`, or the colour +strings in `GetPropertyCharString`). + +**Change the device identity before you ship** - vendor ID, vendor name, model +name, description, firmware revision, device name, and the +DeviceCommunicationControl password are all in the +`CHANGE ALL OF THIS BEFORE YOU SHIP` block at the top of `main.cpp`, with a +per-field note on each saying what to change it to. That block is the +authoritative checklist; it is in the source rather than here so it cannot be +skipped by someone who only reads the code. + +**THIS IS THE ONE THAT WILL BITE YOU.** `DEVICE_NAME` ("Rainbow") is a +**compile-time constant**, but `Object_Name` must be unique across the whole +BACnet internetwork. The device instance is runtime-configurable with +`--deviceID`, so it is easy to ship two units, configure their instances +correctly, and still have both announce `Object_Name` `"Rainbow"` - a spec +violation and a hard BTL failure. In a real product `Object_Name` must be +per-unit configurable too: derive it from a serial number, DIP switches, a +config file, or add a `--deviceName` argument. + +### Adding an object: read this before you copy any pattern in this file + +The callbacks in this file are **not uniformly strict**, and the failure mode +for missing a step is **silent**, not an error: + +> Most `GetProperty*` callbacks match on **both** object type *and* instance, +> so a new instance falls through every one of them. `GetPropertyBool` is +> the exception for `Out_Of_Service` - it matches on type only, so a new +> instance of an existing input/output type gets it for free. +> +> The stack errors only for the handful of properties it refuses to invent: +> `Present_Value`, `Number_Of_States`, `Relinquish_Default`, `Local_Date`, +> `Local_Time`, and a Network Port's `APDU_Length`. For everything else a +> declining callback (`return false` without setting `*errorCode`) makes the +> stack **silently substitute a default**: +> +> | Property | If you forget to serve it | Loud? | +> |---|---|:--:| +> | `Present_Value` | Error (`read-access-denied`) | yes | +> | `Object_Name` | reads back as the string **`"undefined"`** | **no** | +> | `Units` | reads back as **`no-units` (95)** | **no** | +> | `Out_Of_Service` | served on type alone for inputs/outputs - works by accident | n/a | +> +> That fallback is load-bearing, not a bug to "fix": the stack relies on it to +> answer required properties the application is not expected to serve (the +> Device's `Max_APDU_Length_Accepted`, `APDU_Timeout`, `Number_Of_APDU_Retries` +> among them). Naming an error on every catch-all breaks those. Set +> `*errorCode` only where *this device* knows the read is wrong - `main.cpp` +> does it in exactly one place, `State_Text` with an out-of-range array index. +> +> It is worse than "wrong value": the object's `Property_List` **still +> advertises `Units`** even when nothing serves it. The object actively claims +> to have the property and then answers with a default - nothing on the wire +> says you forgot anything. A half-added object looks **healthy**. + +Two traps this example's own history hit, both worth knowing before you copy +its patterns: + +1. **`Units` is required on BOTH Analog Input and Analog Output.** Serving it + for the input and forgetting the output does not error - the output + silently reports `no-units (95)` next to a sensor that reports real + degrees Celsius. `main.cpp`'s `GetPropertyEnumerated` deliberately checks + both object types in one `if` to make this obvious. +2. **An optional property needs `SetPropertyEnabled`, not just a callback + branch.** The stack checks `IsPropertyEnabled` *before* it ever reaches + your `GetProperty*` callback; for an optional property that check falls + back to "is it required?", which is false. **This example shipped exactly + this bug**: the Device's `Description` had a working callback branch that + was dead code until `BACnetStack_SetPropertyEnabled(..., Description, + true)` was added in `main()` - without it, clients read back + `Error: unknown-property` no matter how correct the callback looked. It was + caught by a reviewer tracing the stack source, not by running the device. + +So: when you add an object or property, walk **every** relevant callback, add +the matching `SetPropertyEnabled`/`SetPropertyWritable` call if it's optional +or writable, then read back every required property of the new object and +**diff it against an existing object of the same type**. Do not trust "it +scanned OK" - that is exactly the failure mode described above. + +### Making a new type commandable + +Analog/Binary/Multi-state Output already default to commandable in the stack - +`main.cpp`'s `SetPropertyEnabled(Priority_Array)` / +`SetPropertyEnabled(Relinquish_Default)` / `SetPropertyWritable(Present_Value)` +loop over them is technically a no-op there (see the comment above that loop +in `main.cpp` for the stack-source citations). But if you make an **Analog +Value / Binary Value / Multi-State Value** commandable (as this example does +for "Diamond", minus the priority array - Diamond is writable but not +priority-driven), `Priority_Array` and `Relinquish_Default` default to +**optional**, and `IsPropertyCommandable()` requires *both* to be enabled +before the stack treats the object as commandable at all. Omit either call on +a Value object and it silently stays non-commandable. + +### Adding a Trend Log + +`BACnetStack_AddTrendLogObject` creates the object itself - no separate +`AddObject` call, unlike Schedule/Calendar. Then: + +- `SetTrendLogTypeToPolled(enable, stopWhenFull, intervalHundredths)` turns on + polled logging at the given point. +- `Log_Buffer` is **ReadRange-only** - register the `SERVICE_READ_RANGE` + service; a plain ReadProperty of `Log_Buffer` is rejected by the stack + itself with `Error(OBJECT, READ_ACCESS_DENIED)`. +- Only `Object_Name` needs an app `GetProperty*` callback; the stack stores + and serves everything else (`Enable`, `Buffer_Size`, `Record_Count`, ...). +- **Do not also call `SetTrendLogStartStopTime`** unless you have read + [Known gaps in this example](#known-gaps-in-this-example) below first - on + a plain Trend Log it reproducibly blocks `Record_Count` from ever + incrementing. + +## What each object type needs you to serve + +| Object type | You must serve | Plus | +|---|---|---| +| Analog Input | `Present_Value` (Real), `Object_Name`, `Units` | - | +| Binary Input | `Present_Value` (Enumerated), `Object_Name` | `Polarity` | +| Multi-State Input | `Present_Value` (Unsigned), `Object_Name` | `Number_Of_States`, `State_Text` (optional, enabled) | +| Analog Output | `Object_Name`, `Units`, `Relinquish_Default` | `Present_Value`/`Priority_Array`/`Current_Command_Priority` resolved by the stack from the priority-array slots you serve | +| Binary Output | `Object_Name`, `Polarity`, `Relinquish_Default` | same priority-array pattern | +| Multi-State Output | `Object_Name`, `Number_Of_States`, `Relinquish_Default` | same priority-array pattern | +| Analog Value (alarm-capable) | `Object_Name`, `Units` | `Present_Value` writable; `Event_State` genuinely computed once an intrinsic algorithm is armed | +| Notification Class | `Object_Name` | `Priority`/`Ack_Required`/`Recipient_List` held by the stack's own host-configuration API (`AddNotificationClassObject` / `AddRecipientToNotificationClass`), not a `GetProperty*` callback | +| Network Port | `Object_Name`, `Out_Of_Service`, `Network_Type`, `Protocol_Level`, `Changes_Pending` | BACnet/IP addressing via `GetPropertyOctetString` | +| Schedule | `Object_Name`, `Reliability`, `Out_Of_Service` | `Present_Value`/`Effective_Period`/`Schedule_Default`/`List_Of_Object_Property_References` held by the stack's Schedule engine | +| Calendar | `Object_Name`, `Present_Value` | `Date_List` cannot be populated through the customer API - see [Known gaps](#known-gaps-in-this-example) | +| File | `Object_Name`, `File_Type`, `File_Size`, `Modification_Date`, `Archive` (writable), `Read_Only` | `File_Access_Method` served by the stack | +| Trend Log | `Object_Name` | everything else held by the stack's Trend Log engine once configured | +| Trend Log Multiple | `Object_Name` | everything else held by the stack's Trend Log Multiple engine once configured | + +## Who serves what: Trend Log Multiple "Magenta" + +Magenta is the strongest object to trace end-to-end in this example: it is +the one the series' headline new feature (trending) actually proves live, +unlike Lilac (see [Known gaps](#known-gaps-in-this-example)). + +| Property | Served by | How | +|---|---|---| +| `Object_Identifier` | **stack** | generated from the object you added | +| `Object_Type` | **stack** | generated | +| `Object_Name` | **you** | `GetPropertyCharString` -> `"Magenta"` | +| `Status_Flags` | **stack** | generated | +| `Event_State` | **stack**, sort of | no intrinsic alarming on this object, so it reads its datatype default of `normal(0)` - correct by coincidence | +| `Enable` | **stack** | genuinely held by the Trend Log Multiple engine (`SetTrendLogTypeToPolled`), not a datatype default - the generator marks it `accepted` only because the generic per-type reference table has no host-configuration column for this | +| `Log_Buffer` | **stack**, via **ReadRange only** | a plain ReadProperty is rejected (`Error(OBJECT, READ_ACCESS_DENIED)`) - retrieved with `RangeByPosition` | +| `Record_Count` | **stack** | climbs on every poll interval once logging is enabled - **verified live: 0 -> 150+ across several runs** | +| the three logged points | **stack**, configured by you | `AddLoggedObjectToTrendLogMultiple` x3, pointing at Bronze / Diamond / Chartreuse `Present_Value` | + +Every object, not just this one, is in [docs/PICS.md](docs/PICS.md). + +## Known gaps in this example + +These are real, filed findings from building and live-testing this example - +carried here in full because they change what a client should expect, not +because they are cosmetic. See [TODO.md](TODO.md) for the complete writeup +with reproduction steps. + +1. **Trend Log 1 ("Lilac") never accumulates records.** + `BACnetStack_SetTrendLogStartStopTime`, called on Lilac (a plain Trend Log, + not Trend Log Multiple), reproducibly leaves `Record_Count` / + `Total_Record_Count` at `0` forever - regardless of whether `Start_Time` / + `Stop_Time` are left unspecified or set to concrete values that genuinely + bracket "now", and regardless of call order relative to + `SetTrendLogTypeToPolled`. `Enable`, `Start_Time` and `Stop_Time` all read + back correctly; logging simply never happens. The only configuration that + logs is **not calling `SetTrendLogStartStopTime` at all** - exactly Trend + Log Multiple 1 ("Magenta")'s configuration, which is otherwise identical + and accumulates records normally. This example still calls + `SetTrendLogStartStopTime` on Lilac on purpose - it is correct, documented, + customer-facing API usage worth demonstrating - but its `Record_Count` + will read `0` in any live demo. **Trend Log Multiple 1 ("Magenta") is this + example's working polled-accumulation + ReadRange demonstration.** Filed as + [chipkin/cas-bacnet-stack#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051). +2. **`AddTrendLogObject` causes a continuous internal log flood.** Calling it + - independent of `SetTrendLogTypeToPolled`, `SetTrendLogStartStopTime`, or + Trend Log Multiple - makes every `BACnetStack_Tick()` print two `Error:` + lines (`BACnetDateTime::operator =() ... Failed to set the date/time`) + starting from the first tick, continuously, for the life of the process. + The device keeps functioning correctly throughout (Who-Is/I-Am, + ReadProperty, WriteProperty and TX/RX all verified live with the flood + printing) - this is noisy internal logging, not a functional break, the + same class of defect as `AddEventLogObject`'s + [#2045](https://github.com/chipkin/cas-bacnet-stack/issues/2045). Filed as + [#2050](https://github.com/chipkin/cas-bacnet-stack/issues/2050). +3. **Schedule 1's SCHED-E-B remote write is wired correctly but not + cross-instance wire-verified.** `List_Of_Object_Property_References` has + two entries - each `AddScheduleObjectPropertyReference` call APPENDS - a + local one at Chartreuse and a remote one at a peer device's Analog Output 1 + (default instance 389002). The remote reference's mechanism (a + `refDeviceInstance` other than this device's own, which starts the stack's + Device Address Binding for that instance) is correct, documented API + usage. It was **not** wire-verified end-to-end: two example instances on + one host had to run on different UDP ports to avoid a bind conflict, and + BACnet/IP broadcast Who-Is/I-Am does not cross ports, so Device Address + Binding cannot resolve the peer in that topology. Verifying this for real + needs two hosts (or containers/VMs) sharing port 47808, or a BBMD relaying + between the two ports. +4. **Calendar 1 ("Cream")'s `Date_List` cannot be populated.** There is no + customer-facing export or callback to populate a Calendar object's + `Date_List` (cas-bacnet-stack issue #963) - inherited from every prior + example in the series that carries a Calendar. Schedule 1's one-off + exception uses an inline calendar-date entry + (`AddScheduleExceptionEventWithCalendarEntry`) instead of a reference to + Cream, which is fully functional and does not depend on this gap. Cream + still exists as a correctly-served object; `Present_Value` always answers + `false` rather than evaluating a `Date_List` that is never populated. + +## Reviewing your device + +After you have changed anything, review it against the conformance statement +rather than against "it looked fine in the explorer": + +1. Regenerate [docs/PICS.md](docs/PICS.md) after editing `docs/objects.json` + (see [Keeping the PICS honest](#keeping-the-pics-honest) below). A ⚠ row is + a required property nothing serves. +2. Read **every** property listed for **every** object with a BACnet client, + and compare the value against the PICS. `"undefined"`, `no-units` and `0` + are the three shapes a missed callback takes. +3. Diff a new object of a type against the existing one of that type. Anything + that differs and shouldn't is a callback that matched on instance. +4. Confirm the commandable outputs accept a priority write and relinquish + (write NULL) back to `Relinquish_Default`, and that a read-only input + rejects WriteProperty. +5. Fire Diamond's alarm (WriteProperty `Present_Value` above 90 or below 10) + and confirm `Event_State` transitions and a notification reaches Crimson's + recipients. +6. Wait a few seconds and ReadRange Magenta's `Log_Buffer`; confirm + `Record_Count` climbs. Do **not** expect Lilac's `Record_Count` to move - + see [Known gaps](#known-gaps-in-this-example). + +### Keeping the PICS honest + +`docs/PICS.md` is partly generated. `docs/objects.json` describes each object +and who serves which property; the series tool regenerates the object tables +from it plus the stack's own `docs/property-profile-reference.md` at the +pinned commit: + +```bash +python tools/gen-objects-properties.py BACnetProfileExample-B-BC-CPP # rewrite +python tools/gen-objects-properties.py BACnetProfileExample-B-BC-CPP --check # fail if stale +``` + +(That tool lives in the example-series repository, not in this one. If you +only have this repository, edit the generated block by hand and keep it +matching the callbacks in `main.cpp`.) + +When you add an object or a property to `main.cpp`, update `docs/objects.json` +in the same change and regenerate. The `app` list is what the callbacks serve; +`accepted` is for a required property you deliberately leave to the stack's +own configuration API or default, and each one needs a justification (several +rows in this example - Schedule's engine-held properties, the Notification +Class's host-configured `Recipient_List`, the Trend Log engines' `Enable` / +`Record_Count` / `Log_Buffer` - are genuinely served by the stack's +object-specific configuration calls, not by a datatype default; they are +marked `accepted` only because the generic per-type reference table has no +column for host-configuration APIs). Anything required, not in `app` and not +in `accepted`, comes out as a ⚠ row - that is a defect, not a feature. + +## Troubleshooting + +| Symptom | Cause / fix | +|---------|-------------| +| On start-up the app prints a wall of red `Error:` lines but the device works | **Expected — mostly not your bug.** Three benign sources: (1) the device receives its **own** broadcast I-Am and logs a decode cascade - any BACnet/IP device that listens for broadcasts hears itself; (2) a one-time *"UUID has not been set..."* BACnet/SC notice, since these IP-only examples never configure that datalink; (3) once trending starts, a **continuous** `BACnetDateTime::operator =()` flood from `AddTrendLogObject` alone - [#2050](https://github.com/chipkin/cas-bacnet-stack/issues/2050), non-fatal, does not stop the device working. | +| Reading Trend Log 1 ("Lilac")'s `Record_Count` always returns `0` | **Expected — a filed stack defect, not your bug.** See [Known gaps item 1](#known-gaps-in-this-example) ([#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051)). Use Trend Log Multiple 1 ("Magenta") instead. | +| A ReadProperty of `Log_Buffer` on either Trend Log returns `Error(OBJECT, READ_ACCESS_DENIED)` | **Expected — this property is ReadRange-only.** Use ReadRange (`RangeByPosition`), not ReadProperty. | +| Schedule 1's remote (SCHED-E-B) write never reaches the peer | Either no peer is running at `REMOTE_DEVICE_INSTANCE` (389002 by default), or the peer is on a different UDP port on the same host - broadcast Who-Is/I-Am does not cross ports, so Device Address Binding cannot resolve it. See [Known gaps item 3](#known-gaps-in-this-example). | +| Calendar 1 ("Cream")'s `Date_List` reads back empty and `Present_Value` is always `false` | **Expected — inherited stack gap #963.** See [Known gaps item 4](#known-gaps-in-this-example). | +| An optional property you added a callback branch for reads back `Error: unknown-property` | You served it in a `GetProperty*` callback but never called `BACnetStack_SetPropertyEnabled` for it. The stack checks whether a property is enabled *before* calling your callback. This example shipped exactly this bug for the Device's `Description` - see [Adding an object](#adding-an-object-read-this-before-you-copy-any-pattern-in-this-file). | +| CMake error: *"CAS BACnet Stack adapter not found under: ..."* | Submodules not initialized. Run `git submodule update --init --recursive` (or pass `-D CAS_STACK_DIR=...`). | +| `CASBACnetStackDLL.h: No such file or directory` | Same - submodules not checked out. | +| Windows: *"No CMAKE_CXX_COMPILER could be found"* | Install Visual Studio with the "Desktop development with C++" workload, then re-run from a fresh terminal. | +| First build seems stuck for minutes | Normal - it's compiling ~600 stack files. Only the first build is slow. | +| App prints *"Failed to bind UDP port 47808"* | Another BACnet program is already using 47808. Stop it, or run with `--port `. | +| Client sends Who-Is but sees no I-Am | Firewall is blocking UDP 47808, or the client and device are on different subnets (Who-Is is a broadcast). Allow the port; test on the same subnet first. | diff --git a/docs/PICS.md b/docs/PICS.md new file mode 100644 index 0000000..54f9424 --- /dev/null +++ b/docs/PICS.md @@ -0,0 +1,413 @@ +# BACnet Protocol Implementation Conformance Statement (PICS) + +For the **BACnet B-BC (Building Controller) C++ example** - +see [README.md](../README.md). + +> This is the PICS **for the example as shipped**. It describes a tutorial +> device announcing itself as a Chipkin demo, not a product. When you turn this +> example into your own device, this document is one of the things you rewrite: +> the vendor, model and version rows all come from the +> `CHANGE ALL OF THIS BEFORE YOU SHIP` block at the top of `main.cpp`. The +> example has **not** been submitted for BTL certification, and it does not +> fully claim B-BC yet - see the T-VMT-I-B row in section 3 and +> [TUTORIAL.md](../TUTORIAL.md) for the known gaps. + +## 1. Product description + +| | | +|---|---| +| **Vendor Name** | Chipkin Automation Systems | +| **Vendor Identifier** | 389 | +| **Product Name** | CAS BACnet Stack Example - B-BC | +| **Product Model Number** | CAS BACnet Stack Example - B-BC | +| **Application Software Version** | 1.0.0 | +| **Firmware Revision** | 1.0.0 | +| **BACnet Protocol Version** | 1 | +| **BACnet Protocol Revision** | 24 | + +**Product Description:** a BACnet/IP Building Controller built on the CAS +BACnet Stack. It presents fifteen objects spanning read-only sensors, +commandable outputs, an intrinsic-alarming Analog Value with a writable +event-recipient list, a Schedule that writes both a local and a remote +object, Backup and Restore, and a Trend Log / Trend Log Multiple pair +retrievable by ReadRange. It is a tutorial for implementers of the B-BC +profile, and the series' largest single example. + +## 2. BACnet standardized device profile (Annex L) + +**B-BC - BACnet Building Controller.** + +This device claims exactly one profile. Because the B-BC requirements are a +superset of every simpler controller profile's (B-SS, B-SA, B-ASC, B-AAC) and +of B-GENERAL's, a conformant B-BC device also satisfies those profiles; that +is subsumption, not a second claim. + +## 3. BIBBs supported (Annex K) + +| BIBB | Description | Supported | +|---|---|:---:| +| DS-RP-A | Data Sharing - ReadProperty - A | Yes | +| DS-RP-B | Data Sharing - ReadProperty - B | Yes | +| DS-RPM-A | Data Sharing - ReadPropertyMultiple - A | Yes | +| DS-RPM-B | Data Sharing - ReadPropertyMultiple - B | Yes | +| DS-WP-A | Data Sharing - WriteProperty - A | Yes | +| DS-WP-B | Data Sharing - WriteProperty - B | Yes | +| DS-WPM-B | Data Sharing - WritePropertyMultiple - B | Yes | +| AE-N-I-B | Alarm and Event - Notification Internal - B | Yes | +| AE-ACK-B | Alarm and Event - ACK - B | Yes | +| AE-INFO-B | Alarm and Event - Information - B | Yes | +| AE-CRL-B | Alarm and Event - Recipient List - B | Yes | +| SCHED-E-B | Scheduling - External - B | Yes (local write live-verified; remote write correctly wired but not cross-instance wire-verified - see [TUTORIAL.md](../TUTORIAL.md)) | +| T-VMT-I-B | Trending - Viewing and Modifying Trends - Internal - B | Partial - proven live through Trend Log Multiple 1 ("Magenta"); Trend Log 1 ("Lilac") has a confirmed stack defect ([#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051)) that blocks its `Record_Count` from ever incrementing | +| T-ATR-B | Trending - Automated Trend Retrieval - B | Yes, via ReadRange - live-verified against Trend Log Multiple 1 ("Magenta") | +| DM-DDB-A | Device Management - Dynamic Device Binding - A | Yes | +| DM-DDB-B | Device Management - Dynamic Device Binding - B | Yes | +| DM-DOB-B | Device Management - Dynamic Object Binding - B | Yes | +| DM-DCC-B | Device Management - Device Communication Control - B | Yes | +| DM-TS-B | Device Management - Time Synchronization - B | Yes | +| DM-UTC-B | Device Management - UTC Time Synchronization - B | Yes | +| DM-RD-B | Device Management - ReinitializeDevice - B | Yes | +| DM-BR-B | Device Management - Backup and Restore - B | Yes | + +No other BIBBs are supported. In particular this device does **not** support +DS-COV-B (COV subscriptions), AE-ESUM-B (GetAlarmSummary - not required at or +above Protocol_Revision 13, deliberately omitted), or any access-control or +life-safety BIBB. + +## 4. Application services supported + +| Service | Initiate | Execute | +|---|:---:|:---:| +| ReadProperty | no | **yes** | +| ReadPropertyMultiple | no | **yes** | +| WriteProperty | **yes** (Schedule 1's local + remote write) | **yes** | +| WritePropertyMultiple | no | **yes** | +| Who-Is | **yes** (start-up) | **yes** | +| I-Am | **yes** | - | +| Who-Has | no | **yes** | +| I-Have | **yes** | - | +| UnconfirmedEventNotification | **yes** (to Notification Class 1's recipients) | - | +| AcknowledgeAlarm | no | **yes** | +| GetEventInformation | no | **yes** | +| DeviceCommunicationControl | no | **yes** | +| ReinitializeDevice | no | **yes** (COLDSTART, WARMSTART, and the five backup/restore states) | +| TimeSynchronization | no | **yes** | +| UTCTimeSynchronization | no | **yes** | +| AtomicReadFile | no | **yes** | +| AtomicWriteFile | no | **yes** | +| ReadRange | no | **yes** (against `Log_Buffer` of either Trend Log) | + +An unsolicited I-Am is broadcast to the local subnet at start-up and after a +ReinitializeDevice restart, as well as in response to Who-Is. This device also +initiates a Who-Is at start-up (DM-DDB-A) and initiates WriteProperty when +Schedule 1 ("Saffron") fires a transition, targeting both a local object and a +remote peer device's object (SCHED-E-B). + +## 5. Segmentation capability + +Segmentation is **not supported** in either direction +(`Segmentation_Supported` = `no-segmentation`). `Max_APDU_Length_Accepted` is +1476 octets, the BACnet/IP maximum. + +## 6. Standard object types supported + +No object is dynamically creatable or deletable. + +| Object type | Instance | Object_Name | Optional properties supported | +|---|:---:|---|---| +| Device | 389005 | Rainbow | Description | +| Analog Input | 1 | Bronze | - | +| Binary Input | 1 | Emerald | - | +| Multi-state Input | 1 | Hot Pink | State_Text | +| Analog Output | 1 | Chartreuse | - (commandable: writable Present_Value) | +| Binary Output | 1 | Fuchsia | - (commandable: writable Present_Value) | +| Multi-state Output | 1 | Indigo | - (commandable: writable Present_Value) | +| Analog Value | 1 | Diamond | writable Present_Value; intrinsic OutOfRange alarming | +| Notification Class | 1 | Crimson | writable Recipient_List (AE-CRL-B) | +| Network Port | 1 | Vermilion | - | +| Schedule | 1 | Saffron | - | +| Calendar | 1 | Cream | Date_List not populated - see [TUTORIAL.md](../TUTORIAL.md) | +| File | 1 | Ivory | writable Archive | +| Trend Log | 1 | Lilac | - (Record_Count does not increment - see [TUTORIAL.md](../TUTORIAL.md)) | +| Trend Log Multiple | 1 | Magenta | - | + +The device instance is configurable at run time with `--deviceID` (BACnet +requires the device instance to be configurable). + +## 7. Data link layer options + +**BACnet/IP (Annex J)**, UDP port 47808 (0xBAC0) by default, configurable at run +time with `--port`. + +BBMD is not supported, Foreign Device registration is not supported, and +BACnet/SC, MS/TP, Ethernet (Annex H) and PTP are not supported. + +## 8. Device address binding + +Static device binding is **not supported**. Dynamic device address binding +(DM-DDB-A) is used: the stack's own Device Address Binding cache is engaged +whenever this device names a peer by device instance rather than address - +the Schedule 1 ("Saffron") SCHED-E-B remote write target, and optionally a +Notification Class recipient named by device instance. Both cases chase the +peer with Who-Is and start delivering once it resolves; neither requires a +static entry. + +## 9. Networking options + +None. The device is not a router, not a BBMD, and does not register as a +foreign device. + +## 10. Character sets supported + +UTF-8 (ANSI X3.4). Supporting a character set does not imply the device can +handle data in all character sets. + +## 11. Objects and properties + + +Every object this example creates, and every REQUIRED property of each (per ANSI/ASHRAE 135-2024 clause 12 and the stack's `docs/property-profile-reference.md`), plus the optional properties the example turns on. **Served by** says who answers a ReadProperty: the **stack** generates it, or the **app** serves it from a `GetProperty*` callback in `main.cpp`. A ⚠ row is a required property the app does not serve and the stack would fill with a default - that is a defect, not a feature. + +### Device 389005 "Rainbow" - the device itself; the instance is configurable with --deviceID. The stack rows are device-wide facts only the stack knows - the protocol version and revision it implements, the services and object types it was configured with, the live object list and address-binding table. The accepted rows are the stack's configured defaults for APDU limits, segmentation, system status and database revision; an application that answered them from its own constants could contradict the stack, so this example does not + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| System_Status | BACnetDeviceStatus | stack default, accepted (Generic Enumerated default: `0`) | no | +| Vendor_Name | CharacterString | app | no | +| Vendor_Identifier | Unsigned16 | app | no | +| Model_Name | CharacterString | app | no | +| Firmware_Revision | CharacterString | app | no | +| Application_Software_Version | CharacterString | app | no | +| Description *(optional, enabled)* | CharacterString | app | no | +| Protocol_Version | Unsigned | stack | no | +| Protocol_Revision | Unsigned | stack | no | +| Protocol_Services_Supported | BACnetServicesSupported | stack | no | +| Protocol_Object_Types_Supported | BACnetObjectTypesSupported | stack | no | +| Object_List | BACnetARRAY[N] of BACnetObjectIdentifier | stack | no | +| Max_APDU_Length_Accepted | Unsigned | stack default, accepted (`CAS_BACNET_DEVICE_DEFAULT_MAX_APDU_LENGTH_ACCEPTED`) | no | +| Segmentation_Supported | BACnetSegmentation | stack default, accepted (`BACnetSegmentation::noSegmentation`) | no | +| APDU_Timeout | Unsigned | stack default, accepted (`CAS_BACNET_DEVICE_DEFAULT_APDU_TIMEOUT`) | no | +| Number_Of_APDU_Retries | Unsigned | stack default, accepted (`CAS_BACNET_DEVICE_DEFAULT_NUMBER_OF_APDU_RETRIES`) | no | +| Device_Address_Binding | BACnetLIST of BACnetAddressBinding | stack | no | +| Database_Revision | Unsigned | stack default, accepted (Generic UnsignedInteger default: `0`) | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Analog Input 1 "Bronze" - REAL, degrees Celsius; starts at 21.5. Also the logged point for Trend Log 1 (Lilac) and one of the three logged points for Trend Log Multiple 1 (Magenta) + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | Real | app | no | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Units | BACnetEngineeringUnits | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Binary Input 1 "Emerald" - starts inactive + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | BACnetBinaryPV | app | no | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Polarity | BACnetPolarity | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Multi-state Input 1 "Hot Pink" - state 1 of 3: On, Off, Auto + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | Unsigned | app | no | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Number_Of_States | Unsigned | app | no | +| State_Text *(optional, enabled)* | BACnetARRAY[N] of CharacterString | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Analog Output 1 "Chartreuse" - commandable; 16-slot Priority_Array, Relinquish_Default 20.0 C, served by GetPropertyReal. Present_Value, Priority_Array and Current_Command_Priority are resolved by the stack from the priority array; also Schedule 1 (Saffron)'s local write target at priority 8, and one of the three logged points for Trend Log Multiple 1 (Magenta). Verified live: a WriteProperty of 42.5 at priority 8 reads back correctly + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | Real | stack | yes | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Units | BACnetEngineeringUnits | app | no | +| Priority_Array | BACnetARRAY[16] of BACnetOptionalReal | stack | no | +| Relinquish_Default | Real | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | +| Current_Command_Priority | BACnetOptionalUnsigned | stack | no | + +### Binary Output 1 "Fuchsia" - commandable; 16-slot Priority_Array, Relinquish_Default inactive, served by GetPropertyEnumerated + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | BACnetBinaryPV | stack | yes | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Polarity | BACnetPolarity | app | no | +| Priority_Array | BACnetARRAY[16] of BACnetOptionalBinaryPV | stack | no | +| Relinquish_Default | BACnetBinaryPV | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | +| Current_Command_Priority | BACnetOptionalUnsigned | stack | no | + +### Multi-state Output 1 "Indigo" - commandable; 16-slot Priority_Array, Relinquish_Default state 1 of 3, served by GetPropertyUnsignedInteger + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | Unsigned | stack | yes | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Number_Of_States | Unsigned | app | no | +| Priority_Array | BACnetARRAY[16] of BACnetOptionalUnsigned | stack | no | +| Relinquish_Default | Unsigned | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | +| Current_Command_Priority | BACnetOptionalUnsigned | stack | no | + +### Analog Value 1 "Diamond" - the alarm-capable process value (AE-N-I-B). Event_State is NOT a stack default here - it is genuinely computed, because this example arms an intrinsic OutOfRange algorithm on Diamond (SetIntrinsicOutOfRangeAlgorithm + SetAlarmsAndEventsForObjectEnabled); it is marked accepted only because property-profile-reference.md's generic table does not know an algorithm was armed. A client writes Present_Value across 10-90 percent to fire an EventNotification to Notification Class 1 (Crimson). Verified live: writing 95.0 transitions Event_State to high-limit. Also one of the three logged points for Trend Log Multiple 1 (Magenta) + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | Real | stack | yes | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Units | BACnetEngineeringUnits | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Notification Class 1 "Crimson" - AE-CRL-B. Priority, Ack_Required and Recipient_List are NOT stack DEFAULTS - they are genuinely populated, by BACnetStack_AddNotificationClassObject (Priority, Ack_Required) and BACnetStack_AddRecipientToNotificationClass (Recipient_List) at start-up. They are marked accepted only because property-profile-reference.md's generic per-type table does not know about this object-specific host-configuration API and so cannot credit them as stack-served. Recipient_List is also registered writable (BACnetStack_SetPropertyWritable) so a client can redirect it at run time; the stack decodes and stores a WriteProperty to it itself. Verified live: Recipient_List reads back the seeded destination. Named Crimson (not Jade, the B-AAC seed's naming defect for this object type - see colour-table.md, Jade is lighting_output's colour) per docs/colour-table.md + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Priority | BACnetARRAY[3] of Unsigned | stack default, accepted (Generic UnsignedInteger default: `0`) | no | +| Ack_Required | BACnetEventTransitionBits | stack default, accepted (Generic BitString default: empty bitstring (zero bits - NOT ) | no | +| Recipient_List | BACnetLIST of BACnetDestination | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | yes | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Network Port 1 "Vermilion" - BACnet/IP; Network_Type and Protocol_Level are set from BACnetStack_AddNetworkPortObject()'s arguments (IPv4, BACnet Application) at start-up, not a GetProperty callback like the object's other app-served rows; Changes_Pending is likewise computed and answered natively by the stack's Network Port object. Reliability has no fault condition this example detects, so it is accepted at the generic default (normal) + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Status_Flags | BACnetStatusFlags | stack | no | +| Reliability | BACnetReliability | stack default, accepted (Generic Enumerated default: `0`) | no | +| Out_Of_Service | Boolean | app | no | +| Network_Type | BACnetNetworkType | app | no | +| Protocol_Level | BACnetProtocolLevel | app | no | +| Changes_Pending | Boolean | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Schedule 1 "Saffron" - SCHED-E-B. Present_Value, Effective_Period, Schedule_Default, List_Of_Object_Property_References, Priority_For_Writing and Status_Flags are NOT stack DEFAULTS - they are genuinely held and served by the stack's Schedule engine (BACnetStack_AddScheduleObject plus the BACnetStack_SetSchedule*/AddSchedule* configuration calls in main.cpp). List_Of_Object_Property_References has TWO entries (each BACnetStack_AddScheduleObjectPropertyReference call appends): a LOCAL one at Analog Output 1 (Chartreuse) Present_Value, and a REMOTE one at a peer device's (default instance 389002, e.g. a locally-built B-SA-CPP) Analog Output 1 Present_Value - the SCHED-E-B / F-EXTWRITE remote fan-out. The local write is proven (inherited from B-AAC's SCHED-I-B); the remote write is correct, documented API usage but was not wire-verified end-to-end this session because two example instances on different UDP ports on one host cannot discover each other by broadcast - see TODO.md item 3. One weekly transition (Monday 08:00) and one calendar-date exception (2026-12-25, via the inline calendar-entry form) are seeded at start-up; the 's' key (common/'s DemoAdvance) adds a transition for right now so the change can be observed without waiting for the wall clock + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | Any | stack default, accepted (Stack-generated if commandable (resolves the priority array)) | no | +| Effective_Period | BACnetDateRange | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | no | +| Schedule_Default | Any | stack | no | +| List_Of_Object_Property_References | BACnetLIST of BACnetDeviceObjectPropertyReference | stack | no | +| Priority_For_Writing | Unsigned(1..16) | stack default, accepted (Generic UnsignedInteger default: `0`) | no | +| Status_Flags | BACnetStatusFlags | stack | no | +| Reliability | BACnetReliability | app | no | +| Out_Of_Service | Boolean | app | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Calendar 1 "Cream" - exists for SCHED-E-B completeness alongside Saffron's exception, but its Date_List cannot be populated through the customer API (cas-bacnet-stack issue #963 - no read path for a Calendar object's Date_List; the only generic constructed-property callback is test-tool-only). Present_Value therefore always answers false rather than evaluating a Date_List that is never populated - see TODO.md + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Present_Value | Boolean | app | no | +| Date_List | BACnetLIST of BACnetCalendarEntry | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### File 1 "Ivory" - DM-BR-B. A small in-memory STREAM-access file that AtomicReadFile/AtomicWriteFile operate on, and the backup/restore payload for ReinitializeDevice's STARTBACKUP/ENDBACKUP/STARTRESTORE/ENDRESTORE/ABORTRESTORE states (2-6), all accepted by ReinitializeDevice alongside COLDSTART/WARMSTART. BACnetStack_SetBackupAndRestoreEnabled plus the four Prepare/Complete Backup/Restore callbacks are registered. Verified live: File_Size reads 0 (nothing written yet this session) and a WriteProperty of Archive=true reads back correctly + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| File_Type | CharacterString | app | no | +| File_Size | Unsigned | app | no | +| Modification_Date | BACnetDateTime | app | no | +| Archive | Boolean | app | yes | +| Read_Only | Boolean | app | no | +| File_Access_Method | BACnetFileAccessMethod | stack | no | +| Property_List | BACnetARRAY[N] of BACnetPropertyIdentifier | stack | no | + +### Trend Log 1 "Lilac" - T-VMT-I-B / T-ATR-B. Enable, Stop_When_Full, Buffer_Size, Log_Buffer, Record_Count, Total_Record_Count and Logging_Type are NOT stack defaults - they are genuinely held and served by the stack's Trend Log engine (BACnetStack_AddTrendLogObject + SetTrendLogTypeToPolled + SetTrendLogStartStopTime), marked accepted only because property-profile-reference.md's generic table does not know about this host-configuration API. Polls Analog Input 1 (Bronze) Present_Value every second. Log_Buffer is readable only via ReadRange (a plain ReadProperty is rejected with Error(OBJECT, READ_ACCESS_DENIED) - verified live); ReadRange itself was verified live against Trend Log Multiple 1 (Magenta), not this object - see the note there and TODO.md item 1. KNOWN GAP: calling SetTrendLogStartStopTime on this object reproducibly leaves Record_Count at 0 forever regardless of the values passed (filed as cas-bacnet-stack#2051); this object therefore demonstrates the SetTrendLogStartStopTime call's correct usage but will read Record_Count=0 in a live demo. Also KNOWN: BACnetStack_AddTrendLogObject alone causes a continuous non-fatal internal log flood (cas-bacnet-stack#2050, same class as B-ACC's #2045 for Event Log) - device functionality is unaffected + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Enable | Boolean | stack default, accepted (Generic Boolean default: `false`) | no | +| Stop_When_Full | Boolean | stack default, accepted (Generic Boolean default: `false`) | no | +| Buffer_Size | Unsigned32 | stack default, accepted (Generic UnsignedInteger default: `0`) | no | +| Log_Buffer | BACnetLIST of BACnetLogRecord | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | no | +| Record_Count | Unsigned32 | stack default, accepted (Generic UnsignedInteger default: `0`) | no | +| Total_Record_Count | Unsigned32 | stack default, accepted (Generic UnsignedInteger default: `0`) | no | +| Logging_Type | BACnetLoggingType | stack default, accepted (Generic Enumerated default: `0`) | no | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | + +### Trend Log Multiple 1 "Magenta" - T-VMT-I-B / T-ATR-B. Enable is NOT a stack default - it is genuinely held and served by the stack's Trend Log Multiple engine (BACnetStack_AddTrendLogMultipleObject + AddLoggedObjectToTrendLogMultiple x3 + SetTrendLogTypeToPolled), marked accepted only because property-profile-reference.md's generic table does not know about this host-configuration API. Polls three points every second: Analog Input 1 (Bronze), Analog Value 1 (Diamond) and Analog Output 1 (Chartreuse) Present_Value. THIS is the example's working, live-verified polled-logging + ReadRange demonstration (unlike Lilac - see TODO.md item 1): Record_Count climbed from 0 to 150+ across several live runs, and ReadRange (RangeByPosition, first=1, count=5) returned real LogMultipleRecord entries. Also affected by the same AddTrendLogObject-family log-flood as Lilac (cas-bacnet-stack#2050) - non-fatal + +| Property | Datatype | Served by | Writable | +|---|---|---|:---:| +| Object_Identifier | BACnetObjectIdentifier | stack | no | +| Object_Name | CharacterString | app | no | +| Object_Type | BACnetObjectType | stack | no | +| Status_Flags | BACnetStatusFlags | stack | no | +| Event_State | BACnetEventState | stack default, accepted (Generic Enumerated default: `0`) | no | +| Enable | Boolean | stack default, accepted (Generic Boolean default: `false`) | no | + + + +## 12. References + +- ANSI/ASHRAE Standard 135-2024, Annex A (PICS template), Annex K (BIBBs), + Annex L (device profiles), Clause 12 (object types), Clause 13 + (alarm and event services). +- [README.md](../README.md) - what this example is and how to build it. +- [TUTORIAL.md](../TUTORIAL.md) - how to extend it, and how to keep this + document honest when you do. +- [TODO.md](../TODO.md) - full detail on the known gaps referenced above. diff --git a/docs/objects.json b/docs/objects.json index bca8bd0..8a4f4d7 100644 --- a/docs/objects.json +++ b/docs/objects.json @@ -1,5 +1,38 @@ { "objects": [ + { + "type": "Device", + "instance": 389005, + "name": "Rainbow", + "app": [ + "Object_Name", + "Description", + "Vendor_Name", + "Vendor_Identifier", + "Model_Name", + "Firmware_Revision", + "Application_Software_Version" + ], + "enabled": ["Description"], + "writable": [], + "accepted": [ + "System_Status", + "Max_APDU_Length_Accepted", + "Segmentation_Supported", + "APDU_Timeout", + "Number_Of_APDU_Retries", + "Database_Revision" + ], + "note": "the device itself; the instance is configurable with --deviceID. The stack rows are device-wide facts only the stack knows - the protocol version and revision it implements, the services and object types it was configured with, the live object list and address-binding table. The accepted rows are the stack's configured defaults for APDU limits, segmentation, system status and database revision; an application that answered them from its own constants could contradict the stack, so this example does not", + "stack": [ + "Object_List", + "Protocol_Version", + "Protocol_Revision", + "Protocol_Services_Supported", + "Protocol_Object_Types_Supported", + "Device_Address_Binding" + ] + }, { "type": "Analog Input", "instance": 1, diff --git a/main.cpp b/main.cpp index ab3afaa..8b4db40 100644 --- a/main.cpp +++ b/main.cpp @@ -121,7 +121,8 @@ static const char* APP_NAME = "BACnet B-BC (Building Controller) Example - C++"; static const char* APP_VERSION = "1.0.0"; // The device instance. BACnet requires this to be configurable, so it defaults -// to 389005 and can be overridden on the command line with --deviceID. +// to 389005 and can be overridden on the command line with --deviceID. Keep it +// configurable in your product: it must be unique across the internetwork. static uint32_t g_deviceInstance = 389005; // ---- Device identity: CHANGE ALL OF THIS BEFORE YOU SHIP -------------------- @@ -130,6 +131,9 @@ static uint32_t g_deviceInstance = 389005; // site announcing itself as a Chipkin demo. None of it is cosmetic: // Object_Name must be unique across the BACnet internetwork, and Model_Name / // Vendor_Identifier are what a building operator uses to identify your device. +// +// This block is the ship checklist. Every constant below has a note saying what +// to change it to; nothing here is safe to leave at its example value. // ----------------------------------------------------------------------------- // Your BACnet Vendor Identifier. 389 = Chipkin Automation Systems; change this @@ -137,7 +141,20 @@ static uint32_t g_deviceInstance = 389005; // by ASHRAE - request one (free) at https://bacnet.org/assigned-vendor-ids/. // Update VENDOR_NAME below to match. static const uint32_t VENDOR_IDENTIFIER = 389; + +// The Device object's Object_Name. +// +// THIS IS THE ONE THAT WILL BITE YOU. Object_Name must be unique across the +// whole BACnet internetwork, and here it is a COMPILE-TIME constant. The device +// instance is runtime-configurable via --deviceID, so it is easy to ship two +// units, configure their instances correctly, and still have BOTH announce +// Object_Name "Rainbow" - a spec violation, and a hard BTL failure. In a real +// product Object_Name must be per-unit configurable too: derive it from a serial +// number, DIP switches, a config file, or add a --deviceName argument. static const char* DEVICE_NAME = "Rainbow"; + +// The Device object's Description. Change it to what YOUR device actually is; +// this string describes this tutorial. static const char* DEVICE_DESCRIPTION = "Chipkin CAS BACnet Stack example - B-BC (Building Controller) profile, the " "series capstone. Demonstrates DS-RP/RPM/WP/WPM-A/B, intrinsic alarming " @@ -145,14 +162,22 @@ static const char* DEVICE_DESCRIPTION = "(T-VMT-I-B / T-ATR-B), DM-DCC-B, DM-TS-B / DM-UTC-B, DM-RD-B, and DM-BR-B."; // Device identity strings (read by clients, and used to populate I-Am). +// VENDOR_NAME - your company name; it must match VENDOR_IDENTIFIER above. +// MODEL_NAME - your model designation. This is what a building operator reads +// to identify your device in a discovery tool. static const char* VENDOR_NAME = "Chipkin Automation Systems"; static const char* MODEL_NAME = "CAS BACnet Stack Example - B-BC"; // DeviceCommunicationControl password. A management station may include a password // with a DeviceCommunicationControl (or ReinitializeDevice) request; the device // accepts the command only if it matches. Set to NULL/empty to accept any request -// (no password required). Change this to your device's secret before shipping. +// (no password required). Change this to your device's secret before shipping - +// it crosses the wire in PLAINTEXT, so treat it as a guard against accidents, +// not a security boundary. static const char* DCC_PASSWORD = ""; // "" = no password required + +// FIRMWARE_REVISION / APPLICATION_SOFTWARE_VERSION - your real versions. Wire +// them to your build rather than hard-coding a number that will go stale. static const char* FIRMWARE_REVISION = "1.0.0"; static const char* APPLICATION_SOFTWARE_VERSION = "1.0.0";