diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-09 14:12:35 +0200 |
| commit | ffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch) | |
| tree | 1269efa852935b183daae4bb33a58d1b4d2ffb53 /DecoderOutputFramer.cpp | |
| parent | 059831534c7e884f0a607ed86b582fd00d821731 (diff) | |
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
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 {}; |
