summaryrefslogtreecommitdiff
path: root/Transceiver/TxInhibitTransceiver.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 /Transceiver/TxInhibitTransceiver.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 'Transceiver/TxInhibitTransceiver.hpp')
-rw-r--r--Transceiver/TxInhibitTransceiver.hpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/Transceiver/TxInhibitTransceiver.hpp b/Transceiver/TxInhibitTransceiver.hpp
new file mode 100644
index 00000000..fb3f0103
--- /dev/null
+++ b/Transceiver/TxInhibitTransceiver.hpp
@@ -0,0 +1,67 @@
+#ifndef TX_INHIBIT_TRANSCEIVER_HPP__
+#define TX_INHIBIT_TRANSCEIVER_HPP__
+
+#include <memory>
+
+#include <QElapsedTimer>
+#include <QHash>
+#include <QString>
+
+#include "Transceiver.hpp"
+
+class QTimer;
+
+class TxInhibitTransceiver final
+ : public Transceiver
+{
+ Q_OBJECT
+
+public:
+ static constexpr int maximum_tracked_holds {64};
+
+ explicit TxInhibitTransceiver (logger_type *, std::unique_ptr<Transceiver>);
+
+ void set (TransceiverState const&, unsigned sequence_number) noexcept override;
+ void start (unsigned sequence_number) noexcept override;
+ void stop () noexcept override;
+ void enqueue_jtty_pcm (QByteArray const&, TxAudioQueueEpoch, qint64) noexcept override;
+ void clear_jtty_pcm (TxAudioQueueEpoch) noexcept override;
+
+ Q_SLOT void tx_inhibit_command (QString controller, quint32 ttl_ms, QString station);
+ Q_SLOT void tx_inhibit_invalid (quint64 count);
+
+ Q_SIGNAL void statusChanged (bool supported, bool inhibited,
+ QString const& holder,
+ quint32 hold_rx, quint32 release_rx,
+ quint32 expiries, quint32 invalid);
+
+private:
+ struct Hold
+ {
+ qint64 expires_at;
+ QString holder;
+ };
+
+ void apply_requested_state () noexcept;
+ void emit_status ();
+ void expire_holds ();
+ QString holder_summary () const;
+ void schedule_expiry ();
+
+ std::unique_ptr<Transceiver> wrapped_;
+ QTimer * expiry_timer_;
+ QElapsedTimer monotonic_clock_;
+ QHash<QString, Hold> holds_;
+ TransceiverState requested_;
+ TransceiverState last_effective_;
+ unsigned sequence_number_ {0};
+ quint32 hold_rx_ {0};
+ quint32 release_rx_ {0};
+ quint32 expiries_ {0};
+ quint32 invalid_ {0};
+ bool have_requested_state_ {false};
+ bool have_effective_state_ {false};
+ bool started_ {false};
+};
+
+#endif