summaryrefslogtreecommitdiff
path: root/Transceiver/DXLabSuiteCommanderTransceiver.hpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-05-11 22:18:20 +0200
committerChristoph Berg <myon@debian.org>2020-05-11 22:18:20 +0200
commita8edac06b534058e52126c4d55e23b217df2df91 (patch)
treef2c3567fae58aad676d544ee8f07ac78dd2eb1ec /Transceiver/DXLabSuiteCommanderTransceiver.hpp
parent4f6c0156a70e8f2ff70fe5a1a39f5e9b22ffd026 (diff)
parent32a41b1abe1a4aab0892c9c2051be6ba5b379f1e (diff)
Update upstream source from tag 'upstream/2.2.0_rc1+repack'
Update to upstream version '2.2.0~rc1+repack' with Debian dir fe177bc6cd2d4c1256a3775504f6010be54e7463
Diffstat (limited to 'Transceiver/DXLabSuiteCommanderTransceiver.hpp')
-rw-r--r--Transceiver/DXLabSuiteCommanderTransceiver.hpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/Transceiver/DXLabSuiteCommanderTransceiver.hpp b/Transceiver/DXLabSuiteCommanderTransceiver.hpp
new file mode 100644
index 00000000..1196678b
--- /dev/null
+++ b/Transceiver/DXLabSuiteCommanderTransceiver.hpp
@@ -0,0 +1,59 @@
+#ifndef DX_LAB_SUITE_COMMANDER_TRANSCEIVER_HPP__
+#define DX_LAB_SUITE_COMMANDER_TRANSCEIVER_HPP__
+
+#include <memory>
+
+#include "TransceiverFactory.hpp"
+#include "PollingTransceiver.hpp"
+
+class QTcpSocket;
+class QByteArray;
+class QString;
+
+//
+// DX Lab Suite Commander Interface
+//
+// Implemented as a Transceiver decorator because we may want the PTT
+// services of another Transceiver type such as the HamlibTransceiver
+// which can be enabled by wrapping a HamlibTransceiver instantiated
+// as a "Hamlib Dummy" transceiver in the Transceiver factory method.
+//
+class DXLabSuiteCommanderTransceiver final
+ : public PollingTransceiver
+{
+ Q_OBJECT; // for translation context
+
+public:
+ static void register_transceivers (TransceiverFactory::Transceivers *, int id);
+
+ // takes ownership of wrapped Transceiver
+ explicit DXLabSuiteCommanderTransceiver (std::unique_ptr<TransceiverBase> wrapped,
+ QString const& address, bool use_for_ptt,
+ int poll_interval, QObject * parent = nullptr);
+
+protected:
+ int do_start () override;
+ void do_stop () override;
+ void do_frequency (Frequency, MODE, bool no_ignore) override;
+ void do_tx_frequency (Frequency, MODE, bool no_ignore) override;
+ void do_mode (MODE) override;
+ void do_ptt (bool on) override;
+
+ void do_poll () override;
+
+private:
+ MODE get_mode (bool no_debug = false);
+ void simple_command (QString const&, bool no_debug = false);
+ QString command_with_reply (QString const&, bool no_debug = false);
+ bool write_to_port (QString const&);
+ QString frequency_to_string (Frequency) const;
+ Frequency string_to_frequency (QString) const;
+
+ std::unique_ptr<TransceiverBase> wrapped_; // may be null
+ bool use_for_ptt_;
+ QString server_;
+ QTcpSocket * commander_;
+ QLocale locale_;
+};
+
+#endif