Skip to content

NAVTEX waveform support — data layer + protocol plumbing (#2132)#2186

Merged
ten9876 merged 2 commits intomainfrom
aether/navtex-data-layer
Apr 30, 2026
Merged

NAVTEX waveform support — data layer + protocol plumbing (#2132)#2186
ten9876 merged 2 commits intomainfrom
aether/navtex-data-layer

Conversation

@ten9876
Copy link
Copy Markdown
Owner

@ten9876 ten9876 commented Apr 30, 2026

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 NavtexApplet UI class, but it was unwired: no AppletPanel registration, no construction site in MainWindow, 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}) — parses navtex and navtex sent status messages, formats the navtex send command, tracks per-message state (Pending → Queued → Sent / Error).
  • RadioModel wiring — subscribes to sub navtex all, routes status, forwards command/reply.
  • SliceModel::applyStatus — classifies NT as USB-family for filter/AGC purposes.
  • MainWindow / RxApplet / VfoWidgetNT mode tolerance threaded through the mode-string switch so the GUI doesn't crash on slice mode NT.

Improvements over the original PR

  1. Quote-escape msg_text="..." — the bot's arg(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.

  2. Failure-path bug fix in handleSendResponse — error responses come as R<seq>|<errcode>| with empty body. The original if (indexStr.isEmpty()) return; check fired before the if (respVal != 0) markError() branch, making error reporting unreachable. The unit test caught this. Fixed by reordering.

  3. New unit test (tests/navtex_model_test.cpp, 21 assertions):

    • Pending → Queued promotion via handleSendResponse(0, "<idx>")
    • Queued → Sent promotion via parseStatus("navtex sent", ...)
    • Send-failure path (respVal != 0 with empty body)
    • Orphan navtex sent for unknown idx (Multi-Flex case)
    • Case-insensitive status string parsing
    • msg_text quote/backslash escaping
    • Idempotent navtex sent handling

Out of scope (for follow-up)

  • NavtexApplet UI — needs activate/deactivate UX decision (auto-activate when applet opens vs explicit Activate/Deactivate buttons; per FlexLib Radio.cs ParseStatus around line 3480 and NAVTEX.cs).
  • Frequency/license validation — radio handles this; UI may want to surface "no NAVTEX license" status more visibly.

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 clean (full app + new test target)
  • ./build/navtex_model_test — all 21 assertions pass
  • CI green (Linux + Windows + CodeQL)

Fixes #2132.

🤖 Generated with Claude Code

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]>
@ten9876 ten9876 merged commit d093082 into main Apr 30, 2026
5 checks passed
@ten9876 ten9876 deleted the aether/navtex-data-layer branch April 30, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Protocol v4.2.18: NAVTEX waveform support + slice mode NT

1 participant