diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7513475..588a03d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,6 +1,7 @@
-# Build the B-ASC 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-ASC 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.
@@ -24,17 +25,15 @@ jobs:
fail-fast: false
matrix:
include:
- # windows-2022, not windows-latest: the stack's vcxproj names the v143 (VS 2022)
- # toolset; newer images may not carry it.
+ # windows-2022 pins the VS 2022 (v143) toolset the released binaries are built
+ # with, so the published metrics stay comparable release to release.
- os: windows-2022
artifact: BACnetExampleBASC-windows-x64
exe: build/Release/BACnetExampleBASC.exe
- lib: submodules/cas-bacnet-stack/bin/CASBACnetStack_x64_Release.lib
metrics: metrics-windows.json
- os: ubuntu-latest
artifact: BACnetExampleBASC-linux-x64
exe: build/BACnetExampleBASC
- 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": "BACnetExampleBASC",
"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 a716aa7..3dbf72e 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -2,45 +2,57 @@
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 the BACnet **B-ASC (Application Specific Controller)**
-device profile using the CAS BACnet Stack. It is one of a series - one git repo
-per BACnet profile - and builds on the B-SA (Smart Actuator) example by adding
-DeviceCommunicationControl (DM-DCC-B). The top priority is that the code reads
-like a tutorial a customer can learn from and copy-paste. Favour clarity over
-cleverness.
+A **tutorial** C++ example that implements the BACnet **B-ASC (Application
+Specific Controller)** device profile using the CAS BACnet Stack. It is one of
+a series - one git repo per BACnet profile - and adds
+DeviceCommunicationControl (DM-DCC-B) and commandable outputs (DS-WP-B) on top
+of the shared read-only sensor objects every example in the series carries.
+The top priority is that the code reads like a tutorial a customer can learn
+from and copy-paste. Favour clarity over cleverness.
## Layout
This repository is self-contained:
- `main.cpp` - the example device.
-- `common/` - the shared helper, vendored in-repo (not referenced via a path
- outside the repository).
+- `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. 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.
- `submodules/cas-bacnet-stack/` - the **CAS BACnet Stack** as a git submodule
- (private). After cloning, run `git submodule update --init --recursive`.
+ (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.
## 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:
+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-ASC-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 compiles the whole stack (~600 files) once and takes a
-few minutes; the example itself then builds in seconds, and later incremental
-rebuilds are fast. Use `-D CAS_STACK_DIR=...` only if your stack lives outside
-the bundled submodule. The adapter also offers a SOURCE mode (compiles the
-stack straight into the executable, no library build); this example builds and
-ships STATIC only.
+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 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
@@ -93,6 +105,9 @@ There are no unit tests; verification is behavioural:
5. **DeviceCommunicationControl**: confirm `disable-initiation` and `enable`
SimpleACK, the deprecated `disable` is rejected (service-request-denied), and a
wrong password (if `DCC_PASSWORD` is set) is rejected (password-failure).
+6. If you changed the objects or their properties, regenerate `docs/PICS.md`
+ (`python tools/gen-objects-properties.py BACnetProfileExample-B-ASC-CPP` from
+ the series root) and confirm no row comes out flagged with ⚠.
## Releasing
@@ -101,6 +116,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 9623f72..cd75fd4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,59 @@ 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 — documentation restructure, SOURCE link
+
+- **README.md cut down to this example only.** Removed the series "start
+ here" framing, the generic device-profile explainer, the "What the profile
+ requires" prose (the BIBBs table already said this), "Before you ship" (its
+ per-field guidance moved into code comments in `main.cpp`, see below), "Get
+ the code", "Link mode", "Troubleshooting", "Extending the example", and
+ "Objects and properties" (now generated into `docs/PICS.md` instead).
+ Added a prebuilt-binary release link and pointers to the two new documents
+ near the top.
+- **`TUTORIAL.md` added** - the extending/reviewing material that used to
+ bloat the README: the "Add a second analog input" silent-failure walk-through,
+ what each object type (including the three commandable outputs) needs the
+ app to serve, a Served-by breakdown for both a plain object (Analog Input 1)
+ and a commandable one (Analog Output 1), the DeviceCommunicationControl
+ `*errorCode` contract, "Reviewing your device", "Using this example as the
+ base for a real product" (what to copy out of `common/`, calling
+ `BACnetStack_Tick()` correctly), and Troubleshooting.
+- **`docs/PICS.md` added** - an ANSI/ASHRAE 135 Annex A format Protocol
+ Implementation Conformance Statement, with the objects-and-properties table
+ generated from `docs/objects.json` (`tools/gen-objects-properties.py`,
+ zero ⚠ rows).
+- **`docs/objects.json`'s Device entry gained a `stack` list** separate from
+ `accepted`, matching the shape the rest of the series uses: `Object_List`,
+ `Protocol_Version`, `Protocol_Revision`, `Protocol_Services_Supported`,
+ `Protocol_Object_Types_Supported` and `Device_Address_Binding` are
+ device-wide facts the stack computes (rendered as plain `stack`, not `stack
+ default, accepted`); `accepted` now holds only the stack's configured
+ defaults this example does not override (`System_Status`,
+ `Max_APDU_Length_Accepted`, `Segmentation_Supported`, `APDU_Timeout`,
+ `Number_Of_APDU_Retries`, `Database_Revision`).
+- **Build switched from a prebuilt STATIC library to the adapter's default
+ SOURCE mode**: `cmake -B build -S .` / `cmake --build build --config
+ Release` compiles the stack straight into the executable, with no
+ `tools/build-stack-static.sh` pre-step and no `-DCAS_BACNET_STACK_LINK=...`
+ flag. `CMakeLists.txt`'s header comment, `AGENTS.md`, and
+ `.github/workflows/release.yml` (drops the static-library cache/build steps
+ and the matrix `lib:` entries, asserts `CAS_BACNET_STACK_LINK=SOURCE`, sets
+ `"link_mode": "SOURCE"` in the published metrics JSON, and packages
+ `TUTORIAL.md` / `docs/PICS.md` alongside the binaries) now match.
+- **`main.cpp`'s `CHANGE ALL OF THIS BEFORE YOU SHIP` block absorbed the
+ README's "Before you ship" table** as per-field comments, including the
+ `DEVICE_NAME` internetwork-uniqueness warning and the DCC password
+ plaintext-on-the-wire note.
+- **Footprint table left as-is with a refresh note added**: the published
+ v1.2.0 numbers were measured from a STATIC-linked binary; the next release
+ refreshes them from the SOURCE-mode build now documented.
+- Corrected the README's "Expected output" sample, which had dropped the
+ `(Network Port 1)` suffix the binary actually prints on the `Listening for
+ BACnet/IP` and start-up `TX` lines.
+
## [1.2.0] - 2026-09-15
### Changed — STATIC link, generated README blocks
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb06275..9c95638 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-ASC-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/BACnetExampleBASC (Linux/macOS)
diff --git a/README.md b/README.md
index 6ef9fb3..79ceeb2 100644
--- a/README.md
+++ b/README.md
@@ -7,107 +7,24 @@ It listens on **BACnet/IP (UDP 47808)**, answers **ReadProperty**, accepts
**WriteProperty** to its commandable outputs, responds to
**DeviceCommunicationControl**, and is discoverable via **Who-Is / I-Am**.
-Part of the CAS BACnet Stack **BACnet profile example series** - one repository
-per BACnet device profile. This example claims **only** B-ASC.
+**[Download a prebuilt binary](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP/releases)**
+(Windows and Linux x64) - or build it yourself, see [Build](#build) below.
-Reading order: this repository stands on its own — **you can start here.** If you also want the
-gentler introductions to the shared sensor/actuator objects, [B-SS (Smart
-Sensor)](https://github.com/chipkin/BACnetProfileExample-B-SS-CPP) is the first example in the
-series and [B-SA (Smart Actuator)](https://github.com/chipkin/BACnetProfileExample-B-SA-CPP) the
-second; this is the third and repeats everything it needs.
+- **[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.2.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.1.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`.
>
> **Protocol_Revision** is the revision of the ASHRAE 135 standard a device claims to conform
> to. It is a number every BACnet device advertises, and it changes real behaviour: at revision
> 20 and above, for example, the deprecated plain `disable` form of
-> DeviceCommunicationControl must be rejected (see that section below).
-
-## Quickstart
-
-You need a CAS BACnet Stack licence and access to its private submodule (see
-[Requires the CAS BACnet Stack](#requires-the-cas-bacnet-stack-licensed-product)).
-Then:
-
-```bash
-git clone --recursive https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP.git
-cd BACnetProfileExample-B-ASC-CPP
-tools/build-stack-static.sh BACnetProfileExample-B-ASC-CPP # from the series root; builds the static library
-cmake -B build -S . -DCAS_BACNET_STACK_LINK=STATIC
-cmake --build build --config Release
-./build/Release/BACnetExampleBASC.exe # Windows; drop Release/ on Linux
-```
-
-The device announces itself, answers Who-Is, and prints `Press 'h' for help`.
-
-> **You will see one or more red `Error:` lines at start-up. The device is fine** —
-> it hears its own broadcast I-Am and the stack logs a benign decode cascade. See
-> [Troubleshooting](#troubleshooting).
-
-The rest of this document explains *what a B-ASC is* and *why the code is shaped
-the way it is*. If you just want it running, you are already done.
-
-This is the third example in the series. It builds directly on the
-[B-SA (Smart Actuator)](https://github.com/chipkin/BACnetProfileExample-B-SA-CPP)
-example: same objects (three read-only inputs + three commandable outputs), plus
-one device-management capability - it answers **DeviceCommunicationControl**, so a
-management station can quiet or resume the device.
-
-## What is a B-ASC (BACnet Application Specific Controller) profile?
-
-A **device profile** is a standard "template" defined in Annex L of ANSI/ASHRAE
-135. It lists the capabilities a class of device must support so that any
-compliant client knows what to expect, and the BACnet Testing Laboratories (BTL)
-certify devices against it. (New to BACnet in general? See Chipkin's
-[What is BACnet?](https://docs.chipkin.com/protocols/bacnet/) guide.)
-
-**B-ASC (BACnet Application Specific Controller)** is a controller with limited
-resources, intended for a specific application - think a thermostat, a VAV box
-controller, or a fan-coil controller: it does one job, and it does not have the
-memory or CPU of a supervisory panel. Compared to a Smart Actuator, it
-adds the requirement to respond to communication-control messages.
-
-**Reading the capability names.** Each capability below is a **BIBB** (BACnet
-Interoperability Building Block) - the standard's unit of "this device can do this one
-thing." Every BIBB name ends in **-A** or **-B**:
-
-- **-A** = the **A side**, the device that *initiates* the request (a client - an operator
- workstation, a supervisory controller).
-- **-B** = the **B side**, the device that *responds* to it (a server - this example).
-
-So `DS-RP-B` reads as "Data Sharing, ReadProperty, B side": *answers* ReadProperty requests.
-A device profile is essentially a required list of BIBBs. This example implements only B-side
-BIBBs, because a B-ASC is a device that gets asked, not one that asks.
-
-**What the profile requires:**
-
-- **Data Sharing - ReadProperty - B side (DS-RP-B):** answer **ReadProperty**.
-- **Data Sharing - WriteProperty - B side (DS-WP-B):** accept **WriteProperty** so
- a controller can drive its outputs.
-- **Device Management - DeviceCommunicationControl - B side (DM-DCC-B):** respond
- to **DeviceCommunicationControl** - a management station can tell the device to
- stop or resume communicating (optionally for a time period, optionally behind a
- password). This is what distinguishes a B-ASC from a B-SA.
-- **Device Management - Dynamic Device Binding - B side (DM-DDB-B):** answer
- **Who-Is** with **I-Am**, and announce itself with an unsolicited I-Am at
- start-up, so a client can discover the device.
-- **Device Management - Dynamic Object Binding - B side (DM-DOB-B):** answer
- **Who-Has** with **I-Have**, so a client can locate an object by name or ID.
-
-**What the profile does NOT require** - and this example therefore omits on
-purpose: **alarming / event reporting**, **scheduling**, and **trending**.
-
-**But it is still a full BACnet device.** Even a simple profile must present the
-standard object model - a **Device** object, a **Network Port** object (every
-device needs one), and its objects - and each object must expose all of its
-**required properties**. The CAS BACnet Stack generates most of those
-automatically (Object_Identifier, Object_Type, Status_Flags,
-Object_List, Protocol_*, ...); this example supplies the handful that are
-application-specific. The result is conformant for **Protocol_Revision 24**.
+> DeviceCommunicationControl must be rejected (see [DeviceCommunicationControl](#devicecommunicationcontrol-the-b-asc-addition) below).
## DeviceCommunicationControl (the B-ASC addition)
@@ -221,42 +138,8 @@ claims exactly one profile.
| Multi-State Output | 1 | Indigo | writable (commandable) |
| Network Port | 1 | Vermilion | - |
-## 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** — see the note below. |
-| `MODEL_NAME` | `CAS BACnet Stack Example - B-ASC` | Your model designation. This is what a building operator reads to identify your device. |
-| `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. It crosses the wire in **plaintext** — it is a guard against accidents, not a security boundary. |
-| Device instance | `389003` (`--deviceID` overrides) | Must be unique on the internetwork. BACnet requires this to be configurable; keep it so. |
-
-> **`Object_Name` uniqueness is the one that will bite you.** The device instance
-> is runtime-configurable via `--deviceID`, but `DEVICE_NAME` is a compile-time
-> constant. Ship two units and configure their instances correctly, and **both
-> still announce `Object_Name "Rainbow"`** — a spec violation, and exactly the
-> uniqueness problem the code comments warn about. In a real product,
-> `Object_Name` must be per-unit configurable too (serial number, DIP switches,
-> a config file, or a `--deviceName` argument).
->
-> "Unique across the **BACnet internetwork**" means unique across *every* BACnet network
-> reachable from this one — all the IP subnets and MS/TP segments joined by BACnet routers,
-> which at a typical site means the whole building or campus, not just your local subnet. Two
-> devices with the same name on opposite sides of a router still collide.
->
-> Running several of these examples on one desk (or a classroom of students on one subnet)
-> hits this immediately: pass a different `--deviceID` to each, and expect the duplicate
-> `Object_Name` until you make it configurable.
-
-`main.cpp` marks this block with a `CHANGE ALL OF THIS BEFORE YOU SHIP` banner.
+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)
@@ -270,10 +153,10 @@ BACnet Stack license and access to that repository.
Chipkin:** or
sales@chipkin.com.
-You do not need a stack licence to *read* this example. Every file outside
-submodules/ is CC0 public domain, so once you have access to this repository you
-can review the approach and the amount of code involved before you buy. The licence
-is what lets you *build* it - that is the part the stack submodule gates.
+You do not need a stack licence to *read* this example, or to run a
+[prebuilt release binary](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP/releases).
+The licence is what lets you *build* it - that is the part the stack submodule
+gates.
## What's in this repository
@@ -281,10 +164,11 @@ 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). Built into a prebuilt **STATIC**
- library by the stack's own project files (`tools/build-stack-static.sh`),
- then linked - no DLL is shipped.
+ (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
@@ -304,69 +188,28 @@ This is a **self-contained** project. It ships:
- Debian/Ubuntu: `sudo apt install build-essential cmake git`
- macOS: `xcode-select --install` and `brew install cmake`
-## Get the code
+## Build
-Clone this repository **and its submodule** (the CAS BACnet Stack):
+CMake only, and the same two commands on every platform:
```bash
git clone --recursive https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP.git
cd BACnetProfileExample-B-ASC-CPP
-# already cloned without --recursive? fetch the submodule:
-git submodule update --init --recursive
-```
-
-## 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:
-
-```bash
-tools/build-stack-static.sh BACnetProfileExample-B-ASC-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
```
-> **The stack library build takes a few 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.
->
-> Build in parallel to cut that down substantially - this is worth doing on the first
-> build of the day, and essential if you are running a class through it:
->
-> ```bash
-> cmake --build build --config Release --parallel
-> ```
+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`.
-### 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.
-
-On MSVC the adapter also forces the static CRT (`/MT`) to match how the library is
-built — a mismatched runtime otherwise produces hundreds of `LNK2038` errors that
-look like a corrupt library.
-
-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.
-
## Run
```bash
@@ -383,33 +226,28 @@ Expected output:
BACnet B-ASC (Application Specific Controller) Example - C++ v1.2.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.
-TX 21 bytes to 192.168.3.255:47808 (broadcast)
+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 389003 ("Rainbow") ready. Vendor ID 389. Press 'h' for help.
-RX 21 bytes from 192.168.3.76:47808
-... (one or more red "Error:" lines - expected and benign; see Troubleshooting) ...
```
-The `RX`/`Error:` lines depend on what else is on your network, so they may appear
-earlier, later, or (on a quiet subnet) only as a single line. The device is ready as
-soon as the `Device ... ready` line prints.
-
-Those first three lines are worth reading: they tell you the **example** version,
-the **stack** version you actually linked, and the version of the vendored
-`common/` helper — which is how you tell whether this repo's copy has drifted from
-the rest of the series.
-
The `TX` line is the start-up I-Am the device broadcasts to announce itself. It
goes to the **local subnet broadcast** address (here `192.168.3.255`, computed
from the Network Port's interface), not the global `255.255.255.255`. As clients
-talk to the device you'll see `RX`/`TX` lines; a WriteProperty to an output prints
-a line such as `WriteProperty: Analog Output 1 (Chartreuse) <- 42.50 @ priority 8`,
-and a DeviceCommunicationControl prints e.g. `DeviceCommunicationControl:
+talk to the device you'll see `RX ... bytes from ...` and `TX ... bytes to ...`
+lines; a WriteProperty to an output prints a line such as `WriteProperty:
+Analog Output 1 (Chartreuse) <- 42.50 @ priority 8`, and a
+DeviceCommunicationControl prints e.g. `DeviceCommunicationControl:
disable-initiation (keep responding) (indefinitely)`.
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,
+> and a one-time BACnet/SC UUID notice). [TUTORIAL.md](TUTORIAL.md#troubleshooting)
+> explains both.
+
### Command-line options
| Option | Default | Meaning |
@@ -421,8 +259,7 @@ firewall. To use a different port, pass `--port` (see below).
### Interactive commands
-While the example runs, these keys are available (shared across all examples in
-the series):
+While the example runs, these keys are available:
| Key | Action |
|-----|--------|
@@ -431,409 +268,144 @@ the series):
| up arrow | Increase Analog Input 1 (`Bronze`) by 1.1. |
| down arrow | Decrease Analog Input 1 (`Bronze`) by 1.1. |
-## Verify
-
-You need a BACnet client to talk to the device. Any of these work:
+The up/down keys change the live `Present_Value` of the analog input, so a client
+re-reading it sees the new value.
-- [**CAS BACnet Explorer**](https://store.chipkin.com/products/tools/cas-bacnet-explorer) -
- Chipkin's commercial client (free trial), used for the steps below.
-- [**YABE**](https://sourceforge.net/projects/yetanotherbacnetexplorer/) ("Yet Another BACnet
- Explorer") - free and open source; enough to discover, browse, read, and write.
-- [**Wireshark**](https://www.wireshark.org/) with the `bvlc` display filter - free; shows you
- the actual packets rather than an object tree, which is the better choice when you want to
- understand the protocol or prove what went on the wire.
+## Verify
-Then:
+Use a BACnet client such as the
+[**CAS BACnet Explorer**](https://store.chipkin.com/products/tools/cas-bacnet-explorer):
1. **Discover** - send a **Who-Is**. The device replies with **I-Am** from
instance **389003** (vendor **389**). It also broadcasts an I-Am at start-up.
2. **Browse the object model** - the device shows eight objects: the Device
- (`Rainbow`), three inputs, three outputs, and the Network Port (`Vermilion`).
-3. **Read the Device** - ReadProperty `389003` -> `Object_Name` = `"Rainbow"`;
- `Protocol_Revision` = `24`; `Description` = the profile description string.
-4. **Command an output** - WriteProperty Analog Output `1` `Present_Value` = `42.5`
+ (`Rainbow`), three inputs, three outputs, and the Network Port
+ (`Vermilion`). Reading the Device's `Object_List` returns all eight.
+3. **Read the Device** - ReadProperty `389003` -> `Object_Name` returns
+ `"Rainbow"`; `Protocol_Revision` returns `24`; `Description` returns the
+ profile description string.
+4. **Read a sensor** - ReadProperty Analog Input `1` -> `Present_Value` returns
+ `21.5`; `Units` returns `degrees-Celsius`. Repeat for Binary Input `1`
+ (`"Emerald"`) and Multi-State Input `1` (`"Hot Pink"`).
+5. **Command an output** - WriteProperty Analog Output `1` `Present_Value` = `42.5`
at priority `8`; re-read `Present_Value` (`42.5`) and `Priority_Array[8]`
(`42.5`); write `NULL` at priority `8` to relinquish; `Present_Value` returns to
`20.0` (its `Relinquish_Default`). Repeat for Binary/Multi-State Output. A write
to a read-only *input*, or an out-of-range value, is rejected.
-5. **Communication control (the B-ASC test)** - send a **DeviceCommunicationControl**
+6. **Communication control (the B-ASC test)** - send a **DeviceCommunicationControl**
with `disable-initiation`: the device SimpleACKs and keeps answering reads but
stops initiating. Send `enable` to resume. (Sending the deprecated plain
`disable` returns `service-request-denied` at Protocol_Revision 24 - that is
correct.) If you set `DCC_PASSWORD`, a request with the wrong password is
rejected with `password-failure`.
-## Troubleshooting
-
-| Symptom | Cause / fix |
-|---------|-------------|
-| On start-up the app prints a wall of red `Error:` lines but the device works | **Expected — this is not your bug.** Two benign sources, both from the stack's own debug logging: (1) the device receives its **own** broadcast I-Am and logs a decode cascade (*"Services is not supported service=[0]"* … *"Failed to process the incoming NPDU"*) — any BACnet/IP device that listens for broadcasts hears itself; (2) a one-time *"UUID has not been set. A UUID must be set for the BACnetSC device to start."* — the stack starts a BACnet/SC (BACnet Secure Connect, the TLS/WebSocket-based transport added in ASHRAE 135-2020) datalink that these BACnet/IP-only examples never configure. It appears once and does not spam. How many red lines you see depends on subnet traffic: on a quiet network it can be a single line (just the UUID one); on a busy BACnet subnet the self-heard-broadcast decodes pile up into a wall. Either way the device is fine. |
-| CMake error: *"CAS BACnet Stack adapter not found under: ..."* | Submodules not initialized. Run `git submodule update --init --recursive` (or pass `-D CAS_STACK_DIR=...`). |
-| CMake error: *"CAS_BACNET_STACK_LINK=STATIC needs a prebuilt CAS BACnet Stack library"* | The static library has not been built yet. Run `tools/build-stack-static.sh BACnetProfileExample-B-ASC-CPP` from the series root, then re-run CMake. |
-| The device starts and prints `TX ... (broadcast)`, but no client ever sees it | Check the IP in that `TX` line against the subnet your BACnet client is on. The example picks the **first non-loopback adapter** the OS reports, which on a laptop with Hyper-V, WSL, VirtualBox or a VPN is frequently not your Wi-Fi/Ethernet. There is no `--interface` option yet; disable the unwanted virtual adapters, or run on a machine without them. (Also check the firewall row above.) |
-| `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. |
-| `git submodule update` fails with *Permission denied* / *repository not found* | The CAS BACnet Stack submodule is a **private** repo. You need a stack licence and access granted to your GitHub account, plus working SSH keys or a credential helper. See [Requires the CAS BACnet Stack](#requires-the-cas-bacnet-stack-licensed-product). |
-| App prints *"Failed to bind UDP port 47808"* | Another BACnet program is already using 47808. Stop it, or run with `--port `. |
-| DeviceCommunicationControl `disable` returns an error | Expected. The plain `disable` value is deprecated at Protocol_Revision >= 20; use `disable-initiation` instead. |
-| WriteProperty to an output is rejected | Write to the **output** objects, not the inputs (inputs are read-only sensors), and keep the value in range. |
-| Client sends Who-Is but sees no I-Am | Firewall is blocking UDP 47808, or the client and device are on different subnets. Allow the port; test on the same subnet first. |
-| Replies show an unexpected device instance or vendor | Another BACnet device is already answering on this host/port. On Linux/macOS two processes can share the port and both reply; on Windows the example asks for `SO_EXCLUSIVEADDRUSE` (`common/SimpleUDP.cpp`) so this shows up as a bind failure instead. Stop the other device, or use `--port`. |
-
-## Extending the example
-
-The example is intentionally small so it's easy to change.
-
-**Require a password for DeviceCommunicationControl** - set `DCC_PASSWORD` in
-`main.cpp` to a non-empty string; the callback then rejects mismatches with
-`password-failure`.
-
-**Add a second analog input.** Read this whole recipe before starting — the step
-that is easiest to miss is the one BTL will fail you for, and it fails SILENTLY.
-
-> **Why skipping a step is silent.** Most of the `GetProperty*` callbacks match
-> on **both** object type *and* instance (`objectInstance ==
-> ANALOG_INPUT_INSTANCE`), so a new instance falls through every one of them.
-> `GetPropertyBool` is the exception: it matches on type only, so
-> `Out_Of_Service` works for a new instance for free.
->
-> Falling through a callback does **not** reliably produce an error. The stack
-> errors only for the few 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 it **silently substitutes 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** |
->
-> **Doesn't the `errorCode` out-parameter fix this?** Only if you use it, and
-> only where it is right to. Each `GetProperty*` callback ends with a
-> `uint32_t* errorCode` that the stack presets to `success` and reads only when
-> you return `false`, so you *can* turn any decline into a chosen BACnet error.
-> But ending every callback with `*errorCode = unknown-property` breaks the
-> device: the stack's decline-and-fabricate path is what answers required
-> properties an application is not expected to serve — the Device's
-> `Max_APDU_Length_Accepted`, `APDU_Timeout` and `Number_Of_APDU_Retries` among
-> them. Name an error on the catch-all and those start failing instead of
-> answering. 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` (117)**. So the object actively claims to have the property, and then
-> answers with a default. Nothing on the wire says you forgot anything.
->
-> So a half-added object looks **healthy**. Add two and both report
-> `Object_Name "undefined"` — duplicate object names inside one device, a spec
-> violation and a hard BTL failure that every scan tool renders as fine.
-> **"It scanned OK" is the failure mode, not evidence against it.**
-
-```cpp
-// 1) a new instance number (in section 1).
-// Naming: a second object of a type is " 2" - so Analog Input 2 is
-// "Bronze 2", NOT a new colour. Each object TYPE owns one colour series-wide.
-static const uint32_t ANALOG_INPUT_2_INSTANCE = 2; // "Bronze 2"
-static float g_analogInput2Value = 23.1f; // its live value
-
-// 2) add the object (in main, next to the other BACnetStack_AddObject calls).
-// Check the return, like every other stack call in this file.
-if (!BACnetStack_AddObject(g_deviceInstance, OBJECT_TYPE_ANALOG_INPUT, ANALOG_INPUT_2_INSTANCE)) {
- printf("Error: Failed to add Analog Input 2 (Bronze 2).\n");
- return 1;
-}
-
-// 3) serve its Present_Value + Object_Name:
-// GetPropertyReal: AI/2 + Present_Value -> *value = g_analogInput2Value;
-// GetPropertyCharString: AI/2 + Object_Name -> "Bronze 2"
-
-// 4) DO NOT SKIP: serve its Units, in GetPropertyEnumerated.
-// Units is REQUIRED on an Analog Input. The existing check reads
-// objectInstance == ANALOG_INPUT_INSTANCE, which is instance 1 - so without
-// this, Analog Input 2's Units silently reads back no-units and the object is
-// NON-CONFORMANT while looking perfectly healthy.
-// GetPropertyEnumerated: AI/2 + Units -> *value = ENGINEERING_UNITS_DEGREES_CELSIUS;
-```
-
-Then read back every required property of Analog Input 2 and **diff it against
-Analog Input 1**. Anything returning `"undefined"`, `no-units`, or `0` where
-object 1 returns something real is a step you missed.
-
-### 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` |
-| Analog Output | `Object_Name`, `Units`, + the `Commandable` slots | `Priority_Array`, `Relinquish_Default` |
-| Binary Output | `Object_Name`, + the `Commandable` slots | `Polarity`, `Priority_Array`, `Relinquish_Default` |
-| Multi-State Output | `Object_Name`, + the `Commandable` slots | `Number_Of_States`, `Priority_Array`, `Relinquish_Default` |
+For a property-by-property review against the conformance statement, see
+[TUTORIAL.md](TUTORIAL.md).
-An **output**'s `Present_Value` is *not* served directly — the stack computes it
-from the `Priority_Array` slots your `GetPropertyBool`/typed getters return
-(see the `Commandable` struct). Add a new output instance to the `outputs[]`
-table in `main` and to `GetCommandable()`, or it will not be commandable.
+## Footprint
-### Who serves what: the application or the stack?
+Release-build sizes and start-up timing from release
+[v1.2.0](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP/releases/tag/v1.2.0)
+(`metrics-windows.json` / `metrics-linux.json`):
-For Analog Input 1, the whole picture:
+
+| Platform | Binary | Size | Start-up to `ready` | Stack commit |
+|---|---|---|---|---|
+| Windows x64 (windows-2022) | `BACnetExampleBASC.exe` | 3,250,176 bytes (~3.1 MiB) | 190 ms | `abd4cee1` |
+| Linux x64 (ubuntu-latest) | `BACnetExampleBASC` | 44,168 bytes (~43 KiB) | 110 ms | `abd4cee1` |
-| Property | Served by | How |
-|---|---|---|
-| `Object_Identifier` | **stack** | generated from the object you added |
-| `Object_Type` | **stack** | generated |
-| `Object_List` | **stack** | generated (Device object) |
-| `Property_List` | **stack** | generated |
-| `Status_Flags` | **stack** | generated |
-| `Event_State` | **stack**, sort of | no intrinsic alarming here, so nothing serves it — it reads `normal` only because `normal` is the enumeration's zero value and the stack substitutes a datatype default. Correct by coincidence, not design. |
-| `Out_Of_Service` | **you** | `GetPropertyBool` — matched on object **type only** |
-| `Present_Value` | **you** | `GetPropertyReal` |
-| `Object_Name` | **you** | `GetPropertyCharString` |
-| `Units` | **you** | `GetPropertyEnumerated` |
-
-Going beyond this (COV, alarms, scheduling) means implementing a richer profile -
-a later example in this series.
-
-## 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 389003 "Rainbow" - vendor 389 (Chipkin Automation Systems); instance configurable with --deviceID. The properties in 'accepted' are not served from a GetProperty callback because the stack itself is the source of truth for them - Protocol_Revision/Protocol_Version are stack build constants, Protocol_Services_Supported/Protocol_Object_Types_Supported are computed from the BACnetStack_SetServiceEnabled/AddObject calls this example already makes, Object_List and Device_Address_Binding are live stack-maintained tables, System_Status/Database_Revision/Max_APDU_Length_Accepted/Segmentation_Supported/APDU_Timeout/Number_Of_APDU_Retries are the stack's own configuration defaults for a device this example does not override
-
-| 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 default, accepted (`BACNET_PROTOCOL_VERSION`) | no |
-| Protocol_Revision | Unsigned | stack default, accepted (`BACNET_PROTOCOL_REVISION`) | no |
-| Protocol_Services_Supported | BACnetServicesSupported | stack default, accepted (computed from which services are enabled) | no |
-| Protocol_Object_Types_Supported | BACnetObjectTypesSupported | stack default, accepted (computed from which object types are supported) | no |
-| Object_List | BACnetARRAY[N] of BACnetObjectIdentifier | stack default, accepted (None known - a read fails with `unknown-property` or an empt) | 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 default, accepted (the live Device_Address_Binding (DAB) table) | no |
-| Database_Revision | Unsigned | stack default, accepted (Generic UnsignedInteger default: `0`) | no |
-
-### Analog Input 1 "Bronze" - REAL, degrees Celsius; starts at 21.5; read-only
-
-| 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; read-only
-
-| 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; read-only
-
-| 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" - REAL setpoint, default 20.0 C; commandable via a 16-slot Priority_Array (WriteProperty, DS-WP-B) - Present_Value/Priority_Array/Current_Command_Priority are resolved by the stack from the slots the app serves through GetPropertyReal/GetPropertyBool
-
-| 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" - active/inactive, default inactive; commandable via a 16-slot Priority_Array (WriteProperty, DS-WP-B) - Present_Value/Priority_Array/Current_Command_Priority are resolved by the stack from the slots the app serves through GetPropertyEnumerated/GetPropertyBool
-
-| 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" - state 1 of 3, default state 1; commandable via a 16-slot Priority_Array (WriteProperty, DS-WP-B) - Present_Value/Priority_Array/Current_Command_Priority are resolved by the stack from the slots the app serves through GetPropertyUnsignedInteger/GetPropertyBool
-
-| 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 |
-
-### 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 |
-
-
+v1.2.0 was published from a prebuilt STATIC-linked binary; 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: .
-
-
-## Footprint
+| **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)* | — |
-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`:
+### Operator interfaces and workstations (Annex L.1–L.3, L.9–L.10, L.12)
-
-| Platform | Binary | Size | SHA-256 (prefix) | Start-up to `ready` | Stack commit | Link mode | Compiler |
-|---|---|---|---|---|---|---|---|
-| Windows x64 (windows-2022) | `BACnetExampleBASC.exe` | 3,250,176 bytes (~3.1 MiB) | `1dedca53bb7cf498` | 190 ms | `abd4cee1` | STATIC | Visual Studio 17 2022 |
-| Linux x64 (ubuntu-latest) | `BACnetExampleBASC` | 44,168 bytes (~43 KiB) | `b67f9d03748e9e5b` | 110 ms | `abd4cee1` | STATIC | `/usr/bin/c++` |
+Client-side profiles.
-From release [v1.2.0](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP/releases/tag/v1.2.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
@@ -847,52 +419,7 @@ From release [v1.2.0](https://github.com/chipkin/BACnetProfileExample-B-ASC-CPP/
.
- **CAS BACnet Explorer** - client for testing this device:
.
-- **B-SA (Smart Actuator) example** - the sibling this builds on:
- .
- **Shared helper used by this example** - [`common/README.md`](common/README.md).
-## Use this in your own project
-
-This repository is self-contained: clone it (with the submodule) and build, then
-copy what you need into your product. The example source code is dedicated to the
-public domain under [CC0-1.0](LICENSE) - use it for anything, no attribution
-required. The CAS BACnet Stack is a separate, commercially licensed product and
-is not covered by CC0.
-
-### What to copy, what to rewrite
-
-`common/` is written for a **console demo**, not for a product. Copy it to get started, then
-expect to replace these before you ship:
-
-| In `common/` | Why it is not production code | What a product does instead |
-|---|---|---|
-| `printf` on every RX/TX in the transport callbacks (`CASExampleHelper.cpp`) | Console I/O on the BACnet hot path - slow, and noise once the device is real | Log to your own logger at debug level, or drop it |
-| The keyboard loop (`h`/`q`/arrows) | There is no console on an embedded device | Delete it; drive values from your real I/O |
-| `GetLocalIPv4()` picking the first non-loopback adapter | A guess; wrong on multi-homed hardware | Bind the interface your product is configured for |
-| `SimpleUDP` | Minimal blocking-socket demo | Your platform's networking stack |
-| `PrintVersion` / `--help` / `--port` / `--deviceID` | Demo ergonomics | Your own configuration mechanism |
-
-What you *should* keep the shape of: the three transport/time callbacks
-(`RegisterCommonCallbacks`), the deferred-restart pattern (`RequestRestart`/`RestartDue`), and
-the `LoadBACnetFunctions()` call at the top of `main()`.
-
-### Calling `BACnetStack_Tick()` in a real product
-
-The example calls `Tick()` in a tight loop with a 1 ms sleep. What the stack actually requires:
-
-- **Call it regularly.** Every timer the stack owns - APDU retries/timeouts, COV lifetimes,
- DCC durations, Schedule/Trend evaluation - advances only inside `Tick()`. A gap means late
- or missed BACnet behaviour, not a crash. Every ~10 ms is comfortable; do not let it drift
- into hundreds of milliseconds.
-- **It is not free-running.** It does the work available and returns; it does not block.
-- **Single-threaded contract.** The stack contains **no locking of any kind** (no mutexes, no
- atomics - grep it), and `Tick()` invokes your property callbacks on the calling thread,
- synchronously, before it returns. So: call `Tick()` from exactly one thread, never
- concurrently from two, and do not call any other `BACnetStack_*` function from a different
- thread. If your application is multi-threaded, own the stack from one task and marshal work
- to it (a queue your callbacks read from is the usual shape).
-- **Never block inside a callback.** A callback that waits on slow I/O stalls `Tick()`, and
- with it every timer above. Serve cached values and do the slow work elsewhere (`main.cpp`
- says the same at each `GetProperty*` callback).
-
-See also [CHANGELOG.md](CHANGELOG.md). Contributors and AI agents: [AGENTS.md](AGENTS.md) documents the repo conventions.
+See also [TUTORIAL.md](TUTORIAL.md), [docs/PICS.md](docs/PICS.md),
+[CHANGELOG.md](CHANGELOG.md), and [AGENTS.md](AGENTS.md).
diff --git a/TUTORIAL.md b/TUTORIAL.md
new file mode 100644
index 0000000..2c37aa6
--- /dev/null
+++ b/TUTORIAL.md
@@ -0,0 +1,305 @@
+# Tutorial - extending and reviewing the B-ASC 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 the
+application 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.
+
+Read this once before you start changing `main.cpp`. The most expensive mistake
+in this example is silent, and the section it lives in is
+[Add a second analog input](#add-a-second-analog-input).
+
+- [Extending the example](#extending-the-example)
+- [Add a second analog input](#add-a-second-analog-input)
+- [What each object type needs you to serve](#what-each-object-type-needs-you-to-serve)
+- [Who serves what: the application or the stack?](#who-serves-what-the-application-or-the-stack)
+- [Reviewing your device](#reviewing-your-device)
+- [Using this example as the base for a real product](#using-this-example-as-the-base-for-a-real-product)
+- [Troubleshooting](#troubleshooting)
+
+## Extending the example
+
+The example is intentionally small so it's easy to change.
+
+**Change a sensor's value or name** - edit the constants / callbacks in
+`main.cpp` (e.g. the initial value of `g_analogInput1Value`, or the `"Bronze"`
+string in `GetPropertyCharString`).
+
+**Require a password for DeviceCommunicationControl** - set `DCC_PASSWORD` in
+`main.cpp` to a non-empty string; the `DeviceCommunicationControl` callback
+then rejects a mismatch with `password-failure`. The comparison is by length
+first, then bytes - never `strcmp`, because a BACnet CharacterString may
+legitimately contain an embedded NUL that `strcmp` would silently stop at. Do
+not treat the password as a security boundary: it crosses the wire in
+plaintext and is a guard against accidents, not an attacker.
+
+**Change the device identity before you ship** - vendor ID, vendor name, model
+name, description, firmware revision, device name and the DCC 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.
+
+### Add a second analog input
+
+Read this whole recipe before starting — the last step is the one that is easy
+to miss and the one BTL will fail you for.
+
+> **Why there are four edits, not three — and why skipping one is SILENT.**
+> Most of the `GetProperty*` callbacks match on **both** object type *and*
+> instance (`objectInstance == ANALOG_INPUT_INSTANCE`), so a new instance falls
+> through every one of them. `GetPropertyBool` is the exception: it matches on
+> type only, so `Out_Of_Service` works for a new instance for free.
+>
+> Here is the part that matters, and it is the opposite of what most people
+> assume: falling through a callback does **not** reliably produce an
+> error. The stack errors only for the few 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 it **silently substitutes 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 — works by accident | n/a |
+>
+> **Doesn't the `errorCode` out-parameter fix this?** Only if you use it, and
+> only where it is right to. Each `GetProperty*` callback ends with a
+> `uint32_t* errorCode` that the stack presets to `success` and reads only when
+> you return `false`, so you *can* turn any decline into a chosen BACnet error.
+> But ending every callback with `*errorCode = unknown-property` breaks the
+> device: the stack's decline-and-fabricate path is what answers required
+> properties an application is not expected to serve — the Device's
+> `Max_APDU_Length_Accepted`, `APDU_Timeout` and `Number_Of_APDU_Retries` among
+> them. Name an error on the catch-all and those start failing instead of
+> answering. Set `errorCode` only where *this device* knows the read is wrong;
+> `main.cpp` does it in exactly two places: `State_Text` with an out-of-range
+> array index, and `DeviceCommunicationControl` (see
+> [Who serves what](#who-serves-what-the-application-or-the-stack) below — that
+> callback has no fallback and must set `*errorCode` on every `false` return).
+> The table above is still how the fall-through behaves for `GetProperty*`, and
+> the diff below is still what catches a missed step.
+>
+> It is worse than "wrong value": the object's `Property_List` **still advertises
+> `Units` (117)**. So the object actively claims to have the property, and then
+> answers with a default. Nothing on the wire says you forgot anything.
+>
+> So a half-added object does not look broken; it looks **healthy**. Add two of
+> them and both report `Object_Name "undefined"` — duplicate object names inside
+> one device, which is a spec violation and a hard BTL failure that every scan
+> tool will render as a perfectly good object. **"It scanned OK" is exactly the
+> failure mode, not evidence against it.**
+
+```cpp
+// 1) a new instance number (in section 1).
+// Naming: a second object of a type is " 2" - so Analog Input 2 is
+// "Bronze 2", NOT a new colour. Each object TYPE owns one colour series-wide.
+static const uint32_t ANALOG_INPUT_2_INSTANCE = 2; // "Bronze 2"
+static float g_analogInput2Value = 23.1f; // its live value
+
+// 2) add the object (in main, next to the other BACnetStack_AddObject calls).
+// Check the return, like every other stack call in this file.
+if (!BACnetStack_AddObject(g_deviceInstance, OBJECT_TYPE_ANALOG_INPUT, ANALOG_INPUT_2_INSTANCE)) {
+ printf("Error: Failed to add Analog Input 2 (Bronze 2).\n");
+ return 1;
+}
+
+// 3) serve its Present_Value + Object_Name:
+// GetPropertyReal: AI/2 + Present_Value -> *value = g_analogInput2Value;
+// GetPropertyCharString: AI/2 + Object_Name -> "Bronze 2"
+
+// 4) DO NOT SKIP: serve its Units, in GetPropertyEnumerated.
+// Units is a REQUIRED property of an Analog Input. The existing check reads
+// `objectInstance == ANALOG_INPUT_INSTANCE`, which is instance 1 - so without
+// this, reading Analog Input 2's Units returns an ERROR and the object is
+// NON-CONFORMANT. It will still appear in the Object_List and its
+// Present_Value will read back perfectly, so the device looks healthy right
+// up until BTL certification.
+// GetPropertyEnumerated: AI/2 + Units -> *value = ENGINEERING_UNITS_DEGREES_CELSIUS;
+```
+
+Then re-run the README's Verify steps **against Analog Input 2**, not just Analog
+Input 1 — read every required property and **diff it against Analog Input 1**.
+Any property that comes back `"undefined"`, `no-units`, or `0` where object 1
+returns something real is a step you missed. Because the failure is silent (see
+the table above), this diff is the only thing that catches it.
+
+The same trap applies to a new **output**: `GetCommandable()` matches on exact
+type + instance, so a new output instance falls through it and is silently
+*not* commandable until you add it there and to the `outputs[]` table in
+`main()`.
+
+## What each object type needs you to serve
+
+The application must serve every REQUIRED property the stack does not generate.
+It differs per type — this is the checklist, so you do not have to infer it:
+
+| 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` |
+| Analog Output | `Object_Name`, `Units`, `Relinquish_Default` | commandable slots (`Priority_Array`) |
+| Binary Output | `Object_Name`, `Polarity`, `Relinquish_Default` | commandable slots (`Priority_Array`) |
+| Multi-State Output | `Object_Name`, `Number_Of_States`, `Relinquish_Default` | commandable slots (`Priority_Array`) |
+
+An output's `Present_Value` is **not** served directly by a `GetProperty*`
+callback - the stack computes it from the `Priority_Array` slots your typed
+getters (`GetPropertyReal`/`GetPropertyEnumerated`/`GetPropertyUnsignedInteger`)
+and `GetPropertyBool` (which slot is null) return. See the `Commandable` struct
+and `GetCommandable()` in `main.cpp`.
+
+## Who serves what: the application or the stack?
+
+The single most common question when reading this file is "who answers this
+property?" For Analog Input 1, the whole picture:
+
+| Property | Served by | How |
+|---|---|---|
+| `Object_Identifier` | **stack** | generated from the object you added |
+| `Object_Type` | **stack** | generated |
+| `Object_List` | **stack** | generated (Device object) |
+| `Property_List` | **stack** | generated |
+| `Status_Flags` | **stack** | generated |
+| `Event_State` | **stack**, sort of | no intrinsic alarming here, so nothing serves it — it reads `normal` only because `normal` is the enumeration's zero value and the stack substitutes a datatype default. Correct by coincidence, not design. |
+| `Out_Of_Service` | **you** | `GetPropertyBool` — matched on object **type only** |
+| `Present_Value` | **you** | `GetPropertyReal` |
+| `Object_Name` | **you** | `GetPropertyCharString` |
+| `Units` | **you** | `GetPropertyEnumerated` |
+
+For Analog Output 1 ("Chartreuse"), the commandable object, the picture is
+different - the stack, not the app, resolves `Present_Value`:
+
+| Property | Served by | How |
+|---|---|---|
+| `Present_Value` | **stack** | computed from the highest-priority non-null `Priority_Array` slot, or `Relinquish_Default` if every slot is null |
+| `Priority_Array` | **you**, per slot | `GetPropertyReal` (the slot's value) + `GetPropertyBool` (whether the slot is null) |
+| `Relinquish_Default` | **you** | `GetPropertyReal` |
+| `Current_Command_Priority` | **stack** | computed |
+| `Units` | **you** | `GetPropertyEnumerated` |
+
+And for `DeviceCommunicationControl` (not a property, but the callback this
+profile adds): the stack owns the actual enable/disable state machine and the
+optional re-enable timer. The `DeviceCommunicationControl` callback in
+`main.cpp` only validates the password and logs what was asked - it does not
+implement the communication gating itself. See the README's
+[DeviceCommunicationControl section](README.md#devicecommunicationcontrol-the-b-asc-addition)
+for the deprecated-`disable` rejection and the `*errorCode` contract, which is
+stricter here than anywhere else in this file: unlike the `SetProperty*`
+callbacks (which fall back to `writeAccessDenied`), this callback has **no**
+default and must set `*errorCode` on every `false` return, or the wire carries
+the nonsensical `Error Code = success(84)`.
+
+Every object, not just these, is in [docs/PICS.md](docs/PICS.md).
+
+Going beyond this (COV, alarms, scheduling) means implementing a richer profile
+- see the series table in [README.md](README.md).
+
+## 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. **Command an output** - WriteProperty a commandable output's `Present_Value`
+ at a priority, re-read `Present_Value` and `Priority_Array[priority]`, then
+ write `NULL` to relinquish and confirm it falls back to
+ `Relinquish_Default`. Confirm a write to a read-only *input*, or an
+ out-of-range value, is rejected.
+5. **Exercise DeviceCommunicationControl** - send `disable-initiation`, confirm
+ the device SimpleACKs and keeps answering reads; send `enable` to resume;
+ send the deprecated plain `disable` and confirm it is rejected with
+ `service-request-denied`; if `DCC_PASSWORD` is set, send a wrong password and
+ confirm `password-failure`.
+
+### 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-ASC-CPP # rewrite
+python tools/gen-objects-properties.py BACnetProfileExample-B-ASC-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
+default, and each one needs a justification. Anything required, not in `app` and
+not in `accepted`, comes out as a ⚠ row - that is a defect, not a feature.
+
+## Using this example as the base for a real product
+
+This repository is self-contained: clone it (with the submodule) and build,
+then copy what you need into your product. The example source code is
+dedicated to the public domain under [CC0-1.0](LICENSE) - use it for anything,
+no attribution required. The CAS BACnet Stack is a separate, commercially
+licensed product and is not covered by CC0.
+
+### What to copy, what to rewrite
+
+`common/` is written for a **console demo**, not for a product. Copy it to get started, then
+expect to replace these before you ship:
+
+| In `common/` | Why it is not production code | What a product does instead |
+|---|---|---|
+| `printf` on every RX/TX in the transport callbacks (`CASExampleHelper.cpp`) | Console I/O on the BACnet hot path - slow, and noise once the device is real | Log to your own logger at debug level, or drop it |
+| The keyboard loop (`h`/`q`/arrows) | There is no console on an embedded device | Delete it; drive values from your real I/O |
+| `GetLocalIPv4()` picking the first non-loopback adapter | A guess; wrong on multi-homed hardware | Bind the interface your product is configured for |
+| `SimpleUDP` | Minimal blocking-socket demo | Your platform's networking stack |
+| `PrintVersion` / `--help` / `--port` / `--deviceID` | Demo ergonomics | Your own configuration mechanism |
+
+What you *should* keep the shape of: the three transport/time callbacks
+(`RegisterCommonCallbacks`), the deferred-restart pattern (`RequestRestart`/`RestartDue`), and
+the `LoadBACnetFunctions()` call at the top of `main()`.
+
+### Calling `BACnetStack_Tick()` in a real product
+
+The example calls `Tick()` in a tight loop with a 1 ms sleep. What the stack actually requires:
+
+- **Call it regularly.** Every timer the stack owns - APDU retries/timeouts, COV lifetimes,
+ DCC durations, Schedule/Trend evaluation - advances only inside `Tick()`. A gap means late
+ or missed BACnet behaviour, not a crash. Every ~10 ms is comfortable; do not let it drift
+ into hundreds of milliseconds. This matters more in this example than in B-SS/B-SA: the
+ DCC re-enable timer only advances inside `Tick()` too, so a starved loop also delays a
+ device coming back out of `disable-initiation` on its own.
+- **It is not free-running.** It does the work available and returns; it does not block.
+- **Single-threaded contract.** The stack contains **no locking of any kind** (no mutexes, no
+ atomics - grep it), and `Tick()` invokes your property callbacks on the calling thread,
+ synchronously, before it returns. So: call `Tick()` from exactly one thread, never
+ concurrently from two, and do not call any other `BACnetStack_*` function from a different
+ thread. If your application is multi-threaded, own the stack from one task and marshal work
+ to it (a queue your callbacks read from is the usual shape).
+- **Never block inside a callback.** A callback that waits on slow I/O stalls `Tick()`, and
+ with it every timer above. Serve cached values and do the slow work elsewhere (`main.cpp`
+ says the same at each `GetProperty*` callback).
+
+## Troubleshooting
+
+| Symptom | Cause / fix |
+|---------|-------------|
+| On start-up the app prints a wall of red `Error:` lines but the device works | **Expected — this is not your bug.** Two benign sources, both from the stack's own debug logging: (1) the device receives its **own** broadcast I-Am and logs a decode cascade (*"Services is not supported service=[0]"* … *"Failed to process the incoming NPDU"*) — any BACnet/IP device that listens for broadcasts hears itself; (2) a one-time *"UUID has not been set. A UUID must be set for the BACnetSC device to start."* — the stack starts a BACnet/SC (BACnet Secure Connect, the TLS/WebSocket-based transport added in ASHRAE 135-2020) datalink these IP-only examples never configure. It appears once and does not spam. How many red lines you see depends on subnet traffic: on a quiet network it can be a single line; on a busy BACnet subnet the self-heard-broadcast decodes pile up into a wall. Either way the device is fine. |
+| 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 `. |
+| The device starts and prints `TX ... (broadcast)`, but no client ever sees it | Check the IP in that `TX` line against the subnet your BACnet client is on. The example picks the **first non-loopback adapter** the OS reports, which on a laptop with Hyper-V, WSL, VirtualBox or a VPN is frequently not your Wi-Fi/Ethernet. There is no `--interface` option; disable the unwanted virtual adapters, or run on a machine without them. (Also check the firewall row above.) |
+| 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. |
+| DeviceCommunicationControl `disable` returns an error | Expected. The plain `disable` value is deprecated at Protocol_Revision >= 20; use `disable-initiation` instead. |
+| WriteProperty to an object is rejected | Write to the **output** objects (Chartreuse, Fuchsia, Indigo), not the inputs (inputs are read-only sensors), and keep the value in range. |
+| Replies show an unexpected device instance or vendor | Another BACnet device is already answering on this host/port. On Linux/macOS two processes can share the port and both reply; on Windows the example asks for `SO_EXCLUSIVEADDRUSE` (`common/SimpleUDP.cpp`) so this shows up as a bind failure instead. Stop the other device, or use `--port`. |
diff --git a/docs/PICS.md b/docs/PICS.md
new file mode 100644
index 0000000..3195fe7
--- /dev/null
+++ b/docs/PICS.md
@@ -0,0 +1,283 @@
+# BACnet Protocol Implementation Conformance Statement (PICS)
+
+For the **BACnet B-ASC (Application Specific 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.
+
+## 1. Product description
+
+| | |
+|---|---|
+| **Vendor Name** | Chipkin Automation Systems |
+| **Vendor Identifier** | 389 |
+| **Product Name** | CAS BACnet Stack Example - B-ASC |
+| **Product Model Number** | CAS BACnet Stack Example - B-ASC |
+| **Application Software Version** | 1.0.0 |
+| **Firmware Revision** | 1.0.0 |
+| **BACnet Protocol Version** | 1 |
+| **BACnet Protocol Revision** | 24 |
+
+**Product Description:** a BACnet/IP Application Specific Controller built on
+the CAS BACnet Stack. It presents three read-only sensor objects (Analog
+Input, Binary Input, Multi-State Input) and three commandable output objects
+(Analog Output, Binary Output, Multi-State Output), answers ReadProperty for
+every required property of every object, accepts WriteProperty to the
+commandable outputs' `Present_Value`, responds to
+DeviceCommunicationControl, and is discoverable by Who-Is / I-Am and Who-Has
+/ I-Have. It is a tutorial for implementers of the B-ASC profile.
+
+## 2. BACnet standardized device profile (Annex L)
+
+**B-ASC - BACnet Application Specific Controller.**
+
+This device claims exactly one profile. Because the B-ASC requirements are a
+superset of B-GENERAL's, a conformant B-ASC device also satisfies
+**B-GENERAL** (Annex L.8); that is subsumption, not a second claim.
+
+## 3. BIBBs supported (Annex K)
+
+| BIBB | Description |
+|---|---|
+| DS-RP-B | Data Sharing - ReadProperty - B |
+| DS-WP-B | Data Sharing - WriteProperty - B |
+| DM-DCC-B | Device Management - DeviceCommunicationControl - B |
+| DM-DDB-B | Device Management - Dynamic Device Binding - B |
+| DM-DOB-B | Device Management - Dynamic Object Binding - B |
+
+No other BIBBs are supported. In particular this device does **not** support
+DS-RPM-B (ReadPropertyMultiple), DS-WPM-B, DS-COV-B, any alarm and event
+(AE-*) BIBB, scheduling (SCHED-*), or trending (T-*).
+
+## 4. Application services supported
+
+| Service | Initiate | Execute |
+|---|:---:|:---:|
+| ReadProperty | no | **yes** |
+| WriteProperty | no | **yes** |
+| DeviceCommunicationControl | no | **yes** |
+| Who-Is | no | **yes** |
+| I-Am | **yes** | - |
+| Who-Has | no | **yes** |
+| I-Have | **yes** | - |
+
+An unsolicited I-Am is broadcast to the local subnet at start-up, as well as in
+response to Who-Is.
+
+Any other confirmed service is rejected. That rejection is part of the profile
+boundary, not a limitation to work around.
+
+### DeviceCommunicationControl
+
+The device accepts `enable` and `disable-initiation`. The deprecated plain
+`disable` value is **rejected** with `service-request-denied` - required at
+Protocol_Revision >= 20 (this device is at revision 24). An optional
+password (`DCC_PASSWORD` in `main.cpp`, empty/unset by default so any
+request is accepted) is compared length-first-then-bytes; a mismatch is
+rejected with `password-failure` (Error Class = SECURITY).
+
+## 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. The three input objects and
+the Network Port are read-only; the three output objects' `Present_Value` is
+writable (commandable, 16-slot Priority_Array).
+
+| Object type | Instance | Object_Name | Optional properties supported |
+|---|:---:|---|---|
+| Device | 389003 | Rainbow | Description |
+| Analog Input | 1 | Bronze | - |
+| Binary Input | 1 | Emerald | - |
+| Multi-State Input | 1 | Hot Pink | State_Text |
+| Analog Output | 1 | Chartreuse | - |
+| Binary Output | 1 | Fuchsia | - |
+| Multi-State Output | 1 | Indigo | - |
+| Network Port | 1 | Vermilion | - |
+
+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**. The device answers Who-Is/Who-Has
+and does not initiate any confirmed request, so it never needs to bind a peer.
+
+## 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 389003 "Rainbow" - vendor 389 (Chipkin Automation Systems); instance 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; read-only
+
+| 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; read-only
+
+| 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; read-only
+
+| 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" - REAL setpoint, default 20.0 C; commandable via a 16-slot Priority_Array (WriteProperty, DS-WP-B) - Present_Value/Priority_Array/Current_Command_Priority are resolved by the stack from the slots the app serves through GetPropertyReal/GetPropertyBool
+
+| 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" - active/inactive, default inactive; commandable via a 16-slot Priority_Array (WriteProperty, DS-WP-B) - Present_Value/Priority_Array/Current_Command_Priority are resolved by the stack from the slots the app serves through GetPropertyEnumerated/GetPropertyBool
+
+| 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" - state 1 of 3, default state 1; commandable via a 16-slot Priority_Array (WriteProperty, DS-WP-B) - Present_Value/Priority_Array/Current_Command_Priority are resolved by the stack from the slots the app serves through GetPropertyUnsignedInteger/GetPropertyBool
+
+| 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 |
+
+### 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 |
+
+
+
+## 12. References
+
+- ANSI/ASHRAE Standard 135-2024, Annex A (PICS template), Annex K (BIBBs),
+ Annex L (device profiles), Clause 12 (object types), Clause 16
+ (DeviceCommunicationControl is 16.1).
+- [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.
diff --git a/docs/objects.json b/docs/objects.json
index 85d27cb..1b30376 100644
--- a/docs/objects.json
+++ b/docs/objects.json
@@ -8,12 +8,12 @@
"Firmware_Revision", "Application_Software_Version", "Description"],
"enabled": ["Description"],
"writable": [],
- "accepted": ["System_Status", "Protocol_Version", "Protocol_Revision",
- "Protocol_Services_Supported", "Protocol_Object_Types_Supported",
- "Object_List", "Max_APDU_Length_Accepted", "Segmentation_Supported",
- "APDU_Timeout", "Number_Of_APDU_Retries", "Device_Address_Binding",
- "Database_Revision"],
- "note": "vendor 389 (Chipkin Automation Systems); instance configurable with --deviceID. The properties in 'accepted' are not served from a GetProperty callback because the stack itself is the source of truth for them - Protocol_Revision/Protocol_Version are stack build constants, Protocol_Services_Supported/Protocol_Object_Types_Supported are computed from the BACnetStack_SetServiceEnabled/AddObject calls this example already makes, Object_List and Device_Address_Binding are live stack-maintained tables, System_Status/Database_Revision/Max_APDU_Length_Accepted/Segmentation_Supported/APDU_Timeout/Number_Of_APDU_Retries are the stack's own configuration defaults for a device this example does not override"
+ "accepted": ["System_Status", "Max_APDU_Length_Accepted", "Segmentation_Supported",
+ "APDU_Timeout", "Number_Of_APDU_Retries", "Database_Revision"],
+ "note": "vendor 389 (Chipkin Automation Systems); instance 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",
diff --git a/main.cpp b/main.cpp
index d4c13d5..21ca36f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -90,6 +90,9 @@ static uint32_t g_deviceInstance = 389003;
// 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
@@ -97,7 +100,20 @@ static uint32_t g_deviceInstance = 389003;
// 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-ASC (Application Specific Controller) "
"profile. Demonstrates DS-RP-B + DS-WP-B + DM-DCC-B: ReadProperty, "
@@ -105,17 +121,29 @@ static const char* DEVICE_DESCRIPTION =
"and commandable outputs.";
// 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-ASC";
// 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 - and
+// remember it crosses the wire in PLAINTEXT: it is a guard against accidents, not a
+// security boundary. See the DeviceCommunicationControl callback below for the compare.
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";
+// The device instance below (g_deviceInstance, default 389003, --deviceID overrides)
+// must also be unique on the internetwork; BACnet requires it to be configurable, so
+// keep the --deviceID override rather than hard-coding it.
+
// The sensor objects (all instance 1) and their colour names.
static const uint32_t ANALOG_INPUT_INSTANCE = 1; // "Bronze"
static const uint32_t BINARY_INPUT_INSTANCE = 1; // "Emerald"