summaryrefslogtreecommitdiff
path: root/Ft8MtdDecodeCoordinator.hpp
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
committerhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
commitc25cbdf6fb6d946175f4335fab77bfea601b56db (patch)
tree6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /Ft8MtdDecodeCoordinator.hpp
parent71f5689252c9f13e70e1c24856904475b2307809 (diff)
parent0685fcada9f95fe90f70b387cd7d757da8209624 (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 'Ft8MtdDecodeCoordinator.hpp')
-rw-r--r--Ft8MtdDecodeCoordinator.hpp75
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