-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcpthread.h
45 lines (41 loc) · 1.04 KB
/
tcpthread.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
42
43
44
45
#ifndef TCPTHREAD_H
#define TCPTHREAD_H
#include <QThread>
#include <QTcpSocket>
#include <QTimer>
#include "jsoncommand.h"
#include "log.h"
extern QString SensorType;
extern unsigned int BlockAddress;
extern unsigned int Command;
extern QString UserName;
extern QString Passwd;
extern QString IP;
extern QString Mask;
extern QString Getway;
extern QString Mac;
extern QString ServerIP;
class TcpThread : public QThread
{
Q_OBJECT
public:
explicit TcpThread(int socketDescriptor, QObject *parent);
void run();
int socketDescriptor;
QTcpSocket *tcpSocket;
QByteArray inBlock; //读取缓存
int ReceiveDataHandle(QByteArray str);
JsonCommand JsonCommandHandle;
Log log;
QTimer *timer;
signals:
void error(QTcpSocket::SocketError socketError);
void bytesArrived(QString,unsigned int,unsigned int);
void bytesArrived(QString,QString,QString,QString,QString,QString,QString);
void bytesSend(QByteArray);
public slots:
void receiveData();
void breakoff();
void see();
};
#endif // TCPTHREAD_H