Skip to content

fix(protocol): respect M-message severity so Info notices don't pop modals#2785

Merged
ten9876 merged 1 commit into
mainfrom
auto/fix-m-message-severity
May 17, 2026
Merged

fix(protocol): respect M-message severity so Info notices don't pop modals#2785
ten9876 merged 1 commit into
mainfrom
auto/fix-m-message-severity

Conversation

@ten9876

@ten9876 ten9876 commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

PR #2771 (merged today) added user-facing dialogs for M-prefix radio messages. In practice the radio sends an Info-severity M-message on every client connect/disconnect ("Client connected from IP …" etc.) — routine multi-client notices that SmartSDR silently logs. AetherSDR was popping a modal warning dialog on every connect as a result.

The fix extracts the severity bits that FlexLib documents but AetherSDR's parser was discarding, then surfaces messages appropriately by severity.

Root cause

FlexLib's wire format (Radio.cs:4498-4516) encodes severity in bits 24-25 of the M-message number:

```
M<8-hex-digits>|
└── (num >> 24) & 0x3 → Info=0, Warning=1, Error=2, Fatal=3
```

AetherSDR's `CommandParser` was extracting the handle as a single hex value but discarding the severity bits. PR #2771's MainWindow handler then treated all M-messages identically as `QMessageBox::warning`.

What changes

  • `CommandParser`: new `MessageSeverity` enum + `severity` field on `ParsedMessage`; `'M':` case now extracts `(handle >> 24) & 0x3` into it
  • `RadioModel::radioMessageReceived` signal extended to `(QString, MessageSeverity)`
  • `RadioModel::onMessageReceived` logs at the matching protocol level (`qCInfo` / `qCWarning` / `qCCritical`) — log path and UI path now both switch on the same enum so they can't disagree
  • `MainWindow::onRadioMessage` switches on severity:
Severity Behavior
Info `statusBar()->showMessage(text, 5000)` — 5-second toast, no modal
Warning `QMessageBox::warning` (PR #2771's intent preserved)
Error `QMessageBox::critical` with "Radio — Error" title
Fatal `QMessageBox::critical` with "Radio — Fatal" title

Behavior changes

  • "Client connected from IP …" → status-bar toast (was modal popup) ✅
  • "Client disconnected from IP …" → status-bar toast (was modal popup) ✅
  • FreeDV mode-conflict warning from fix: parse hex meter num field and handle M-prefix radio messages #2771 — unchanged, still modal ✅
  • Future ATU / interlock / calibration errors — modal with "Error"/"Fatal" title prefix instead of "Radio" generic

Test plan

  • Local build clean (402/402 link, only pre-existing warnings)
  • Connect to FLEX-8400 — IP notice appears in status bar for 5 seconds, no modal interrupts connection flow. Confirmed by @ten9876.
  • Trigger a Warning-severity M-message (e.g. set two slices to FDVU when FreeDV is running) — modal warning still appears
  • No regression in other M-message consumers (none exist in current codebase per grep)

Files

File Change
`src/core/CommandParser.h` `MessageSeverity` enum + `ParsedMessage::severity` field + protocol-format comment refresh
`src/core/CommandParser.cpp` Extract severity bits in the `'M':` case
`src/models/RadioModel.h` Signal signature + `CommandParser.h` include
`src/models/RadioModel.cpp` Switch on severity for log level; emit with severity
`src/gui/MainWindow.h` Slot signature + `CommandParser.h` include
`src/gui/MainWindow.cpp` Switch on severity for log + dialog/toast

Net: 83 insertions / 16 deletions across 6 files.

🤖 Generated with Claude Code

…odals

PR #2771 surfaced M-prefix radio messages as user-facing dialogs but
treated every message as a warning.  In practice the radio sends an
Info-severity M-message on every client connect ("Client connected
from IP …") — a routine multi-client notice that SmartSDR silently
logs.  AetherSDR was popping a modal warning dialog on every connect
as a result.

FlexLib's wire format (Radio.cs:4498-4516) encodes severity in bits
24-25 of the message number:

  M<8-hex-digits>|<text>
        └── (num >> 24) & 0x3 → Info=0, Warning=1, Error=2, Fatal=3

CommandParser was extracting the handle as a single hex value but
discarding the severity bits.  This change pulls them out into a new
MessageSeverity enum field on ParsedMessage, threads them through the
radioMessageReceived signal, and switches on them in MainWindow:

  Info     → statusBar()->showMessage(text, 5000)  (5-second toast)
  Warning  → QMessageBox::warning  (PR #2771's intent — preserved)
  Error    → QMessageBox::critical with "Radio — Error" title
  Fatal    → QMessageBox::critical with "Radio — Fatal" title

The protocol-channel logging in RadioModel::onMessageReceived also
switches on the same enum (qCInfo / qCWarning / qCCritical) so the
diagnostic level matches the user-facing surfacing.  Both paths use
the SAME enum so they can't disagree.

Behavior changes:
  * "Client connected from IP …" → status-bar toast (was modal popup)
  * "Client disconnected from IP …" → status-bar toast (was modal popup)
  * FreeDV mode-conflict warning from #2771 — unchanged, still modal
  * Future ATU/interlock/calibration errors — modal with Error/Fatal
    title prefix

Tested locally: connect to FLEX-8400 → IP notice appears in status
bar for 5 seconds, no modal dialog interrupts the connection flow.

Files:
  src/core/CommandParser.h    — MessageSeverity enum + ParsedMessage
                                field + protocol comment update
  src/core/CommandParser.cpp  — extract severity bits in the 'M' case
  src/models/RadioModel.h     — signal signature + comment
  src/models/RadioModel.cpp   — switch on severity for protocol log
                                level; emit with severity
  src/gui/MainWindow.h        — slot signature + CommandParser include
  src/gui/MainWindow.cpp      — switch on severity for log + dialog

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ten9876 ten9876 requested a review from jensenpat as a code owner May 17, 2026 02:01
@ten9876 ten9876 enabled auto-merge (squash) May 17, 2026 02:01
@ten9876 ten9876 merged commit 97b2140 into main May 17, 2026
5 checks passed
@ten9876 ten9876 deleted the auto/fix-m-message-severity branch May 17, 2026 02:26
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.

1 participant