1#ifndef ModbusTCPMaster_H_
2#define ModbusTCPMaster_H_
7#include <Poco/Net/SocketStream.h>
9#include "ModbusTypes.h"
10#include "ModbusClient.h"
24 bool connect(
const std::string& addr,
int port,
bool closeOldConnection =
true )
noexcept;
25 bool connect(
const Poco::Net::SocketAddress& addr,
int _port,
bool closeOldConnection =
true )
noexcept;
28 void forceDisconnect();
29 bool isConnection()
const;
31 static bool checkConnection(
const std::string& ip,
int port,
int timeout_msec = 100 );
33 void setForceDisconnect(
bool s );
36 void cleanInputStream();
38 virtual void cleanupChannel()
override;
40 std::string getAddress()
const;
43 void setReadTimeout( timeout_t msec );
44 timeout_t getReadTimeout()
const;
48 virtual size_t getNextData(
unsigned char* buf,
size_t len )
override;
50 virtual ModbusRTU::mbErrCode sendData(
unsigned char* buf,
size_t len )
override;
56 std::shared_ptr<UTCPStream> tcp;
57 ModbusRTU::ModbusData nTransaction;
58 std::queue<unsigned char> qrecv;
60 std::string iaddr = {
"" };
62 bool force_disconnect = {
false };
63 int keepAliveTimeout = { 1000 };
65 timeout_t readTimeout = { 50 };
Definition ModbusClient.h:19
Definition ModbusTCPMaster.h:18
virtual ModbusRTU::mbErrCode query(ModbusRTU::ModbusAddr addr, ModbusRTU::ModbusMessage &msg, ModbusRTU::ModbusMessage &reply, timeout_t timeout) override
Definition ModbusTCPMaster.cc:84
virtual size_t getNextData(unsigned char *buf, size_t len) override
Definition ModbusTCPMaster.cc:52
virtual void setChannelTimeout(timeout_t msec) override
Definition ModbusTCPMaster.cc:57
Пассивный таймер
Definition PassiveTimer.h:94
Definition Calibration.h:27
Definition ModbusTypes.h:211