-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModbusDummy.h
78 lines (66 loc) · 2.84 KB
/
ModbusDummy.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
//---------------------------------------------------------------------------
#ifndef ModbusDummyH
#define ModbusDummyH
#include "Modbus.h"
//---------------------------------------------------------------------------
namespace Modbus {
//---------------------------------------------------------------------------
namespace Master {
//---------------------------------------------------------------------------
class DummyProtocol : public Protocol {
public:
DummyProtocol() {}
protected:
virtual String DoGetProtocolName() const override { return _T( "Dummy Modbus" ); }
virtual String DoGetProtocolParamsStr() const override { return String(); }
virtual void DoOpen() override { active_ = true; }
virtual void DoClose() override { active_ = false; }
virtual bool DoIsConnected() const override { return active_; }
// DoReadCoilStatus
// DoReadInputStatus
virtual void DoReadHoldingRegisters( Context const & Context,
RegAddrType StartAddr,
RegCountType PointCount,
RegDataType* Data ) override {}
virtual void DoReadInputRegisters( Context const & Context,
RegAddrType StartAddr,
RegCountType PointCount,
RegDataType* Data ) override {}
// DoForceSingleCoil
virtual void DoPresetSingleRegister( Context const & Context,
RegAddrType Addr, RegDataType Data ) override {}
// DoReadExceptionStatus
// DoDiagnostics
// DoProgram484
// DoPoll484
// DoFetchCommEventCtr
// DoFetchCommEventLog
// DoProgramController
// DoPollController
// DoForceMultipleCoils
// DoPresetMultipleRegisters
void DoPresetMultipleRegisters( Context const & Context,
RegAddrType StartAddr,
RegCountType PointCount,
const RegDataType* Data ) override {}
// DoReportSlave
// DoProgram884_M84
// DoResetCommLink
// DoReadGeneralReference
// DoWriteGeneralReference
// DoMaskWrite4XRegister
virtual void DoMaskWrite4XRegister( Context const & Context,
RegAddrType Addr,
RegDataType AndMask,
RegDataType OrMask ) override {}
// DoReadWrite4XRegisters
// DoReadFIFOQueue
private:
bool active_ { false };
};
//---------------------------------------------------------------------------
}; // End of namespace Master
//---------------------------------------------------------------------------
}; // End of namespace Modbus
//---------------------------------------------------------------------------
#endif