-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModbusTCP_Indy.h
50 lines (43 loc) · 1.79 KB
/
ModbusTCP_Indy.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
//---------------------------------------------------------------------------
#ifndef ModbusTCP_IndyH
#define ModbusTCP_IndyH
#include <IdIOHandlerStack.hpp>
#include <IdBaseComponent.hpp>
#include <IdComponent.hpp>
#include <IdIOHandler.hpp>
#include <IdIOHandlerSocket.hpp>
#include <IdTCPClient.hpp>
#include <IdTCPConnection.hpp>
#include <memory>
#include <cstdint>
#include "ModbusTCP.h"
//---------------------------------------------------------------------------
namespace Modbus {
//---------------------------------------------------------------------------
namespace Master {
//---------------------------------------------------------------------------
class TCPProtocolIndy : public TCPProtocol {
public:
TCPProtocolIndy( String Host = _T( DEFAULT_MODBUS_TCPIP_HOST ),
uint16_t Port = DEFAULT_MODBUS_TCPIP_PORT );
protected:
virtual String DoGetProtocolName() const override { return _T( "Modbus TCP (Indy)" ); }
virtual String DoGetHost() const override;
virtual void DoSetHost( String Val ) override;
virtual uint16_t DoGetPort() const override;
virtual void DoSetPort( uint16_t Val ) override;
virtual void DoOpen() override;
virtual void DoClose() override;
virtual bool DoIsConnected() const override;
virtual void DoInputBufferClear() override;
virtual void DoWrite( TBytes const OutBuffer ) override;
virtual void DoRead( TBytes & InBuffer, size_t Length ) override;
private:
std::unique_ptr<Idtcpclient::TIdTCPClient> idTCPClient_;
};
//---------------------------------------------------------------------------
}; // End of namespace Master
//---------------------------------------------------------------------------
}; // End of namespace Modbus
//---------------------------------------------------------------------------
#endif