Add RAK13800 Ethernet Companion targets with multi-client TCP support - #2972
Add RAK13800 Ethernet Companion targets with multi-client TCP support#2972mathisono wants to merge 8 commits into
Conversation
|
Progress summary: This PR replaces the earlier target-name-only framing from #2929 with a clearer branch and PR scope: RAK13800 Ethernet Companion board support with multi-client framed Companion TCP. What has been completed:
Transport verification completed:
The standout functional change is multi-client framed Companion TCP: multiple Companion clients can stay connected at the same time, push frames can be broadcast, and command responses route back to the client that sent the command. |
|
Hi @mathisono — heads up on an overlap here. #2679 (rebased onto #1983, currently open) already includes an equivalent multi-client Rather than land two independent multi-client implementations of the same transport, might be worth coordinating on which one moves forward (or merging the better parts of each). @ripplebiz — you made the call on #1983 vs #2679 as the Ethernet foundation last time; would appreciate your read on how to reconcile this one too, given the overlap. Happy to compare implementations in more detail if useful. |
liamcottle's unrelated refactor (MultiSerialInterface + chip-agnostic EthernetInterface/SerialEthernetInterface base with RAK13800/CH390 drivers) landed in dev and deleted the old src/helpers/nrf52/SerialEthernetInterface.* this PR previously extended. Rebase onto that, and re-target the multi-client + PoE-safe deferred bring-up work at the new RAK13800EthernetInterface class instead, so meshcore-dev#2679 stays mergeable: - RAK13800EthernetInterface.{h,cpp}: keep inheriting the shared SerialEthernetInterface base (for its debug macros/ETHERNET_TCP_PORT default), but fully override writeFrame()/checkRecvFrame()/enable()/ disable()/isConnected()/isWriteBusy()/loop() with a multi-client-aware implementation (MAX_ETH_CLIENTS=3, per-client parse state, round-robin polling, response routing, push-frame broadcast) -- this is now the default for ALL RAK13800 companion builds, not just the PoE ones, matching meshcore-dev#2972's original intent. available()/read()/write() are trivial stubs kept only to satisfy the base class's pure-virtual contract. - Same WITH_W5100S_POE-gated deferred bring-up as before (skip Ethernet init/begin in begin(), do it from loop() after ETH_POE_DEFER_MS once the PoE converter has latched, bounded DHCP with static-IP fallback). - No changes needed to the shared SerialEthernetInterface/EthernetInterface/ MultiSerialInterface files, CH390's driver, or companion_radio/main.cpp -- same class name/location, so ETHERNET_CLASS=RAK13800EthernetInterface picks this up automatically. - simple_room_server/main.cpp: add the same WITH_W5100S_POE boot-delay shortcut (1000ms -> 20ms) simple_repeater already had, for consistency now that it also has a _poe env. This also makes meshcore-dev#2972 (the other multi-client attempt) moot -- it targets the now-deleted nrf52/SerialEthernetInterface.* path. Verified: RAK_4631_{repeater,room_server,companion_radio}_ethernet_poe, the plain _ethernet envs, and non-Ethernet envs (repeater, room_server, companion_radio_usb/ble) all build clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This PR is a follow-up to the Ethernet support merged in #1983.
It adds the RAK13800 Ethernet Companion board-support layer and upgrades the Companion Ethernet transport from single-client behavior to multi-client framed Companion TCP.
Headline changes
Multi-client framed Companion TCP
This PR updates
SerialEthernetInterfaceso multiple Companion TCP clients can remain connected at the same time.The transport now supports:
MAX_ETH_CLIENTS, defaulting to 3_last_rxtracking for command response routingThis avoids the old failure mode where a second connection or incoming packet could close the live Companion socket.
Framed Companion API preserved
This is still MeshCore Companion framing, not CLI/raw-line mode:
This PR intentionally does not enable raw line mode for the Companion target.
RAK13800 board-support targets
Adds canonical RAK13800 Ethernet Companion targets:
RAK_RAK13800_companion_radio_ethRAK_RAK13800_companion_radio_eth_static_diagKeeps compatibility aliases for older names:
RAK_4631_companion_radio_eth_cleanRAK_4631_companion_radio_eth_static_diagRAK_4631_companion_radio_ethernetCrow / gateway settings
The RAK13800 Companion target uses:
ETHERNET_ENABLED=1ETHERNET_TCP_PORT=4403FORCE_CLIENT_REPEAT=0MAX_CONTACTS=128The static diagnostic target adds:
10.245.94.4710.245.94.3310.245.94.33255.255.255.224Device model
Ethernet builds report:
Normal RAK4631 builds continue to report the normal RAK4631 model string.
What this is not
This is the framed MeshCore Companion API over Ethernet TCP, with multi-client support for RAK4631 + RAK13800/W5100S hardware.
Validation
Added Companion TCP smoke-test scripts for:
Expected validation:
Expected static diagnostic hardware result:
10.245.94.47/274403openAPP_STARTreceives a responseDEVICE_QUERYreceives response code0x0d