diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /qmap/qmap_decode_record.cpp | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'qmap/qmap_decode_record.cpp')
| -rw-r--r-- | qmap/qmap_decode_record.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/qmap/qmap_decode_record.cpp b/qmap/qmap_decode_record.cpp new file mode 100644 index 00000000..7891bfeb --- /dev/null +++ b/qmap/qmap_decode_record.cpp @@ -0,0 +1,41 @@ +#include "qmap_decode_record.h" + +#include "Decoder/decodedtext.h" + +std::optional<QMapDecodeRecord> parseQMapDecodeRecord (QByteArray const& row) +{ + if (row.size () != static_cast<int> (QMapDecodeRowSize)) return std::nullopt; + + auto text = QString::fromLatin1 (row.constData (), row.size ()); + auto const terminator = text.indexOf (QChar::Null); + if (terminator >= 0) text.truncate (terminator); + + bool timeOk {}; + bool receiveOk {}; + bool scheduledOk {}; + bool snrOk {}; + auto const hhmmss = text.left (6).toInt (&timeOk); + auto const hour = hhmmss / 10000; + auto const minute = (hhmmss / 100) % 100; + auto const second = hhmmss % 100; + + QMapDecodeRecord record; + record.raw = row; + record.time = text.left (6); + record.receiveFrequencyKHz = text.mid (6, 9).toDouble (&receiveOk); + record.scheduledFrequencyKHz = text.mid (15, 7).toDouble (&scheduledOk); + record.snr = text.mid (29, 5).toInt (&snrOk); + record.submode = text.mid (36, 3).trimmed (); + auto const fields = parseDecodedMessage (text.mid (41)); + record.callsign = fields.sender; + record.grid = fields.grid; + record.secondsSinceMidnight = hour * 3600 + minute * 60 + second; + record.secondHalf = second == 30; + record.cq = fields.cq; + + if (!timeOk || !receiveOk || !scheduledOk || !snrOk + || hour > 23 || minute > 59 || second > 59 || record.submode.isEmpty ()) { + return std::nullopt; + } + return record; +} |
