blob: a6345617992083f87b867dc0f0b740ad5d7771af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// -*- c++ -*-
#pragma once
#include <QtNetwork/QTcpSocket>
#include <QtCore/QTimer>
class QTcpSocket;
class QTimer;
class Client
: public QObject
{
Q_OBJECT
public:
Client(QObject *parent = 0);
public slots:
bool connectToHost(const QString& host);
bool writeData(const QString& title, const QByteArray& data);
void errorOccurred(QAbstractSocket::SocketError socketError);
void connected();
void disconnected();
void timeout();
signals:
void isConnected();
void isDisconnected();
private:
void retryConnect();
QTcpSocket *socket;
QString host;
QTimer *timer;
int retries{10};
int interval{5};
int interval_long{120};
};
|