From 059831534c7e884f0a607ed86b582fd00d821731 Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sat, 26 Sep 2026 23:24:03 +0200 Subject: New upstream version 3.2.0~rc1+dfsg --- Ft8MtdDecodeCoordinator.cpp | 74 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Ft8MtdDecodeCoordinator.cpp (limited to 'Ft8MtdDecodeCoordinator.cpp') diff --git a/Ft8MtdDecodeCoordinator.cpp b/Ft8MtdDecodeCoordinator.cpp new file mode 100644 index 00000000..f314f65a --- /dev/null +++ b/Ft8MtdDecodeCoordinator.cpp @@ -0,0 +1,74 @@ +#include "Ft8MtdDecodeCoordinator.hpp" + +Ft8MtdDecodeCoordinator::Decision Ft8MtdDecodeCoordinator::request ( + Stage stage, qint64 period, int earlyStageCount, bool decoderBusy) +{ + return scheduler_.request (stage, period, earlyStageCount, decoderBusy, + hasPending ()); +} + +bool Ft8MtdDecodeCoordinator::published (Stage stage, qint64 period) +{ + return scheduler_.published (stage, period); +} + +void Ft8MtdDecodeCoordinator::completed (Stage stage, qint64 period) +{ + scheduler_.completed (stage, period); +} + +void Ft8MtdDecodeCoordinator::publicationFailed (Stage stage, qint64 period) +{ + scheduler_.publicationFailed (stage, period); +} + +Ft8MtdDecodeCoordinator::Action Ft8MtdDecodeCoordinator::deferFinal ( + std::unique_ptr pending) +{ + Q_ASSERT (pending); + Q_ASSERT (8 == pending->payload.params.nmode); + Q_ASSERT (pending->payload.params.lmultift8); + auto const action = pending_ ? Action::ReplaceFinal : Action::DeferFinal; + pending_ = std::move (pending); + return action; +} + +Ft8MtdDecodeCoordinator::DrainOutcome Ft8MtdDecodeCoordinator::drainPending ( + PendingValidator const& validator, PendingPublisher const& publisher) +{ + if (!pending_) return {}; + + auto pending = std::move (pending_); + DrainOutcome outcome; + outcome.period = pending->period; + if (!validator (*pending)) + { + scheduler_.cancel (); + outcome.result = DrainResult::Obsolete; + return outcome; + } + + switch (publisher (*pending)) + { + case PendingPublishResult::Published: + outcome.result = DrainResult::Published; + outcome.recovered = scheduler_.published (Stage::Final, pending->period); + return outcome; + case PendingPublishResult::Unavailable: + pending_ = std::move (pending); + outcome.result = DrainResult::Retained; + return outcome; + case PendingPublishResult::Failed: + scheduler_.publicationFailed (Stage::Final, pending->period); + outcome.result = DrainResult::Failed; + return outcome; + } + + return outcome; +} + +void Ft8MtdDecodeCoordinator::cancel () +{ + scheduler_.cancel (); + pending_.reset (); +} -- cgit v1.2.3