diff options
| author | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
|---|---|---|
| committer | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
| commit | d63dd8d081a6fcd0715cd13f26df59fb831769d2 (patch) | |
| tree | b9c1f6245147a310aac3762630bad389bbb57335 /HamlibTransceiver.hpp | |
| parent | c720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (diff) | |
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'HamlibTransceiver.hpp')
| -rw-r--r-- | HamlibTransceiver.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/HamlibTransceiver.hpp b/HamlibTransceiver.hpp new file mode 100644 index 00000000..567ac3db --- /dev/null +++ b/HamlibTransceiver.hpp @@ -0,0 +1,70 @@ +#ifndef HAMLIB_TRANSCEIVER_HPP_ +#define HAMLIB_TRANSCEIVER_HPP_ + +#include <tuple> + +#include <QString> + +#include <hamlib/rig.h> + +#include "TransceiverFactory.hpp" +#include "PollingTransceiver.hpp" + +extern "C" +{ + typedef struct rig RIG; + struct rig_caps; + typedef int vfo_t; +} + +// hamlib transceiver and PTT mostly delegated directly to hamlib Rig class +class HamlibTransceiver final + : public PollingTransceiver +{ + Q_OBJECT; // for translation context + + public: + static void register_transceivers (TransceiverFactory::Transceivers *); + + explicit HamlibTransceiver (int model_number, TransceiverFactory::ParameterPack const&); + explicit HamlibTransceiver (TransceiverFactory::PTTMethod ptt_type, QString const& ptt_port); + ~HamlibTransceiver (); + + private: + void do_start () override; + void do_stop () override; + void do_frequency (Frequency, MODE) override; + void do_tx_frequency (Frequency, bool rationalise_mode) override; + void do_mode (MODE, bool rationalise) override; + void do_ptt (bool) override; + + void poll () override; + + void error_check (int ret_code, QString const& doing) const; + void set_conf (char const * item, char const * value); + QByteArray get_conf (char const * item); + Transceiver::MODE map_mode (rmode_t) const; + rmode_t map_mode (Transceiver::MODE mode) const; + std::tuple<vfo_t, vfo_t> get_vfos () const; + + struct RIGDeleter {static void cleanup (RIG *);}; + QScopedPointer<RIG, RIGDeleter> rig_; + + bool back_ptt_port_; + bool is_dummy_; + + // these are saved on destruction so we can start new instances + // where the last one left off + static freq_t dummy_frequency_; + static rmode_t dummy_mode_; + + bool mutable reversed_; + + bool split_query_works_; + bool tickle_hamlib_; // Hamlib requires a + // rig_set_split_vfo() call to + // establish the Tx VFO + bool get_vfo_works_; // Net rigctl promises what it can't deliver +}; + +#endif |
