diff options
| author | Dave Hibberd <hibby@debian.org> | 2026-10-20 22:35:06 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2026-10-20 22:35:06 +0100 |
| commit | 82ebb1ed1af30cee4dfbb1c628431d32885a00e0 (patch) | |
| tree | 1a1f782d3e576b758be0bc61171574a7cd8f2376 /DecoderOutputFramer.cpp | |
| parent | 061658210acb6425517733ea012dda803a7f72a1 (diff) | |
| parent | 61d684922b0f1c8455cc60eb3d123df058c9e1f5 (diff) | |
Merge tag 'debian/3.3.0_beta2+dfsg-1' into hibbian/trixie-backports
tagging wsjtx 3.3.0~beta2+dfsg-1
Diffstat (limited to 'DecoderOutputFramer.cpp')
| -rw-r--r-- | DecoderOutputFramer.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/DecoderOutputFramer.cpp b/DecoderOutputFramer.cpp index 92c9c1e9..151c6afb 100644 --- a/DecoderOutputFramer.cpp +++ b/DecoderOutputFramer.cpp @@ -10,7 +10,44 @@ void DecoderOutputFramer::drain (QIODevice& device, auto const rawLine = device.readLine (); Event event {EventType::Malformed, generation_, rawLine, {}}; - if (rawLine.startsWith ("<DecodeStarted>")) + if (rawLine.startsWith ("<DecoderReady") + || rawLine.startsWith ("<DecoderError")) + { + auto line = rawLine; + if (line.endsWith ('\n')) line.chop (1); + if (line.endsWith ('\r')) line.chop (1); + QByteArray const readyPrefix {"<DecoderReady> version="}; + QByteArray const errorPrefix {"<DecoderError> status="}; + if (line.startsWith (readyPrefix)) + { + auto const versionText = line.mid (readyPrefix.size ()); + bool valid = !versionText.isEmpty (); + for (auto const character : versionText) + valid = valid && character >= '0' && character <= '9'; + bool numeric {false}; + auto const version = versionText.toInt (&numeric); + if (valid && numeric && version > 0) + { + event.type = EventType::Ready; + event.protocolVersion = version; + } + } + else if (line.startsWith (errorPrefix)) + { + auto const status = line.mid (errorPrefix.size ()); + bool valid = !status.isEmpty (); + for (auto const character : status) + valid = valid && ((character >= 'a' && character <= 'z') + || (character >= '0' && character <= '9') + || character == '-'); + if (valid) + { + event.type = EventType::Error; + event.errorStatus = status; + } + } + } + else if (rawLine.startsWith ("<DecodeStarted>")) { qint32 generation {0}; if (!generation_ && DecoderIpc::parseStart (rawLine, &generation)) @@ -20,6 +57,11 @@ void DecoderOutputFramer::drain (QIODevice& device, event.generation = generation; } } + else if (rawLine.startsWith ("<DecodeRejected")) + { + if (generation_ && rawLine.startsWith ("<DecodeRejected> ")) + event.type = EventType::Rejected; + } else if (rawLine.startsWith ("<DecodeFinished>")) { DecoderIpc::Completion completion {}; |
