summaryrefslogtreecommitdiff
path: root/DXLabSuiteCommanderTransceiver.hpp
diff options
context:
space:
mode:
authorIain R. Learmonth <irl@debian.org>2015-10-18 18:51:03 +0100
committerIain R. Learmonth <irl@debian.org>2015-10-18 18:51:03 +0100
commit7ccc963875ee66fe4c817da95461d891039ba1a2 (patch)
tree742cb44e4987b2dfe2db2aac83cd052040a97a8c /DXLabSuiteCommanderTransceiver.hpp
parent5c4ba866a16d2d10d751152dd162d3761d68aacd (diff)
parentd63dd8d081a6fcd0715cd13f26df59fb831769d2 (diff)
Merge tag 'upstream/1.5.0'
Upstream version 1.5.0
Diffstat (limited to 'DXLabSuiteCommanderTransceiver.hpp')
-rw-r--r--DXLabSuiteCommanderTransceiver.hpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/DXLabSuiteCommanderTransceiver.hpp b/DXLabSuiteCommanderTransceiver.hpp
new file mode 100644
index 00000000..c039857b
--- /dev/null
+++ b/DXLabSuiteCommanderTransceiver.hpp
@@ -0,0 +1,57 @@
+#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);
+ ~DXLabSuiteCommanderTransceiver ();
+
+protected:
+ 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 on) override;
+
+ void poll () override;
+
+private:
+ 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_;
+ bool use_for_ptt_;
+ QString server_;
+ QTcpSocket * commander_;
+ QLocale locale_;
+};
+
+#endif