File Information
Library: IoT/Modbus/TCP
Package: TCP
Header: IoT/Modbus/TCP/TCPDevicePort.h
Description
Member Summary
Member Functions: address, decodeFrame, frameSlaveOrUnitAddress, isConnected, poll, receiveFrame, sendFrame
Constructors
TCPDevicePort
TCPDevicePort(
const Poco::Net::StreamSocket & socket
);
Creates a TCPDevicePort using the given socket.
Destructor
~TCPDevicePort
~TCPDevicePort();
Destroys the TCPDevicePort.
Try to close the underlying socket.
Member Functions
address
std::string address() const;
Returns the client address.
decodeFrame
template < class Message > void decodeFrame(
Message & message
);
Decodes the currently buffered Modbus TCP frame.
The raw frame must have been read from the wire with receiveFrame().
frameSlaveOrUnitAddress
Poco::UInt8 frameSlaveOrUnitAddress() const;
Returns the slave or unit address of the most recent frame received by receiveFrame().
isConnected
bool isConnected() const;
Returns true if the socket is connected, otherwise false.
poll
bool poll(
const Poco::Timespan & timeout
);
Waits for data to arrive at the port.
Returns true immediately if data is already in the internal buffer, or if data arrives during the specified timeout interval, otherwise false.
receiveFrame
Poco::UInt8 receiveFrame();
Receives the next frame from the wire. Returns the frame's function code.
Throws an IOException if the port is not connected.
sendFrame
template < class Message > void sendFrame(
const Message & message
);