diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
| commit | 059831534c7e884f0a607ed86b582fd00d821731 (patch) | |
| tree | 76bcb67a78f8aa2654fd34c2ad801a62136b0170 /Ft8MtdDecodeCoordinator.hpp | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'Ft8MtdDecodeCoordinator.hpp')
| -rw-r--r-- | Ft8MtdDecodeCoordinator.hpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Ft8MtdDecodeCoordinator.hpp b/Ft8MtdDecodeCoordinator.hpp new file mode 100644 index 00000000..56e6a70b --- /dev/null +++ b/Ft8MtdDecodeCoordinator.hpp @@ -0,0 +1,75 @@ +#ifndef FT8_MTD_DECODE_COORDINATOR_HPP +#define FT8_MTD_DECODE_COORDINATOR_HPP + +#include <functional> +#include <memory> + +#include <QtGlobal> + +#include "DecodeOperatingContext.hpp" +#include "DecoderIpc.hpp" +#include "Ft8MtdDecodeScheduler.hpp" + +class Ft8MtdDecodeCoordinator +{ +public: + using Stage = Ft8MtdDecodeScheduler::Stage; + using Action = Ft8MtdDecodeScheduler::Action; + using Decision = Ft8MtdDecodeScheduler::Decision; + + struct PendingMtdDecode + { + DecoderIpc::Ft8MtdPayload payload; + DecodeOperatingContext context; + qint64 period {0}; + }; + + enum class PendingPublishResult + { + Published, + Unavailable, + Failed + }; + + enum class DrainResult + { + NoPending, + Published, + Retained, + Obsolete, + Failed + }; + + struct DrainOutcome + { + DrainResult result {DrainResult::NoPending}; + qint64 period {0}; + bool recovered {false}; + }; + + using PendingValidator = std::function<bool (PendingMtdDecode const&)>; + using PendingPublisher = + std::function<PendingPublishResult (PendingMtdDecode const&)>; + + Decision request (Stage stage, qint64 period, int earlyStageCount, + bool decoderBusy); + bool published (Stage stage, qint64 period); + void completed (Stage stage, qint64 period); + void publicationFailed (Stage stage, qint64 period); + + Action deferFinal (std::unique_ptr<PendingMtdDecode> pending); + DrainOutcome drainPending (PendingValidator const& validator, + PendingPublisher const& publisher); + void cancel (); + + bool hasPending () const {return bool {pending_};} + bool degraded () const {return scheduler_.degraded ();} + int skippedPeriods () const {return scheduler_.skippedPeriods ();} + qint64 nextProbePeriod () const {return scheduler_.nextProbePeriod ();} + +private: + Ft8MtdDecodeScheduler scheduler_; + std::unique_ptr<PendingMtdDecode> pending_; +}; + +#endif |
