blob: cfbf98eeb27ed3de3c3fea47609b32f97a9c8f26 (
plain) (
blame)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/**
* PVSClientConnection
*
* holds and maintains a Connection made from/to a PVSServerConnection (or derivate)
* PVSClientConnections are created by the PVSListenServer if a PVSCLientConnection is accepted
*
*/
#include "pvsMsg.h"
#include <QtNetwork/QSslSocket>
#ifndef _PVSCLIENTCONNECTION_H_
#define _PVSCLIENTCONNECTION_H_
class PVSListenServer;
class PVSClientConnection : public QObject
{
Q_OBJECT
public:
//C'Tor
PVSClientConnection(PVSListenServer* server, QSslSocket* sock = NULL);
// D'Tor
~PVSClientConnection();
void closeConnection();
bool isConnected()
{
return _socket != NULL && _socket->state() == QAbstractSocket::ConnectedState;
}
time_t lastData()
{
return _lastData;
}
//void push_back_receive(PVSMsg newMsg);
bool push_back_send(PVSMsg newMsg);
QSslSocket* getSocket();
int getID() { return _id; }
void setID(unsigned int id);
void setServerID(unsigned int id) { _serverId = id; }
QString getAddress();
void setUsername(QString username);
QString getNameUser();
void ping();
private Q_SLOTS:
void sock_dataArrival();
void sock_closed();
void sock_error(QAbstractSocket::SocketError errcode);
private:
QSslSocket *_socket;
int _id;
unsigned int _serverId;
PVSMsg *_incomplete;
PVSListenServer *_server;
bool _toldDisconnect;
time_t _lastData;
};
#endif
|