Skip to content

[codex] Use DSC and generic NMEA enums#10

Merged
mgrouch merged 2 commits into
mainfrom
nmea-dsc-status-enums
Jul 6, 2026
Merged

[codex] Use DSC and generic NMEA enums#10
mgrouch merged 2 commits into
mainfrom
nmea-dsc-status-enums

Conversation

@mgrouch

@mgrouch mgrouch commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add generic NMEA coded-value enums in the existing helper header for A/V data status, T/M bearing reference, and L/R side.
  • Use NmeaSide in parse_left_right_signed() instead of raw L/R checks.
  • Add DSC format, category, and end-signal enums directly in nmea_dsc.hpp.
  • Replace DSC raw format/category/end-signal constants with enum values.

Testing

  • CI is green per request.

Summary by CodeRabbit

  • Bug Fixes
    • Improved parsing of marine communication data to handle status, bearing, and side fields more reliably.
    • Fixed left/right signed value handling so invalid or unexpected inputs are validated more consistently.
    • Updated message classification logic to better recognize DSC formats, categories, and end-of-sequence signals.

@mgrouch mgrouch merged commit bf7d8ae into main Jul 6, 2026
4 of 5 checks passed
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: adc9fb89-f3e1-4db0-bb3e-54f677695353

📥 Commits

Reviewing files that changed from the base of the PR and between e859f54 and 80d1e01.

📒 Files selected for processing (2)
  • modules/nmea0183/src/nmea0183_connector/nmea0183_helpers.hpp
  • modules/nmea0183/src/nmea0183_connector/nmea_dsc.hpp

📝 Walkthrough

Walkthrough

This PR introduces strongly-typed enums for NMEA and DSC field parsing. New enums (NmeaDataStatus, NmeaBearingReference, NmeaSide, DscFormatSpecifier, DscCategory, DscEndSignal) replace raw character/numeric literal comparisons in helper functions and switch statements across two header files.

Changes

NMEA/DSC Enum Typing

Layer / File(s) Summary
NMEA field enums and parsing helpers
modules/nmea0183/src/nmea0183_connector/nmea0183_helpers.hpp
Adds NmeaDataStatus, NmeaBearingReference, NmeaSide enums with inline conversion/validation helpers, and updates parse_left_right_signed to parse side via nmea_side_from_char and compute sign from the resulting enum instead of comparing raw characters.
DSC enum typing for format/category/end-signal
modules/nmea0183/src/nmea0183_connector/nmea_dsc.hpp
Adds DscFormatSpecifier, DscCategory, DscEndSignal enums, rewrites dsc_format_is_distress, dsc_category_is_*, and dsc_end_signal_is_ack to use enum comparisons, and updates the dsc_address_type_from_format switch to use enum case labels instead of numeric literals.

Estimated code review effort: 2 (Simple) | ~10 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nmea-dsc-status-enums

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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