-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsixnetmessage.h
44 lines (33 loc) · 1.01 KB
/
sixnetmessage.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 SIXNETMESSAGE_H
#define SIXNETMESSAGE_H
#include <QObject>
#include <QDebug>
class SixnetMessage : public QObject
{
Q_OBJECT
public:
enum SixnetMessageType {
SixnetMessageReadAnalog = 0x0C80,
SixnetMessageReadDigital = 0x0A80
};
SixnetMessage(unsigned char dstAddress, SixnetMessageType command, unsigned int size, QObject *parent = 0);
bool checkAnswer(QByteArray data);
QByteArray serialize();
int channelCount() const {return m_size;}
int dstAddress() const {return m_dstAddress;}
void setSequence(int seq) {m_sequence = seq;}
int channelData(unsigned int channel);
QString error() const {return m_error;}
SixnetMessageType messageType() const {return m_command;}
private:
QByteArray m_receievedData;
unsigned char m_dstAddress, m_sequence, m_session;
SixnetMessageType m_command;
unsigned int m_size;
QByteArray m_data;
QString m_error;
signals:
void dataReaded();
void debug(QString);
};
#endif // SIXNETMESSAGE_H