Route MQTT updates to local antenna display names (#2880). Principle I.#2882
Route MQTT updates to local antenna display names (#2880). Principle I.#2882aethersdr-agent[bot] wants to merge 1 commit into
Conversation
Adds a fixed MQTT topic contract that lets external station-automation (e.g. 4O3A Antenna Genius) update AetherSDR's per-radio antenna display aliases while preserving canonical SmartSDR tokens on the wire: aethersdr/antenna/name/<TOKEN> payload = display name (empty = clear) aethersdr/antenna/names payload = JSON object, null/"" = clear The parsing logic lives in a new `MqttAntennaAliasParser` TU so the contract is testable without a live broker and without linking Qt UI. `MqttApplet::onMessageReceived` calls the parser and emits a new `antennaAliasRequested` signal; `MainWindow` validates the token against `RadioModel::knownAntennaTokens()` and drops the message entirely when no radio is connected, so queued aliases cannot leak to a later radio. The two fixed topics are auto-subscribed on every connect, kept out of the user's `MqttTopics` so they can't accidentally unsubscribe them. Honors Principle I (FlexLib Is The Protocol Authority): the existing local-alias system keeps display labels separate from canonical tokens, so this routes MQTT updates through `setAntennaAlias` only — antenna commands continue to emit `ANT1`/`ANT2`/`RX_A`/`XVTA` as FlexLib expects, never the operator's local label. Blast radius: risk_score=0.183 on MqttApplet, all 3 high-risk callers (MainWindow ctor, MainWindow::buildUI, AppletPanel ctor) see additive surface only (new signal, new MqttApplet→MainWindow connection, no changes to existing signatures). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Reviewed the diff against the surrounding code. Looks good — focused, well-bounded, and the test coverage is genuinely strong for this kind of integration.
What I like
- Pure parser in its own TU.
MqttAntennaAliasParsertakes onlyQString/QByteArray, links no Qt UI types, and the test drives it directly. That's the right factoring for something whose "correctness" is really a topic-contract spec. - Defense in depth at the MainWindow seam. Gate on
isConnected()andknownAntennaTokens().contains(token). Even during the brief window whereconnectionStateChanged(true)has fired butm_chassisSerial/antenna list haven't populated,knownwill be empty so the alias gets dropped rather than persisted under the"unconnected"fallback key fromantennaAliasRadioKey()(RadioModel.cpp:541). Nice. - Fixed contract topics held outside
MqttTopics. Keepingaethersdr/antenna/namesandaethersdr/antenna/name/+subscribed independently of the user-editable topic list (MainWindow.cpp:1710-1714) means an operator can't accidentally unsubscribe the automation contract by editing the applet's topic settings. - Bulk-JSON semantics for clear are explicit. Both JSON
nulland""collapse to "empty alias → clear", and the comment inMqttAntennaAliasParser.hdocuments it. The tests pin both forms.
One small thing worth confirming (not a blocker)
MqttApplet::onMessageReceived still writes every incoming message — including the contract topics — to the visible m_messageLog (lines 266-275). For an operator who's set up bulk JSON re-publishes from Antenna Genius this could be a steady trickle into the message log. Probably fine, but if you wanted to suppress the contract topics from the human-readable log specifically, the early-return point would be right before the m_messageLog->append(line) for any topic that matches kNamesTopic or kNamePrefix. Easy follow-up if anyone complains.
Thanks for the careful work on this one — the parser/transport split and the test that exercises the disconnect-gate via a StubRadio are both above the typical bar.
|
Closing in favor of #2881 by @s53zo, which was opened ~1.5 hours Both PRs implement the MQTT → antenna-display-name routing, but
This PR is a process miss on the orchestrator's part — the Thanks to the bot for the parallel implementation — the architectural 73, |
Pull request was closed
Summary
Fixes #2880
What was changed
Route MQTT updates to local antenna display names (#2880). Principle I.
Files modified
CMakeLists.txtsrc/core/MqttAntennaAliasParser.cppsrc/core/MqttAntennaAliasParser.hsrc/gui/MainWindow.cppsrc/gui/MqttApplet.cppsrc/gui/MqttApplet.htests/mqtt_antenna_alias_test.cppGenerated by AetherClaude (automated agent for AetherSDR)