JS8Call-Improved master
Loading...
Searching...
No Matches
EmulateSplitTransceiver.h
1#ifndef EMULATE_SPLIT_TRANSCEIVER_HPP__
2#define EMULATE_SPLIT_TRANSCEIVER_HPP__
3
4#include "Transceiver.h"
5
6#include <memory>
7
8//
9// Emulate Split Transceiver
10//
11// Helper decorator class that encapsulates the emulation of split TX
12// operation.
13//
14// Responsibilities
15//
16// Delegates all but setting of other (split) frequency to the
17// wrapped Transceiver instance. Also routes failure signals from the
18// wrapped Transceiver instance to this instances failure signal.
19//
20// Intercepts status updates from the wrapped Transceiver instance
21// and re-signals it with the emulated status.
22//
23// Generates a status update signal if the other (split) frequency is
24// changed, this is necessary since the wrapped transceiver instance
25// never receives other frequency changes.
26//
27class EmulateSplitTransceiver final : public Transceiver {
28 public:
29 // takes ownership of wrapped Transceiver
30 explicit EmulateSplitTransceiver(std::unique_ptr<Transceiver> wrapped,
31 QObject *parent = nullptr);
32
33 void set(TransceiverState const &,
34 unsigned sequence_number) noexcept override;
35
36 // forward everything else to wrapped Transceiver
37 void start(unsigned sequence_number) noexcept override {
38 wrapped_->start(sequence_number);
39 }
40 void stop() noexcept override { wrapped_->stop(); }
41
42 private:
43 void handle_update(TransceiverState const &, unsigned seqeunce_number);
44
45 std::unique_ptr<Transceiver> wrapped_;
46 Frequency rx_frequency_; // requested Rx frequency
47 Frequency tx_frequency_; // requested Tx frequency
48 bool split_; // requested split state
49};
50
51#endif
Definition Transceiver.h:83