-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxyparser.h
44 lines (41 loc) · 1 KB
/
proxyparser.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
#ifndef PROXYPARSER_H
#define PROXYPARSER_H
/**
*@brief:buffer data recive from seriport,and check data available,then send to innfosproxy to decode
*@author:lzj
*@date: 2017/02/28
**/
#include <QObject>
#include "idata.h"
class ProxyParser : public QObject
{
Q_OBJECT
public:
static ProxyParser * getInstance();
void parse(quint32 communicateUnitId,const QByteArray & buf);
protected:
explicit ProxyParser(QObject *parent = 0);
void handleError();//data error
bool headCheck(const QByteArray & data);
bool dataCheck(const QByteArray & data);
void dispatchData(quint32 communicateUnitId,QByteArray & buf);
signals:
private:
class GC{
public:
~GC()
{
if(m_pParser!=nullptr)
{
delete m_pParser;
m_pParser = nullptr;
}
}
static GC gc;
};
public slots:
private:
QByteArray m_remainData;//data wait for parse;
static ProxyParser * m_pParser;
};
#endif // PROXYPARSER_H