NAVTEX waveform support — data layer + protocol plumbing (#2132)#2186
Merged
NAVTEX waveform support — data layer + protocol plumbing (#2132)#2186
Conversation
Adds support for FlexLib v4.2.18's NAVTEX maritime broadcast waveform. Scope is data layer + protocol plumbing only, per #2132's explicit "visual design + UX is maintainer-only" instruction. Carved out of bot PR #2137; the standalone NavtexApplet UI class it included was unwired (no AppletPanel registration, no construction site in MainWindow, no activate/deactivate command path), so it would have been dead code in production. Leaves the UI work for a maintainer-driven follow-up when the activate/deactivate UX is decided. See PR #2137 review comment for the full rationale. What's included: - NavtexModel: parses `navtex` and `navtex sent` status messages, formats `navtex send tx_ident=... subject_indicator=... msg_text=...`, tracks per-message state (Pending → Queued → Sent / Error). Pending messages keyed by command sequence number; promoted to Queued via the reply handler then to Sent via the broadcast. - RadioModel wiring: subscribes to `sub navtex all` and routes status to NavtexModel. Forwards commandReady and replyCommandReady, with a reply handler that drives handleSendResponse. - SliceModel: NT mode classified as USB-family for filter/AGC purposes (matches FlexLib's slice-mode handling for digital data modes). - MainWindow / RxApplet / VfoWidget: NT mode threaded through the mode-string switch so the GUI doesn't crash or fall through to "unknown" when a slice enters mode NT. Improvements over the original PR: 1. Quote-escape `msg_text="..."` in NavtexModel::sendMessage. The original `arg(msgText)` substitution would break the radio's command parser if the user's message contained a `"` or `\`. Backslash is escaped first to avoid double-escaping existing backslashes. 2. Failure-path bug fix in handleSendResponse: failure responses come as `R<seq>|<errcode>|` with empty body, so the original "if indexStr empty bail" check fired BEFORE the "if respVal != 0 mark Error" branch — making error reporting unreachable. Fixed by reordering: check pending entry first, then respVal != 0, then index parsing. 3. New unit test `tests/navtex_model_test.cpp` (21 assertions) covering: Pending → Queued promotion, Queued → Sent promotion, send-failure path, orphan navtex-sent (Multi-Flex case), case- insensitive status string parsing, msg_text quote/backslash escaping, idempotent navtex-sent handling. Fixes #2132. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The DxClusterDialog::freedvReportingToggled connect lambda references m_radeEngine, m_radeSliceId, startFreeDvReporting(), and stopFreeDvReporting() — all of which are only declared under #ifdef HAVE_RADE. The connect itself was wrapped in #ifdef HAVE_WEBSOCKETS only, so on Windows (WebSockets present, RADE absent) the build broke with C2065/C3861. Introduced in #2173 (FreeDV Reporter), but check-windows skipped that PR because it didn't touch CMakeLists.txt / third_party / workflows. This NAVTEX branch modifies CMakeLists.txt for the new test executable, so check-windows fired and surfaced the regression. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds FlexLib v4.2.18 NAVTEX waveform support — data layer and protocol plumbing only, per #2132's explicit "visual design + UX is maintainer-only" instruction.
Provenance
Carve-out of bot PR #2137 (now closing). The original PR also included a standalone
NavtexAppletUI class, but it was unwired: noAppletPanelregistration, no construction site inMainWindow, and no activate/deactivate command path. Shipping it as-is would have been dead code in production; leaving it pending a maintainer UX decision is the right call.What's included
NavtexModel(src/models/NavtexModel.{h,cpp}) — parsesnavtexandnavtex sentstatus messages, formats thenavtex sendcommand, tracks per-message state (Pending → Queued → Sent / Error).RadioModelwiring — subscribes tosub navtex all, routes status, forwards command/reply.SliceModel::applyStatus— classifiesNTas USB-family for filter/AGC purposes.MainWindow/RxApplet/VfoWidget—NTmode tolerance threaded through the mode-string switch so the GUI doesn't crash on slice modeNT.Improvements over the original PR
Quote-escape
msg_text="..."— the bot'sarg(msgText)would have broken the radio's command parser on any"or\in the user's text. Backslash is escaped first so existing backslashes don't double-escape.Failure-path bug fix in
handleSendResponse— error responses come asR<seq>|<errcode>|with empty body. The originalif (indexStr.isEmpty()) return;check fired before theif (respVal != 0) markError()branch, making error reporting unreachable. The unit test caught this. Fixed by reordering.New unit test (
tests/navtex_model_test.cpp, 21 assertions):Pending → Queuedpromotion viahandleSendResponse(0, "<idx>")Queued → Sentpromotion viaparseStatus("navtex sent", ...)respVal != 0with empty body)navtex sentfor unknown idx (Multi-Flex case)msg_textquote/backslash escapingnavtex senthandlingOut of scope (for follow-up)
NavtexAppletUI — needs activate/deactivate UX decision (auto-activate when applet opens vs explicit Activate/Deactivate buttons; per FlexLibRadio.csParseStatus around line 3480 andNAVTEX.cs).The data layer landing now means that whenever the UI work is picked up, it'll just
#include "models/NavtexModel.h"and connect signals.Test plan
./build/navtex_model_test— all 21 assertions passFixes #2132.
🤖 Generated with Claude Code