/** * $Id$ * $HeadURL$ * $Author$ */ #pragma once #include #include #include "logger.h" class QTcpSocket; class QTimer; namespace DifferentialGPS { class TcpSocket : public QThread { Q_OBJECT public: TcpSocket(const char *logName); ~TcpSocket(); protected: void startThreadInternal(const QString &hostName, quint16 port); void run() override; void doConnect(); void cleanupObject(); protected Q_SLOTS: virtual void onConnected(); virtual void onDisconnected(); virtual void onError(QAbstractSocket::SocketError); virtual void onReadyRead() = 0; protected: QString m_hostName; quint16 m_hostPort; QTcpSocket *m_socket; NGL::INGLLogger &m_logger; private: qint32 m_waitTime; QTimer *m_reconnectTimer; }; } // namespace DifferentialGPS