summaryrefslogtreecommitdiff
path: root/widgets/MMTTYIF.hpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
commit69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch)
treeebc98370a697a9bbd6b973a14fa5113c475c6db7 /widgets/MMTTYIF.hpp
parent3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff)
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg' with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
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