/** * 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 #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