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 --- Transceiver/TxInhibitTransceiver.hpp | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Transceiver/TxInhibitTransceiver.hpp (limited to 'Transceiver/TxInhibitTransceiver.hpp') 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 + +#include +#include +#include + +#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); + + 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 wrapped_; + QTimer * expiry_timer_; + QElapsedTimer monotonic_clock_; + QHash 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 -- cgit v1.2.3