JS8Call-Improved master
Loading...
Searching...
No Matches
TxLoop.h
1#ifndef TXLOOP_H
2#define TXLOOP_H
3
4#include "TwoPhaseSignal.h"
5#include "Varicode.h"
6
7#include <QDateTime>
8#include <QTimer>
9
10class TxLoop : public TwoPhaseSignal {
11 Q_OBJECT
12
13 private:
14 // Name, only used for logging:
15 const QString m_name;
16 // When do we need to start transmitting the next time?
17 QDateTime m_next_activity;
18 // How much tx_delay, in milliseconds, we need to be early.
19 qint64 m_tx_delay_ms;
20 // A timer that is supposed to wake us up when it is time.
21 // This will be m_tx_delay_ms earlier than m_next_activity.
22 QTimer m_next_activity_timer;
23 // The currently active JS8 m_submode.
24 Varicode::SubmodeType m_submode;
25 // Whether this loop is active (or else does nothing).
26 bool m_active;
27 // The loop's period: After how many milliseconds to repeat sending.
28 qint64 m_loop_period_ms;
29
30 public:
31 // Provide a "name" argument that can be used for logging.
32 TxLoop(const QString &name);
33
34 ~TxLoop();
35
36 // The TX delay cannot be set to any value larger than this:
37 static constexpr qint64 MAX_TX_DELAY_MS = 1000;
38
39 inline bool isActive() const { return m_active; }
40
49 inline const QDateTime &nextActivity() const { return m_next_activity; }
50
59 inline qint64 period_ms() const { return m_loop_period_ms; }
60
61 signals:
64 void triggerTxNow() const;
65
78 void nextActivityChanged(const QDateTime &) const;
79
81 void canceled() const;
82
83 public slots:
86 void onPlumbingCompleted() const;
89 void onDriftChange(qint64 new_drift);
92 void onModeChange(Varicode::SubmodeType new_submode);
98 void onTxDelayChange(qint64 tx_delay_ms);
99
111 void onTxLoopPeriodChangeStart(qint64 loop_period_ms);
112
120 void onLoopCancel();
121
122 private slots:
123 void onTimer();
124};
125
126#endif
TwoPhaseSignal()
This is a humble helper class for Qt signals and slots when this mechanism is also used to initialize...
Definition TwoPhaseSignal.cpp:11
void onTxLoopPeriodChangeStart(qint64 loop_period_ms)
Definition TxLoop.cpp:193
void onModeChange(Varicode::SubmodeType new_submode)
Definition TxLoop.cpp:138
void onPlumbingCompleted() const
Definition TxLoop.cpp:98
void triggerTxNow() const
qint64 period_ms() const
Definition TxLoop.h:59
void nextActivityChanged(const QDateTime &) const
void onTxDelayChange(qint64 tx_delay_ms)
Definition TxLoop.cpp:157
void onLoopCancel()
Definition TxLoop.cpp:178
const QDateTime & nextActivity() const
Definition TxLoop.h:49
void onDriftChange(qint64 new_drift)
Definition TxLoop.cpp:115
void canceled() const