-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathmapping_request.h
81 lines (65 loc) · 1.04 KB
/
mapping_request.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
#ifndef MODBUSREQUEST_H
#define MODBUSREQUEST_H
#include <QByteArray>
#include <QString>
enum MappingRequestType {
ReadValues,
WriteValues
};
enum MappingErrors {
NoError,
QuantityError,
StartAddressError,
AddressError,
UnitIdError,
ServiceError,
PermissionError
};
class MappingRequest
{
public:
MappingRequest(MappingRequestType type, int address, int unitId, int quantity);
virtual ~MappingRequest();
MappingRequestType type() const
{
return mType;
}
int address() const
{
return mAddress;
}
int unitId() const
{
return mUnitId;
}
int quantity() const
{
return mQuantity;
}
QByteArray &data()
{
return mData;
}
const QByteArray &data() const
{
return mData;
}
void setError(MappingErrors error, const QString &errorString);
MappingErrors error() const
{
return mError;
}
QString errorString() const
{
return mErrorString;
}
private:
MappingRequestType mType;
int mAddress;
int mUnitId;
int mQuantity;
QByteArray mData;
MappingErrors mError;
QString mErrorString;
};
#endif // MODBUSREQUEST_H