diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
| commit | 059831534c7e884f0a607ed86b582fd00d821731 (patch) | |
| tree | 76bcb67a78f8aa2654fd34c2ad801a62136b0170 /widgets/MMTTYIF.hpp | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'widgets/MMTTYIF.hpp')
| -rw-r--r-- | widgets/MMTTYIF.hpp | 63 |
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 |
