-
Notifications
You must be signed in to change notification settings - Fork 0
/
connectionImplQT.h
41 lines (35 loc) · 1.04 KB
/
connectionImplQT.h
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
#ifndef CONNECTIONIMPLQT_H
#define CONNECTIONIMPLQT_H
#include <QScopedPointer>
#include <QtNetwork/QTcpSocket>
#include <QtNetwork/QHostAddress>
#include <QTimer>
#include <QMutex>
#include "connectionImpl.h"
#include "syncronizeable.h"
//class connector_;
class ConnectionImplQT : public QObject, public ConnectionImpl
{
Q_OBJECT
public:
typedef ConnectionImpl::BufferType BufferType;
typedef ConnectionImpl::RetType RetType;
ConnectionImplQT(const std::string &ip, unsigned short port, const ConnectionCallback* c);
ConnectionImplQT(){ qDebug() << "default ctor"; }
virtual ~ConnectionImplQT(){}
virtual RetType getAnsver(int length);
virtual int sendCommand(const QByteArray &);
private:
virtual int connect_();
QTcpSocket sock_;
QMutex mtxInputBuffer_;
QMutex mtx_;
QByteArray InputBfr_;
public slots:
void slotReadyRead();
void slotError(QAbstractSocket::SocketError);
void slotConnected();
// void slotConnect(QHostAddress);
// void slotSendToServer();
};
#endif // CONNECTIONIMPLQT_H