-
Notifications
You must be signed in to change notification settings - Fork 1
/
Structures.h
111 lines (90 loc) · 2.39 KB
/
Structures.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
#ifndef TABLEENTRY_H
#define TABLEENTRY_H
#include <QtCore>
#include <QtSerialPort>
#include <QtCharts>
struct TableEntry
{
uint32_t m_ID;
uint64_t m_value;
QByteArray m_rawHex;
QString m_unit;
QString m_timestamp;
QString m_endianness;
};
struct CAN_DecodeParameters
{
typedef enum : uint8_t
{
IGNORE_ALL = 0,
BYTE_0 = 1,
BYTE_1 = 1 << 1,
BYTE_2 = 1 << 2,
BYTE_3 = 1 << 3,
BYTE_4 = 1 << 4,
BYTE_5 = 1 << 5,
BYTE_6 = 1 << 6,
BYTE_7 = 1 << 7,
ACCEPT_ALL = 0xFF,
} enuValueMask;
CAN_DecodeParameters()
: m_multiplier(0),
m_offset(0),
m_unit(QString("Invalid parameters!")),
m_valueMask(ACCEPT_ALL),
m_bigEndian(false)
{ }
CAN_DecodeParameters(int multiplier, int offset, QString unit, enuValueMask valueMask, bool bigEndian)
: m_multiplier(multiplier),
m_offset(offset),
m_unit(unit),
m_valueMask(valueMask),
m_bigEndian(bigEndian)
{ }
int m_multiplier;
int m_offset;
QString m_unit;
enuValueMask m_valueMask;
bool m_bigEndian;
};
CAN_DecodeParameters::enuValueMask operator| (CAN_DecodeParameters::enuValueMask a, CAN_DecodeParameters::enuValueMask b);
CAN_DecodeParameters::enuValueMask operator& (CAN_DecodeParameters::enuValueMask a, CAN_DecodeParameters::enuValueMask b);
const uint8_t SYNC_SEQUENCE = (uint8_t)'A';
struct RawData
{
uint32_t m_ID = 0;
uint8_t m_value[8] = {0};
};
struct CAN_DecodeParameters_Stringified
{
QString m_qstrMultiplier;
QString m_qstrOffset;
QString m_qstrUnit;
QString m_qstrValueMask;
QString m_endianness;
};
const unsigned int BufferSize = 100;
class DataInfo : public QObject
{
Q_OBJECT
public:
DataInfo() : m_pData( new QLineSeries() ), m_iter(0), m_pointCount(0) {}
~DataInfo() { delete m_pData; }
DataInfo(const DataInfo& other);
DataInfo& operator= (const DataInfo& other);
DataInfo(DataInfo&& other);
DataInfo& operator= (DataInfo&& other);
void addPoint(uint64_t point);
QLineSeries* m_pData;
unsigned int m_iter;
unsigned int m_pointCount;
signals:
void seriesChanged();
};
struct SerialPortConnectionInfo
{
QSerialPortInfo m_serialPortInfo;
qint32 m_baudRate;
};
void print(const QString& name, const QByteArray& arr);
#endif // TABLEENTRY_H