File Information
Library: IoT/Modbus
Package: ModbusMaster
Header: IoT/Modbus/ModbusMasterImpl.h
Description
An implementation of the ModbusMaster interface for the Modbus RTU protocol over a serial line.
Inheritance
Direct Base Classes: ModbusMaster, Poco::Runnable
All Base Classes: ModbusMaster, Poco::Runnable
Member Summary
Member Functions: abortPending, addPending, address, clearPending, countPending, countPendingSent, decodeFrameAndCheckTransactionID, decodeFrameAndFixTransactionID, disableEvents, enableEvents, hasTransactionIDs, markPendingSent, maskWriteRegister, maxSimultaneousTransactions, onConnectionStateChanged, pendingTransactions, processFrame, processPendingTimeouts, readCoils, readDiscreteInputs, readExceptionStatus, readFIFOQueue, readHoldingRegisters, readInputRegisters, readWriteMultipleRegisters, removePending, reset, resetImpl, run, sendFrame, sendMaskWriteRegisterRequest, sendReadCoilsRequest, sendReadDiscreteInputsRequest, sendReadExceptionStatusRequest, sendReadFIFOQueueRequest, sendReadHoldingRegistersRequest, sendReadInputRegistersRequest, sendReadWriteMultipleRegistersRequest, sendRequest, sendWriteMultipleCoilsRequest, sendWriteMultipleRegistersRequest, sendWriteSingleCoilRequest, sendWriteSingleRegisterRequest, writeMultipleCoils, writeMultipleRegisters, writeSingleCoil, writeSingleRegister
Inherited Functions: address, hasTransactionIDs, maskWriteRegister, maxSimultaneousTransactions, pendingTransactions, readCoils, readDiscreteInputs, readExceptionStatus, readFIFOQueue, readHoldingRegisters, readInputRegisters, readWriteMultipleRegisters, reset, run, sendMaskWriteRegisterRequest, sendReadCoilsRequest, sendReadDiscreteInputsRequest, sendReadExceptionStatusRequest, sendReadFIFOQueueRequest, sendReadHoldingRegistersRequest, sendReadInputRegistersRequest, sendReadWriteMultipleRegistersRequest, sendRequest, sendWriteMultipleCoilsRequest, sendWriteMultipleRegistersRequest, sendWriteSingleCoilRequest, sendWriteSingleRegisterRequest, writeMultipleCoils, writeMultipleRegisters, writeSingleCoil, writeSingleRegister
Nested Classes
struct PendingInfo
class ResetNotification
class SendNotification
class SendNotificationImpl
class StopNotification
Types Aliases
PendingMap
using PendingMap = std::map < Poco::UInt16, PendingInfo >;
Constructors
ModbusMasterImpl
ModbusMasterImpl(
Poco::SharedPtr < Port > pPort,
Poco::Timespan responseTimeout = Poco::Timespan (2, 0),
std::size_t maxAsyncQueueSize = 256,
Poco::Timespan frameSpacing = Poco::Timespan (0, 0)
);
Destructor
~ModbusMasterImpl
~ModbusMasterImpl();
Member Functions
address
std::string address() const;
See also: IoT::Modbus::ModbusMaster::address()
hasTransactionIDs
bool hasTransactionIDs() const;
maskWriteRegister
void maskWriteRegister(
Poco::UInt8 slaveAddress,
Poco::UInt16 referenceAddress,
Poco::UInt16 andMask,
Poco::UInt16 orMask
);
maxSimultaneousTransactions
std::size_t maxSimultaneousTransactions() const;
pendingTransactions
std::size_t pendingTransactions() const;
readCoils
std::vector < bool > readCoils(
Poco::UInt8 slaveAddress,
Poco::UInt16 startingAddress,
Poco::UInt16 nOfCoils
);
See also: IoT::Modbus::ModbusMaster::readCoils()
readDiscreteInputs
std::vector < bool > readDiscreteInputs(
Poco::UInt8 slaveAddress,
Poco::UInt16 startingAddress,
Poco::UInt16 nOfInputs
);
readExceptionStatus
Poco::UInt8 readExceptionStatus(
Poco::UInt8 slaveAddress
);
readFIFOQueue
std::vector < Poco::UInt16 > readFIFOQueue(
Poco::UInt8 slaveAddress,
Poco::UInt16 fifoPointerAddress
);
readHoldingRegisters
std::vector < Poco::UInt16 > readHoldingRegisters(
Poco::UInt8 slaveAddress,
Poco::UInt16 startingAddress,
Poco::UInt16 nOfRegisters
);
readInputRegisters
std::vector < Poco::UInt16 > readInputRegisters(
Poco::UInt8 slaveAddress,
Poco::UInt16 startingAddress,
Poco::UInt16 nOfRegisters
);
readWriteMultipleRegisters
std::vector < Poco::UInt16 > readWriteMultipleRegisters(
Poco::UInt8 slaveAddress,
Poco::UInt16 writeStartingAddress,
const std::vector < Poco::UInt16 > & writeValues,
Poco::UInt16 readStartingAddress,
Poco::UInt8 nOfReadRegisters
);
reset
void reset();
See also: IoT::Modbus::ModbusMaster::reset()
sendMaskWriteRegisterRequest
Poco::UInt16 sendMaskWriteRegisterRequest(
const MaskWriteRegisterRequest & request
);
sendReadCoilsRequest
Poco::UInt16 sendReadCoilsRequest(
const ReadCoilsRequest & request
);
sendReadDiscreteInputsRequest
Poco::UInt16 sendReadDiscreteInputsRequest(
const ReadDiscreteInputsRequest & request
);
sendReadExceptionStatusRequest
Poco::UInt16 sendReadExceptionStatusRequest(
const ReadExceptionStatusRequest & request
);
sendReadFIFOQueueRequest
Poco::UInt16 sendReadFIFOQueueRequest(
const ReadFIFOQueueRequest & request
);
sendReadHoldingRegistersRequest
Poco::UInt16 sendReadHoldingRegistersRequest(
const ReadHoldingRegistersRequest & request
);
sendReadInputRegistersRequest
Poco::UInt16 sendReadInputRegistersRequest(
const ReadInputRegistersRequest & request
);
sendReadWriteMultipleRegistersRequest
Poco::UInt16 sendReadWriteMultipleRegistersRequest(
const ReadWriteMultipleRegistersRequest & request
);
sendRequest
Poco::UInt16 sendRequest(
const GenericMessage & message
);
See also: IoT::Modbus::ModbusMaster::sendRequest()
sendWriteMultipleCoilsRequest
Poco::UInt16 sendWriteMultipleCoilsRequest(
const WriteMultipleCoilsRequest & request
);
sendWriteMultipleRegistersRequest
Poco::UInt16 sendWriteMultipleRegistersRequest(
const WriteMultipleRegistersRequest & request
);
sendWriteSingleCoilRequest
Poco::UInt16 sendWriteSingleCoilRequest(
const WriteSingleCoilRequest & request
);
sendWriteSingleRegisterRequest
Poco::UInt16 sendWriteSingleRegisterRequest(
const WriteSingleRegisterRequest & request
);
writeMultipleCoils
void writeMultipleCoils(
Poco::UInt8 slaveAddress,
Poco::UInt16 outputAddress,
const std::vector < bool > & values
);
writeMultipleRegisters
void writeMultipleRegisters(
Poco::UInt8 slaveAddress,
Poco::UInt16 startingAddress,
const std::vector < Poco::UInt16 > & values
);
writeSingleCoil
void writeSingleCoil(
Poco::UInt8 slaveAddress,
Poco::UInt16 outputAddress,
bool value
);
writeSingleRegister
void writeSingleRegister(
Poco::UInt8 slaveAddress,
Poco::UInt16 registerAddress,
Poco::UInt16 value
);
abortPending
void abortPending(
RequestFailureReason reason,
const std::string & message
);
addPending
void addPending(
const ModbusMessage & message
);
clearPending
void clearPending();
countPending
std::size_t countPending() const;
countPendingSent
std::pair < std::size_t, std::size_t > countPendingSent() const;
decodeFrameAndCheckTransactionID
template < typename M > void decodeFrameAndCheckTransactionID(
M & message,
Poco::UInt16 transactionID
);
decodeFrameAndFixTransactionID
template < typename M > void decodeFrameAndFixTransactionID(
M & message
);
disableEvents
void disableEvents();
enableEvents
void enableEvents();
markPendingSent
void markPendingSent(
Poco::UInt16 transactionID
);
onConnectionStateChanged
void onConnectionStateChanged(
const ConnectionState & state
);
processFrame
void processFrame();
processPendingTimeouts
void processPendingTimeouts();
removePending
bool removePending(
Poco::UInt16 transactionID
);
resetImpl
void resetImpl();
run
void run();
See also: Poco::Runnable::run()
sendFrame
template < typename M > Poco::UInt16 sendFrame(
const M & message
);