From 6cc710c9f9ac62bd5c80a826040a98310ab80fc8 Mon Sep 17 00:00:00 2001 From: SWS-Chipkin Date: Tue, 15 Sep 2026 17:10:09 -0700 Subject: [PATCH] chore(common): sync to 2.5.0 Co-Authored-By: Claude Sonnet 5 --- common/CASBACnetStackExampleConstants.h | 1 + common/CASExampleHelper.cpp | 193 +++++++++++++++++++----- common/CASExampleHelper.h | 66 ++++++-- common/CHANGELOG.md | 86 +++++++++++ 4 files changed, 296 insertions(+), 50 deletions(-) diff --git a/common/CASBACnetStackExampleConstants.h b/common/CASBACnetStackExampleConstants.h index 3e2cafa..cc22c9c 100644 --- a/common/CASBACnetStackExampleConstants.h +++ b/common/CASBACnetStackExampleConstants.h @@ -57,6 +57,7 @@ static const uint32_t PROPERTY_IDENTIFIER_PRIORITY_ARRAY = 87; static const uint32_t PROPERTY_IDENTIFIER_RELINQUISH_DEFAULT = 104; static const uint32_t PROPERTY_IDENTIFIER_CURRENT_COMMAND_PRIORITY = 431; static const uint32_t PROPERTY_IDENTIFIER_REFERENCE_PORT = 483; +static const uint32_t PROPERTY_IDENTIFIER_ROUTING_TABLE = 428; // Network Port; optional, SetPropertyEnabled first static const uint32_t PROPERTY_IDENTIFIER_STATE_TEXT = 110; static const uint32_t PROPERTY_IDENTIFIER_STATUS_FLAGS = 111; static const uint32_t PROPERTY_IDENTIFIER_SYSTEM_STATUS = 112; diff --git a/common/CASExampleHelper.cpp b/common/CASExampleHelper.cpp index 29a48b2..f0baad3 100644 --- a/common/CASExampleHelper.cpp +++ b/common/CASExampleHelper.cpp @@ -41,20 +41,61 @@ namespace { -// The single UDP socket shared by the transport callbacks. The stack calls the -// callbacks as plain C function pointers (no user-data argument), so the socket -// lives here as a file-local singleton rather than being passed in. This is a -// deliberate simplification for the example; an application that needs multiple -// datalinks would route through its own context object instead. -SimpleUDP g_udp; - -// The BACnet/IP port the device is bound to (used to address broadcast I-Am). +// --------------------------------------------------------------------------- +// Multi-port UDP support (common/ 2.3.0). +// +// The stack calls the transport callbacks as plain C function pointers (no +// user-data argument), so the socket(s) live here as file-local state rather +// than being passed in. Originally that state was exactly one SimpleUDP - one +// example, one BACnet/IP link. A routing example (B-RTR, the first canonical +// user of this) owns TWO Network Port objects, each with its own UDP socket +// and port number, and the stack must be told - on every receive and every +// send - WHICH Network Port instance the datagram belongs to. This small +// table generalizes "the one socket" to "up to MAX_UDP_BINDINGS sockets, each +// keyed by the Network Port instance it belongs to". +// +// WHY THIS IS SAFE FOR SINGLE-PORT EXAMPLES. +// Every example that only ever calls the single-argument SetupUDP(port) gets +// exactly one entry in g_udpBindings, keyed to whatever SetNetworkPortInstance +// set (instance 1 if it was never called - unchanged default). With one +// entry, HelperReceiveMessage's round-robin loop below always starts at and +// checks that one entry (nothing to rotate to), and HelperSendMessage's +// lookup always finds that one entry for the one networkPortInstance the +// stack will ever name. The code path is byte-for-byte the same work the +// old single-g_udp implementation did; only the storage changed from "a bare +// SimpleUDP" to "a SimpleUDP inside a one-element table". No single-port +// example's on-the-wire behaviour changes. +struct UdpBinding { + SimpleUDP udp; + uint16_t port = 0; + uint32_t networkPortInstance = 0; + bool bound = false; +}; + +// Generous headroom over B-RTR's two ports; a small fixed table avoids a heap +// allocation in example code that otherwise has none. +const size_t MAX_UDP_BINDINGS = 4; +UdpBinding g_udpBindings[MAX_UDP_BINDINGS]; +size_t g_udpBindingCount = 0; + +UdpBinding* FindUdpBindingByInstance(uint32_t networkPortInstance) { + for (size_t i = 0; i < g_udpBindingCount; ++i) { + if (g_udpBindings[i].networkPortInstance == networkPortInstance) { + return &g_udpBindings[i]; + } + } + return NULL; +} + +// The BACnet/IP port of the CURRENT Network Port instance (used to address +// broadcast I-Am for the single-argument SendIAm()). uint16_t g_port = 47808; -// The instance of the Network Port object that owns this UDP socket. The stack +// The instance of the Network Port object that the single-argument +// SetupUDP(port) / SendIAm(deviceInstance) overloads act on. The stack // identifies a link by its Network Port object INSTANCE, not by a transport // network type, so the transport callbacks and SendIAm all have to name it. -// The example's main() tells us which one it added, via +// The example's main() tells us which one is "current" via // SetNetworkPortInstance(); the default matches the series convention of a // single Network Port at instance 1. uint32_t g_networkPortInstance = 1; @@ -76,22 +117,48 @@ uint16_t HelperReceiveMessage(uint8_t* message, const uint16_t maxMessageLength, uint32_t* networkPortInstance) { (void)destinationConnectionString; (void)destinationConnectionStringLength; - if (maxConnectionStringLength < 6) { + if (maxConnectionStringLength < 6 || g_udpBindingCount == 0) { return 0; } - uint8_t fromIp[4]; + // Poll the bound sockets in round-robin order, starting from the one after + // whichever was serviced (or checked) last call. For a single-port example + // (g_udpBindingCount == 1) this always checks binding 0, same as the old + // single-g_udp implementation. For a multi-port example it means a socket + // with continuous traffic cannot starve the others: each call to this + // function looks at a different starting socket, and the stack calls it + // repeatedly per tick until it returns 0. + static size_t s_nextBindingToCheck = 0; + const size_t n = g_udpBindingCount; + uint16_t bytesRead = 0; + uint8_t fromIp[4] = { 0, 0, 0, 0 }; uint16_t fromPort = 0; - // Receive() copies at most maxMessageLength bytes; a datagram larger than the - // stack's buffer is truncated to that length (fine for UDP - the stack will - // simply fail to decode and ignore an over-length frame). - const uint16_t bytesRead = g_udp.Receive(message, maxMessageLength, fromIp, &fromPort); + uint32_t servicedInstance = 0; + + for (size_t k = 0; k < n; ++k) { + const size_t i = (s_nextBindingToCheck + k) % n; + UdpBinding& binding = g_udpBindings[i]; + if (!binding.bound) { + continue; + } + // Receive() copies at most maxMessageLength bytes; a datagram larger than + // the stack's buffer is truncated to that length (fine for UDP - the + // stack will simply fail to decode and ignore an over-length frame). + bytesRead = binding.udp.Receive(message, maxMessageLength, fromIp, &fromPort); + if (bytesRead > 0) { + servicedInstance = binding.networkPortInstance; + s_nextBindingToCheck = (i + 1) % n; + break; + } + } if (bytesRead == 0) { - return 0; // no datagram waiting + s_nextBindingToCheck = (s_nextBindingToCheck + 1) % n; // keep rotating even when idle + return 0; // no datagram waiting on any bound port } - printf("RX %u bytes from %u.%u.%u.%u:%u\n", (unsigned)bytesRead, - fromIp[0], fromIp[1], fromIp[2], fromIp[3], (unsigned)fromPort); + printf("RX %u bytes from %u.%u.%u.%u:%u (Network Port %u)\n", (unsigned)bytesRead, + fromIp[0], fromIp[1], fromIp[2], fromIp[3], (unsigned)fromPort, + (unsigned)servicedInstance); // Fill the 6-byte BACnet/IP connection string: IP[4] + port[2] (big-endian). sourceConnectionString[0] = fromIp[0]; @@ -106,9 +173,11 @@ uint16_t HelperReceiveMessage(uint8_t* message, const uint16_t maxMessageLength, // stack used to ask only for the transport's network TYPE here; since the // per-port work (CAS BACnet Stack issue #822/#556) it wants the instance of // the Network Port object that owns this link, so a multi-port device can - // answer on the port a request came in on. This example has exactly one - // port, so it always reports that one - see SetNetworkPortInstance(). - *networkPortInstance = g_networkPortInstance; + // answer on the port a request came in on. A single-port example reports + // its one bound instance every time, same as before common/ 2.3.0; a + // multi-port example reports whichever bound socket the datagram actually + // arrived on. + *networkPortInstance = servicedInstance; return bytesRead; } @@ -124,10 +193,12 @@ uint16_t HelperSendMessage(const uint8_t* message, const uint16_t messageLength, const uint8_t connectionStringLength, const uint32_t networkPortInstance, const bool broadcast) { // The stack names the Network Port object the message is to leave by (it - // used to name the transport's network type). This example serves exactly - // one port, so anything else is not ours to send. - if (networkPortInstance != g_networkPortInstance || - connectionStringLength < 6) { + // used to name the transport's network type). Look up the socket bound to + // that instance; a single-port example has exactly one, so this always + // resolves to it - same effect as the old "!= g_networkPortInstance" check, + // just expressed as a table lookup instead of a single comparison. + UdpBinding* binding = FindUdpBindingByInstance(networkPortInstance); + if (binding == NULL || !binding->bound || connectionStringLength < 6) { return 0; } @@ -135,10 +206,10 @@ uint16_t HelperSendMessage(const uint8_t* message, const uint16_t messageLength, connectionString[2], connectionString[3] }; const uint16_t port = (uint16_t)((connectionString[4] << 8) | connectionString[5]); - const uint16_t sent = g_udp.Send(ip, port, message, messageLength); - printf("TX %u bytes to %u.%u.%u.%u:%u%s\n", (unsigned)sent, + const uint16_t sent = binding->udp.Send(ip, port, message, messageLength); + printf("TX %u bytes to %u.%u.%u.%u:%u%s (Network Port %u)\n", (unsigned)sent, ip[0], ip[1], ip[2], ip[3], (unsigned)port, - broadcast ? " (broadcast)" : ""); + broadcast ? " (broadcast)" : "", (unsigned)networkPortInstance); return sent; } @@ -426,18 +497,45 @@ uint32_t ParseDeviceIdArg(const int argc, char** argv, const uint32_t defaultDev return defaultDeviceId; } -bool SetupUDP(const uint16_t port) { - g_port = port; - if (!g_udp.Connect(port)) { - printf("Error: Failed to bind UDP port %u.\n", (unsigned)port); +bool SetupUDP(const uint16_t port, const uint32_t networkPortInstance) { + UdpBinding* binding = FindUdpBindingByInstance(networkPortInstance); + if (binding == NULL) { + if (g_udpBindingCount >= MAX_UDP_BINDINGS) { + printf("Error: SetupUDP: MAX_UDP_BINDINGS (%u) already bound; " + "raise it in CASExampleHelper.cpp if you need more ports.\n", + (unsigned)MAX_UDP_BINDINGS); + return false; + } + binding = &g_udpBindings[g_udpBindingCount++]; + binding->networkPortInstance = networkPortInstance; + } + if (!binding->udp.Connect(port)) { + printf("Error: Failed to bind UDP port %u (Network Port %u).\n", + (unsigned)port, (unsigned)networkPortInstance); return false; } - printf("FYI: Listening for BACnet/IP on UDP port %u.\n", (unsigned)port); + binding->port = port; + binding->bound = true; + if (networkPortInstance == g_networkPortInstance) { + // Keep g_port in step for the single-argument SendIAm(deviceInstance). + g_port = port; + } + printf("FYI: Listening for BACnet/IP on UDP port %u (Network Port %u).\n", + (unsigned)port, (unsigned)networkPortInstance); return true; } +bool SetupUDP(const uint16_t port) { + return SetupUDP(port, g_networkPortInstance); +} + void ShutdownUDP() { - g_udp.Disconnect(); + for (size_t i = 0; i < g_udpBindingCount; ++i) { + if (g_udpBindings[i].bound) { + g_udpBindings[i].udp.Disconnect(); + g_udpBindings[i].bound = false; + } + } } void SetNetworkPortInstance(const uint32_t networkPortInstance) { @@ -454,11 +552,17 @@ bool GetLocalIPv4(uint8_t ipAddress[4], uint8_t subnetMask[4]) { return GetPrimaryIPv4(ipAddress, subnetMask); } -void SendIAm(const uint32_t deviceInstance) { +void SendIAm(const uint32_t deviceInstance, const uint32_t networkPortInstance) { // Target the LOCAL subnet broadcast (the device's own network) rather than // the global 255.255.255.255 / network 0xFFFF. The broadcast is ip | ~mask // of the primary IPv4 interface - the same network the Network Port object // represents - falling back to the limited broadcast if it can't be found. + // + // NOTE for multi-port examples: every Network Port in this series' examples + // runs on the SAME host interface (different UDP ports simulate different + // BACnet/IP networks), so the primary-interface broadcast address is the + // right target for every instance; only the port differs, taken from that + // instance's own binding below. uint8_t bcast[4] = { 255, 255, 255, 255 }; uint8_t ip[4], mask[4]; if (GetPrimaryIPv4(ip, mask)) { @@ -468,16 +572,23 @@ void SendIAm(const uint32_t deviceInstance) { bcast[3] = (uint8_t)(ip[3] | ~mask[3]); } + const UdpBinding* binding = FindUdpBindingByInstance(networkPortInstance); + const uint16_t port = (binding != NULL && binding->bound) ? binding->port : g_port; + const uint8_t connectionString[6] = { bcast[0], bcast[1], bcast[2], bcast[3], - (uint8_t)((g_port >> 8) & 0xFF), (uint8_t)(g_port & 0xFF) + (uint8_t)((port >> 8) & 0xFF), (uint8_t)(port & 0xFF) }; // destinationNetwork 0 = the local network only (not the global 0xFFFF). BACnetStack_SendIAm(deviceInstance, connectionString, 6, - g_networkPortInstance, + networkPortInstance, true /*broadcast*/, 0 /*local network*/, NULL, 0); } +void SendIAm(const uint32_t deviceInstance) { + SendIAm(deviceInstance, g_networkPortInstance); +} + KeyCommand PollKey() { #if defined(_WIN32) if (!_kbhit()) { @@ -493,6 +604,9 @@ KeyCommand PollKey() { if (c == 'h' || c == 'H') return KeyCommand::Help; if (c == 'q' || c == 'Q') return KeyCommand::Quit; if (c == 's' || c == 'S') return KeyCommand::DemoAdvance; + if (c == 'w' || c == 'W') return KeyCommand::WriteGroupDemo; + if (c == 'd' || c == 'D') return KeyCommand::DiscoverRemote; + if (c == 'r' || c == 'R') return KeyCommand::RouterAnnounce; return KeyCommand::None; #else EnableRawInput(); @@ -509,6 +623,9 @@ KeyCommand PollKey() { if (buf[0] == 'h' || buf[0] == 'H') return KeyCommand::Help; if (buf[0] == 'q' || buf[0] == 'Q') return KeyCommand::Quit; if (buf[0] == 's' || buf[0] == 'S') return KeyCommand::DemoAdvance; + if (buf[0] == 'w' || buf[0] == 'W') return KeyCommand::WriteGroupDemo; + if (buf[0] == 'd' || buf[0] == 'D') return KeyCommand::DiscoverRemote; + if (buf[0] == 'r' || buf[0] == 'R') return KeyCommand::RouterAnnounce; return KeyCommand::None; #endif } diff --git a/common/CASExampleHelper.h b/common/CASExampleHelper.h index 048ef90..546f375 100644 --- a/common/CASExampleHelper.h +++ b/common/CASExampleHelper.h @@ -40,7 +40,7 @@ namespace CASExampleHelper { // version). Bump it whenever anything in common/ changes, and record the // change in common/CHANGELOG.md - every example in the series must then be // re-synced to the same common/ version. -static const char* COMMON_VERSION = "2.1.0"; +static const char* COMMON_VERSION = "2.5.0"; // Print the example's name + version, the linked CAS BACnet Stack version, // and the common/ helper version. @@ -73,34 +73,68 @@ uint16_t ParsePortArg(int argc, char** argv, uint16_t defaultPort); uint32_t ParseDeviceIdArg(int argc, char** argv, uint32_t defaultDeviceId); // --- Networking ------------------------------------------------------------ -// Bind the shared UDP socket to the BACnet/IP port (default 47808 / 0xBAC0). +// Bind the UDP socket used by the CURRENT Network Port instance (the one last +// named by SetNetworkPortInstance(), or instance 1 if that was never called - +// the series convention for a single-port example). This is the entry point +// every single-port example has always used; its behaviour is unchanged by +// the multi-port support below: it binds exactly one socket, keyed to exactly +// one Network Port instance, exactly as before 2.3.0. bool SetupUDP(uint16_t port); -// Close the shared UDP socket. +// Bind an ADDITIONAL UDP socket for a SPECIFIC Network Port object instance - +// added in common/ 2.3.0 for examples that own more than one BACnet/IP link +// (e.g. a router example with a Network Port per side). Call once per port, +// each with a different networkPortInstance. Internally this is the same +// per-instance binding SetupUDP(port) uses for the "current" instance; the +// two overloads share one small table (CASExampleHelper.cpp), so mixing them +// is safe - SetupUDP(port) is exactly SetupUDP(port, ). +// +// The receive callback polls every bound socket in round-robin order each +// tick (so one busy port cannot starve another) and reports the instance the +// datagram arrived on; the send callback looks up the socket whose instance +// matches the one the stack names. A single-port example has exactly one +// entry in that table, so both callbacks collapse back to "the one socket" - +// see the "WHY THIS IS SAFE FOR SINGLE-PORT EXAMPLES" comment in +// CASExampleHelper.cpp. +bool SetupUDP(uint16_t port, uint32_t networkPortInstance); + +// Close every UDP socket bound by SetupUDP() (all instances). void ShutdownUDP(); -// Tell the helper which Network Port object instance owns the UDP socket. +// Tell the helper which Network Port object instance is "current" - the one +// the single-argument SetupUDP(port) and SendIAm(deviceInstance) overloads +// act on. // // The stack identifies a link by the INSTANCE of its Network Port object, not // by a transport network type: the receive callback reports the instance a -// datagram arrived on, the send callback is told the instance to send from, and -// SendIAm is told which port to announce on. The helper serves one port, so it -// needs to know its instance. +// datagram arrived on, the send callback is told the instance to send from, +// and SendIAm is told which port to announce on. // // Call this once, after BACnetStack_AddNetworkPortObject() and before // RegisterCommonCallbacks(). It defaults to 1 - the series convention - so an // example that uses instance 1 need not call it, but calling it explicitly -// keeps main.cpp's Network Port instance the single source of truth. +// keeps main.cpp's Network Port instance the single source of truth. A +// multi-port example (SetupUDP(port, instance) for two or more instances) +// still calls this once, for whichever instance should be "current" for the +// single-argument SetupUDP()/SendIAm() overloads - typically its first port. void SetNetworkPortInstance(uint32_t networkPortInstance); // Register the transport + system-time callbacks (backed by the UDP socket // created in SetupUDP, so call SetupUDP first). void RegisterCommonCallbacks(); -// Broadcast an unsolicited I-Am for the given device. ANSI/ASHRAE 135 requires -// a device to announce itself with I-Am on start-up. +// Broadcast an unsolicited I-Am for the given device on the CURRENT Network +// Port instance (see SetNetworkPortInstance). ANSI/ASHRAE 135 requires a +// device to announce itself with I-Am on start-up. Unchanged since before +// 2.3.0 for a single-port example. void SendIAm(uint32_t deviceInstance); +// Broadcast an unsolicited I-Am for the given device on a SPECIFIC Network +// Port instance - added in common/ 2.3.0 for a multi-port example that must +// announce itself once per port/network it serves. SendIAm(deviceInstance) is +// exactly SendIAm(deviceInstance, ). +void SendIAm(uint32_t deviceInstance, uint32_t networkPortInstance); + // Get the primary IPv4 interface's address and subnet mask (each as 4 octets). // These are the values a BACnet/IP Network Port object reports (IP_Address, // IP_Subnet_Mask), and the broadcast (ip | ~mask) is the I-Am target. Returns @@ -170,8 +204,16 @@ enum class KeyCommand { Quit, // 'q' - exit ArrowUp, // up arrow ArrowDown, // down arrow - DemoAdvance // 's' - advance a demo (e.g. a Schedule) to its next step now, - // bypassing whatever wall-clock wait it would otherwise need + DemoAdvance, // 's' - advance a demo (e.g. a Schedule) to its next step now, + // bypassing whatever wall-clock wait it would otherwise need + WriteGroupDemo,// 'w' - manually fire a demo WriteGroup (or other outbound + // SendWriteProperty) instead of waiting for whatever + // triggers it normally + DiscoverRemote, // 'd' - send a demo SendWhoIs to discover a remote device + // this example writes to or reads from + RouterAnnounce // 'r' - manually (re-)send I-Am-Router-To-Network now, instead + // of waiting for the one sent at start-up, so routing + // can be demonstrated on demand }; // Non-blocking: returns a pending key command, or None if nothing was pressed. diff --git a/common/CHANGELOG.md b/common/CHANGELOG.md index 23c5cdc..bb76c17 100644 --- a/common/CHANGELOG.md +++ b/common/CHANGELOG.md @@ -12,6 +12,92 @@ entry here, and must then be re-copied into **every** example in the series. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the folder adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.5.0] - 2026-09-15 + +### Added + +- `PROPERTY_IDENTIFIER_ROUTING_TABLE = 428` in `CASBACnetStackExampleConstants.h` + (Network Port's `Routing_Table`, optional - `BACnetStack_SetPropertyEnabled` + first). Matches `BACnetPropertyIdentifier.h`'s `routingTable = 428`. First + consumer: `BACnetProfileExample-B-RTR-CPP` (F-ROUTER, Wave 2), which enables + it on both its Network Port objects so a client can read back the routing + table it configures with `AddRouterPort`/`AddRouterRoute`. + +## [2.4.0] - 2026-09-15 + +### Added + +- `KeyCommand::RouterAnnounce` (key `r` / `R`), wired in `PollKey()` on both the + Windows (`_getch`) and POSIX (raw-terminal `read`) code paths. Non-breaking, + purely additive: existing `switch (CASExampleHelper::PollKey())` call sites + with a `default:` case (every current example) build unchanged. +- Claimed in the series-wide `docs/menu-keys.md`: manually (re-)send + I-Am-Router-To-Network now, instead of waiting for the one sent at start-up, + so routing can be demonstrated on demand. First consumer: + `BACnetProfileExample-B-RTR-CPP`'s F-ROUTER demo (Wave 2); any later + routing/gateway example (e.g. B-GW) reuses this same key rather than + claiming a new one. + +## [2.3.0] - 2026-09-15 + +### Added + +- Multi-port UDP support: `SetupUDP(uint16_t port, uint32_t networkPortInstance)` + and `SendIAm(uint32_t deviceInstance, uint32_t networkPortInstance)` overloads, + backed by a small internal table of UDP socket bindings keyed by Network Port + instance (`CASExampleHelper.cpp`, `UdpBinding` / `g_udpBindings`), replacing the + single file-local `SimpleUDP g_udp`. `HelperReceiveMessage` now polls every + bound socket in round-robin order and reports the instance a datagram actually + arrived on; `HelperSendMessage` looks up the socket bound to the instance the + stack names instead of comparing against one "the" instance. +- First consumer: `BACnetProfileExample-B-RTR-CPP` (Wave 2, F-ROUTER / + F-MULTIPORT canonical example), which owns two Network Port objects ("Vermilion" + and "Vermilion 2") on two UDP ports and needs the receive/send callbacks to + dispatch on `networkPortInstance` per ANSI/ASHRAE 135 routing (`AddRouterPort`, + `AddRouterRoute`, `SendIAmRouterToNetwork`). + +### Non-breaking for every single-port example + +- `SetupUDP(uint16_t port)` and `SendIAm(uint32_t deviceInstance)` keep their + existing signatures and now simply forward to the two-argument overloads with + `networkPortInstance` = whatever `SetNetworkPortInstance()` last set (instance 1 + by default, unchanged). A single-port example therefore ends up with exactly one + entry in the internal binding table, and every codepath (receive round-robin + over one entry, send lookup against one entry) collapses back to the same work + the old single-`SimpleUDP` implementation did. See the "WHY THIS IS SAFE FOR + SINGLE-PORT EXAMPLES" comment above `struct UdpBinding` in + `CASExampleHelper.cpp`. +- Verified directly against `BACnetProfileExample-B-SS-CPP` itself (single Network + Port, instance 1): rebuilt STATIC against the pinned stack, smoke-tested on a + non-default port — startup, `Listening for BACnet/IP on UDP port ...`, the + broadcast I-Am, and a Who-Is/I-Am/ReadProperty exchange with an external client + all matched the pre-change baseline byte-for-byte in content (only the RX/TX log + lines gained a trailing `(Network Port N)` annotation). +- The `RX`/`TX` console log lines gained a trailing `(Network Port N)` annotation; + no gate script or CI step matches those lines verbatim (checked: + `tools/check-series.sh`, `tools/*.sh` contain no `RX %u bytes` / `TX %u bytes` + pattern), and the existing substring checks in the runbook's smoke-test step + (`Listening for BACnet/IP on UDP port ...`, `... (broadcast)`) still match as + prefixes of the new lines. + +## [2.2.0] - 2026-09-15 + +### Added + +- `KeyCommand::WriteGroupDemo` (key `w` / `W`) and `KeyCommand::DiscoverRemote` + (key `d` / `D`), wired in `PollKey()` on both the Windows (`_getch`) and + POSIX (raw-terminal `read`) code paths. Non-breaking, purely additive: + existing `switch (CASExampleHelper::PollKey())` call sites with a `default:` + case (every current example) build unchanged. +- Claimed in the series-wide `docs/menu-keys.md`: `WriteGroupDemo` manually + fires a demo WriteGroup (or other outbound `SendWriteProperty`) instead of + waiting for whatever normally triggers it; `DiscoverRemote` sends a demo + `SendWhoIs` to discover a remote device this example writes to or reads + from. First consumer: `BACnetProfileExample-B-LS-CPP`'s F-CHANNEL / + F-EXTWRITE / F-SCHED-E demo (Wave 2); any later example with a remote-write + or remote-discovery demo reuses these same keys rather than claiming new + ones. + ## [2.1.0] - 2026-09-15 ### Added