Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Input 1, `s` advance Schedule 1 (Saffron) to a transition right now.

## Conventions

- Device is named "Rainbow"; objects use the series' colour names; vendor id 389.
- Device is named "Chipkin Example B-BC"; objects use the series' colour names; vendor id 389.
- Implement the B-BC services the stack supports; expose **every required
property** of each object for Protocol_Revision 24. Anything B-BC requires
that is NOT implemented must be listed in [TODO.md](TODO.md) and
Expand All @@ -90,18 +90,26 @@ Input 1, `s` advance Schedule 1 (Saffron) to a transition right now.
against (UTC, via `gmtime`/`gmtime_s`) - not `localtime`/`localtime_s`,
which silently blocks `Record_Count` from ever incrementing on any host not
in UTC (fixed, [cas-bacnet-stack#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051)).
Also, `AddTrendLogObject` alone triggers a non-fatal internal log flood
Older stack pins also flooded the log from
`AddTrendLogObject` alone
([#2050](https://github.com/chipkin/cas-bacnet-stack/issues/2050), same
class as B-ACC's #2045 for Event Log) - do not treat flood output as a new
bug without checking #2050/#2045 first.
class as B-ACC's #2045 for Event Log). That's gone on 6.0.22; if it comes
back, check #2050/#2045 before treating it as a new bug.
- **Startup `UUID has not been set` error:** a single
`BACnetDataLinkSC::Loop() ... UUID has not been set` line at startup is a
harmless stack log defect
([cas-bacnet-stack#2341](https://github.com/chipkin/cas-bacnet-stack/issues/2341)).
This example never uses BACnet/SC; don't set a UUID to silence it.
- **SCHED-E-B:** `BACnetStack_AddScheduleObjectPropertyReference` APPENDS
every call - pass a `refDeviceInstance` other than this device's own to add
a REMOTE target (this starts the stack's Device Address Binding for that
instance). Cross-instance wire testing on one host needs either the same
UDP port shared across processes (impossible - one bind per port) or a
BBMD; two local instances on different ports cannot discover each other by
broadcast. See TODO.md item 3 before assuming a remote-write test failure
is a code bug.
instance). Two local instances on different ports can't discover each
other by broadcast. To wire-test the remote write on one host, run
`tests/sched_e_b_remote_peer.py`: it plays device 389002 and sends a
unicast I-Am so the DAB resolves it. The write skipped at startup, before
the peer is bound, is never re-sent. That's stack gap
[#2343](https://github.com/chipkin/cas-bacnet-stack/issues/2343), not a
code bug. See TODO.md item 2.
- Outputs are **commandable**: store the 16-slot `Priority_Array` +
`Relinquish_Default` in the app (the `Commandable` struct); let the stack
resolve `Present_Value`. Writes land via the `SetProperty*` callbacks (value)
Expand Down Expand Up @@ -155,7 +163,8 @@ There are no unit tests; verification is behavioural:
BACnetProfileExample-B-BC-CPP` from the series root) and confirm no row
comes out flagged with ⚠.

Verification is manual (no in-repo test suite ships).
Verification is manual (no in-repo test suite ships). `tests/` holds ad hoc
bacpypes3 helpers for checks that need a second device.

## Releasing

Expand Down
113 changes: 99 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,105 @@ 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).

## [1.0.6] - 2026-09-22

### Fixed

- Trend Log 1 ("Lilac")'s `Record_Count` now climbs as expected
([#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051)). The
Start_Time/Stop_Time window passed to `BACnetStack_SetTrendLogStartStopTime`
was built with `localtime_s`/`localtime_r`, but the stack's own "now" (built
from `HelperGetSystemTime()`'s raw `time(0)` and this example's unserved
Device `UTC_Offset`, i.e. 0) is UTC wall-clock - on any host not in UTC, the
window no longer bracketed the clock the stack actually compares against, so
`ReadyToLog` never passed and no records were ever logged. Switched to
`gmtime_s`/`gmtime_r` so the window is built from the same clock the stack
uses. Live-verified with bacpypes3: `Record_Count` climbs continuously
(observed 14 -> 29 -> 44 over 30 seconds). This was a bug in the example,
not the stack, so TODO.md's old item 1 is removed and the remaining items
are renumbered. (merged from #9)

### Changed

- Stack issue links now point at open issues. The Calendar `Date_List` gap
moved from the closed cas-bacnet-stack #963 to
[#1758](https://github.com/chipkin/cas-bacnet-stack/issues/1758) in
`main.cpp`'s comments, `README.md` and `docs/objects.json`, and
`docs/PICS.md` was regenerated from it.
- The SCHED-E-B wording in `README.md`, `docs/PICS.md` and
`docs/objects.json` said the remote write was "not wire-verified". It now
says the write is wire-verified and links the startup-write gap
([cas-bacnet-stack#2343](https://github.com/chipkin/cas-bacnet-stack/issues/2343)).
README's known-gaps summary no longer lists the #2050 log flood, which is
gone on 6.0.22.
- APP_VERSION bumped 1.0.5 -> 1.0.6.

## [1.0.5] - 2026-09-22

### Changed

- **CAS BACnet Stack moved to 6.0.22** (`6.x` @ `22ac3c98`), from 6.0.21
(`issues/runbook` @ `a8d3b6bf`). The example is back on the `6.x` branch
that `.gitmodules` names. The early fixes the old pin existed for (#2163,
#2164, #2165) are all on `6.x` now. No `main.cpp` changes were needed.
If you already have a build tree, run `cmake -B build` again before
building. The stack added a new source file, and the adapter's
configure-time glob won't see it otherwise
([cas-bacnet-stack#2342](https://github.com/chipkin/cas-bacnet-stack/issues/2342)).
- **TODO.md re-verified live on 6.0.22.** The Trend Log 1 `Record_Count`
gap (#2051) still reproduces. The `AddTrendLogObject` log flood (#2050) is
gone. Network Port 1's unreadable `Property_List` entries still reproduce
even though #2196 was closed, and are refiled as
[cas-bacnet-stack#2340](https://github.com/chipkin/cas-bacnet-stack/issues/2340).
New item 8 records the harmless startup BACnet/SC "UUID has not been set"
error
([cas-bacnet-stack#2341](https://github.com/chipkin/cas-bacnet-stack/issues/2341)).
Every open item now links to its tracking issue in this repo.
- **SCHED-E-B remote fan-out verified on the wire** (#6). The new
`tests/sched_e_b_remote_peer.py` plays peer device 389002 and sends a
unicast I-Am, so the DAB binds it on one host without a BBMD. Schedule 1
then writes the peer's AO 1 at priority 8, and the peer SimpleACKs. This
found one stack gap: the startup write, skipped while the peer isn't
bound yet, is never re-sent
([cas-bacnet-stack#2343](https://github.com/chipkin/cas-bacnet-stack/issues/2343)).
TODO.md item 3, TUTORIAL.md and AGENTS.md are updated to match.
- TUTORIAL.md's `DEVICE_NAME` notes now say "Chipkin Example B-BC". The
1.0.4 rename missed this file.
- APP_VERSION bumped 1.0.4 -> 1.0.5.

## [1.0.4] - 2026-09-22

### Changed

- **Device renamed from the series' colour placeholder "Rainbow" to "Chipkin
Example B-BC"** so devices from different examples in the series are
distinguishable from each other on the same BACnet network - every example
previously announced the identical Object_Name "Rainbow", which made two
examples on one subnet indistinguishable by name. Sub-object names (Analog
Input 1 "Bronze", etc.) are unchanged - only the Device object's name
changed. `docs/colour-table.md` (series root) updated to match. APP_VERSION
bumped 1.0.3 -> 1.0.4.

## [1.0.3] - 2026-09-22

### Fixed

- **`Application_Software_Version` (12) and `Firmware_Revision` (44) were
hardcoded and stale** - both served the literal `"1.0.0"` regardless of the
actual build, and `Firmware_Revision` was never meant to be this example's
own version at all; it names the underlying platform. Fixed:
`Application_Software_Version` now reads `APP_VERSION` directly (one
source of truth, can't drift from `--version`'s own banner again).
`Firmware_Revision` is now built at runtime from the CAS BACnet Stack's
own `BACnetStack_GetAPIMajorVersion()`/`GetAPIMinorVersion()`/
`GetAPIPatchVersion()`/`GetAPIBuildVersion()` (the same 4 calls
`common/CASExampleHelper.cpp`'s `PrintVersion()` already uses for the
startup banner), populated once right after `LoadBACnetFunctions()`
succeeds. Verified with a real ReadProperty against the running device
(`bacpypes3`): `Application_Software_Version = "1.0.3"`,
`Firmware_Revision = "6.0.21.0"` - both now match the actual running build
instead of the stale hardcoded string.

## [1.0.2] - 2026-09-18

### Changed
Expand Down Expand Up @@ -59,20 +158,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
a full XML block instead. See `common/CHANGELOG.md` for the decode
details.

### Fixed

- Trend Log 1 ("Lilac")'s `Record_Count` now climbs as expected
([#2051](https://github.com/chipkin/cas-bacnet-stack/issues/2051)). The
Start_Time/Stop_Time window passed to `BACnetStack_SetTrendLogStartStopTime`
was built with `localtime_s`/`localtime_r`, but the stack's own "now" (built
from `HelperGetSystemTime()`'s raw `time(0)` and this example's unserved
Device `UTC_Offset`, i.e. 0) is UTC wall-clock - on any host not in UTC, the
window no longer bracketed the clock the stack actually compares against, so
`ReadyToLog` never passed and no records were ever logged. Switched to
`gmtime_s`/`gmtime_r` so the window is built from the same clock the stack
uses. Live-verified with bacpypes3: `Record_Count` climbs continuously
(observed 14 -> 29 -> 44 over 30 seconds).

### Changed

- Restructured documentation to match the series' shared shape: `README.md`
Expand Down
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@ and ReadRange). It listens on **BACnet/IP (UDP 47808)** and claims only B-BC.
- **[docs/PICS.md](docs/PICS.md)** - the Protocol Implementation Conformance
Statement: every object, every property, and who answers it.

> **Versions:** this document describes **example v1.0.2**, built and verified
> against **CAS BACnet Stack 6.0.21** (`issues/runbook` @ `a8d3b6bf`, ahead of `6.x` - see
> `TODO.md` for why), at
> **Protocol_Revision 26**, with the vendored `common/` helper at **v2.8.0**.
> **Versions:** this document describes **example v1.0.6**, built and verified
> against **CAS BACnet Stack 6.0.22** (`6.x` @ `22ac3c98`), at
> **Protocol_Revision 26**, with the vendored `common/` helper at **v3.0.0**.
> Running the example prints all three - if what it prints disagrees with this
> line, trust the program and check `CHANGELOG.md`.

> **B-BC is not fully claimable with the standard stack yet.** This example
> implements every B-BC capability the standard CAS BACnet Stack exposes, and
> clearly marks what it cannot do - see [TUTORIAL.md](TUTORIAL.md) and
> [TODO.md](TODO.md). In summary: `AddTrendLogObject` causes a non-fatal
> internal log flood
> ([#2050](https://github.com/chipkin/cas-bacnet-stack/issues/2050)); Calendar 1
> ("Cream")'s `Date_List` cannot be populated (issue #963); and Schedule 1's
> SCHED-E-B remote write is correctly wired but was not wire-verified
> cross-instance in a single-host test topology.
> [TODO.md](TODO.md). In summary: Calendar 1
> ("Cream")'s `Date_List` cannot be populated
> ([#1758](https://github.com/chipkin/cas-bacnet-stack/issues/1758)).
> Schedule 1's SCHED-E-B remote write is verified on the wire, but the stack
> drops the write it makes at startup, before the remote device has been
> found ([#2343](https://github.com/chipkin/cas-bacnet-stack/issues/2343)).

## What is a B-BC (Building Controller) profile?

Expand All @@ -50,7 +49,7 @@ deliberately omitted - it is not required at or above Protocol_Revision 13.
## The device this example creates

```
Device 389005 "Rainbow" (instance configurable with --deviceID)
Device 389005 "Chipkin Example B-BC" (instance configurable with --deviceID)
Analog Input 1 "Bronze" (REAL, degrees Celsius; read-only)
Binary Input 1 "Emerald" (active / inactive; read-only)
Multi-state Input 1 "Hot Pink" (state 1..3; read-only)
Expand Down Expand Up @@ -84,7 +83,7 @@ Trend Log Multiple 1 "Magenta" (polls Bronze/Diamond/Chartreuse)
| AE-ACK-B | Alarm and Event - ACK - B | ✅ |
| AE-INFO-B | Alarm and Event - Information - B | ✅ |
| AE-CRL-B | Alarm and Event - Recipient List - B | ✅ |
| SCHED-E-B | Scheduling - External - B | ✅ (wiring verified; remote write not cross-instance wire-tested - see [TUTORIAL.md](TUTORIAL.md)) |
| SCHED-E-B | Scheduling - External - B | ✅ (local and remote writes wire-verified; the stack drops the startup write made before the remote device is bound, [#2343](https://github.com/chipkin/cas-bacnet-stack/issues/2343) - see [TUTORIAL.md](TUTORIAL.md)) |
| T-VMT-I-B | Trending - Viewing and Modifying Trends - Internal - B | ✅ (Trend Log Multiple; plain Trend Log has a known gap - see [TUTORIAL.md](TUTORIAL.md)) |
| T-ATR-B | Trending - Automated Trend Retrieval - B | ✅ (via ReadRange on Trend Log Multiple) |
| DM-DDB-A | Device Management - Dynamic Device Binding - A | ✅ |
Expand Down Expand Up @@ -117,7 +116,7 @@ Trend Log Multiple 1 "Magenta" (polls Bronze/Diamond/Chartreuse)

| Object type | Instance | Name |
|-------------|:--------:|------|
| Device | 389005 | Rainbow |
| Device | 389005 | Chipkin Example B-BC |
| Analog Input | 1 | Bronze |
| Binary Input | 1 | Emerald |
| Multi-state Input | 1 | Hot Pink |
Expand Down Expand Up @@ -218,12 +217,12 @@ CMake at it: `cmake -B build -S . -D CAS_STACK_DIR=/path/to/cas-bacnet-stack`.
Expected output:

```
BACnet B-BC (Building Controller) Example - C++ v1.0.0
CAS BACnet Stack version: 6.0.21.0
Common helper (common/) version: 2.5.0
BACnet B-BC (Building Controller) Example - C++ v1.0.6
CAS BACnet Stack version: 6.0.22.0
Common helper (common/) version: 3.0.0
FYI: Listening for BACnet/IP on UDP port 47808 (Network Port 1).
TX 21 bytes to 192.168.3.255:47808 (broadcast) (Network Port 1)
FYI: Device 389005 ("Rainbow") ready. Vendor ID 389. Press 'h' for help.
FYI: Device 389005 ("Chipkin Example B-BC") ready. Vendor ID 389. Press 'h' for help.
```

The `TX` line is the start-up I-Am the device broadcasts to announce itself, to
Expand Down
Loading
Loading