-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmatildaclient.h
119 lines (72 loc) · 2.6 KB
/
matildaclient.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#ifndef MATILDACLIENT_H
#define MATILDACLIENT_H
#include <QTcpSocket>
#include <QObject>
#include <QTime>
#include <QJsonObject>
class matildaclient : public QTcpSocket
{
Q_OBJECT
public:
explicit matildaclient(QObject *parent = 0);
signals:
void onConnectedStateChanged(bool);
void data2gui(quint16,QJsonObject);
void onErrorWrite();
void showMessage(QString);
void authrizeAccess(int); //0 - closed, 1 - root, 2 - operator, 3 - guest
void addThisLogin2list(QString,QString,QString,QString,quint16);
void infoAboutObj(QString);
void startWait4AnswerTimer(int);
void stopWait4AnswerTimer();
void restartWaitCounter();
void uploadProgress(int,QString);
void hideAnimation();
void changeCounters(qint64, qint64, bool );
void dataFromCoordinator(QByteArray);
void onYouCanSelectDevice(QStringList);
void add2pteLog(QString);
void devTypeChanged(int devType, int version, QString sn);
void setActiveProtocolVersion(int protocolVersion);
public slots:
void conn2thisDev(int hashIndx, QString objN, QString login, QString passwd, QString add, quint16 port, int timeOut, bool add2list, bool allwCmprss, bool useMac, QString macAddr, bool useMacAddr2conn, bool allowProtocolV2);
void data2matilda(quint16 command, QJsonObject jobj);
void closeConnection();
void stopAllNow();
void data2coordiantor(QByteArray writeArr);
void setEmptyHsh(bool empty);
private slots:
void decodeReadDataJSON(const QByteArray &dataArr);
void mReadyReadSlot();
void mReadyRead();
void mWrite2SocketJSON(QJsonObject jObj, const quint16 s_command);
void onDisconn();
void onWaitTimerTimeOut();
void onDaOpened(bool isDaOpen);
void add2pteLogP(QString s, bool isRead);
private:
void getRightLeftDuzka(int &rightDuzka, int &leftDuzka, bool &wait4lapky, const QByteArray &arr);
int indxOfRightDuzka(const int &lastRightDuzka, const QByteArray &arr);
QString humanByteView(QString str);
QString humanByteView(const int &val);
QString hshSummName(const int &indx) const;
QStringList getHshNames();
bool messHshIsValid(const QJsonObject &jObj, QByteArray readArr);
private:
bool isConnOpen();
QDateTime dateTimeFromStr(const QString &str);
bool block4activeClient;
quint8 accessLevel;
QList<QByteArray> loginPasswd;
int lastHashSumm;
bool iAmDone;
int timeOut;
int timeOutG;
bool isSvahaService;
bool stopAll, stopAfter, daOpened;
bool allowCompress;
bool emptyHsh;
//protocol v2
bool allowProtocolV2;
};
#endif // MATILDACLIENT_H