summaryrefslogtreecommitdiff
path: root/widgets/MMTTYIF.hpp
diff options
context:
space:
mode:
authorhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
committerhibby <d@vehibberd.com>2026-10-06 21:24:40 +0100
commitc25cbdf6fb6d946175f4335fab77bfea601b56db (patch)
tree6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /widgets/MMTTYIF.hpp
parent71f5689252c9f13e70e1c24856904475b2307809 (diff)
parent0685fcada9f95fe90f70b387cd7d757da8209624 (diff)
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'widgets/MMTTYIF.hpp')
-rw-r--r--widgets/MMTTYIF.hpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/widgets/MMTTYIF.hpp b/widgets/MMTTYIF.hpp
new file mode 100644
index 00000000..f29adc0d
--- /dev/null
+++ b/widgets/MMTTYIF.hpp
@@ -0,0 +1,63 @@
+#ifndef MMTTYIF_HPP
+#define MMTTYIF_HPP
+
+#include <QObject>
+#include <QString>
+#include <QTcpSocket>
+#include <QTimer>
+#include <QByteArray>
+
+class MMTTYIF : public QObject {
+ Q_OBJECT
+
+public:
+ explicit MMTTYIF(QObject *parent = nullptr);
+ ~MMTTYIF();
+
+ void initialize(quint16 port);
+ bool isConnected() const;
+
+signals:
+ void inactivity_timeout();
+ void app_is_quitting();
+ void app_tx_string(QString str);
+ void app_start_tx();
+ void app_stop_tx();
+ void app_abort_tx();
+
+ void message_received();
+ void log_message(const QString &msg);
+ void connection_failed();
+
+public slots:
+ void echo_message_to_n1mm(const QString &message);
+ void report_output_complete();
+ void report_ptt_state(bool is_on);
+ void shutdown();
+
+private slots:
+ void onConnected();
+ void onDisconnected();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ void onError(QAbstractSocket::SocketError socketError);
+#else
+ void onError(QAbstractSocket::SocketError socketError);
+#endif
+ void onRetryTimeout();
+ void onReadyRead();
+
+private:
+ void parseBufferedCommands();
+ void dispatchCommand(QByteArray const& command, QByteArray const& payload);
+
+ QTcpSocket *m_socket;
+ QTimer *m_retryTimer;
+ QByteArray m_rxBuffer;
+ int m_connectionRetries;
+ quint16 m_port;
+
+ quint32 m_baudRate = 0;
+ quint32 m_heightWidth = 0;
+};
+
+#endif // MMTTYIF_HPP