-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsocket.h
78 lines (53 loc) · 1.33 KB
/
socket.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef SOCKET_H
#define SOCKET_H
#include <QObject>
#include <QTcpSocket>
#include <string>
#include <QByteArray>
#include <QProgressBar>
#include <QWidget>
#include "protocal.h"
#include "executecmd.h"
#include "parseJson/parsejson.h"
static QByteArray buffer;
//static int number = 0;
struct mobile
{
QString type;
QString name;
};
class Socket : public QObject
{
Q_OBJECT
public:
Socket();
~Socket();
bool linkServer(void);
void breakServer();
void initAllConnect(void);
void sendMsg(std::string msg);
void recvMsg(void);
void sendMsg(quint16 useroperate,quint16 operatecmd,
int datasize,QString datadetail);
void CheckIfConnection();
// static void setMobileType(QString type);
// static QString getMobileType();
ParseJson *m_parsejson;
static QTcpSocket *m_tcpsocket;
signals:
void signaltype(mobile m_mobile);
void singalJson(QByteArray m_message);
public slots:
void readyToRead();
void readIfConnct(quint16 useroperate,quint16 operatecmd,
int datasize,QString datadetail);
private:
quint16 blockSize; //存放文件的大小信息
static QString m_type;
QString message;
int ReciveSize;
mobile m_mobile;
Protocal *m_protocal;
executecmd *m_executecmd;
};
#endif // SOCKET_H