IoT::Modbus

template < class Port >

class ModbusMasterImpl

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 protected

 

class ResetNotification protected

 

class SendNotification protected

 

class SendNotificationImpl protected

 

class StopNotification protected

 

Types Aliases

PendingMap protected

using PendingMap = std::map < Poco::UInt16, PendingInfo >;

Constructors

ModbusMasterImpl inline

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 virtual inline

~ModbusMasterImpl();

Member Functions

address virtual inline

std::string address() const;

hasTransactionIDs virtual inline

bool hasTransactionIDs() const;

maskWriteRegister virtual inline

void maskWriteRegister(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 referenceAddress,
    Poco::UInt16 andMask,
    Poco::UInt16 orMask
);

maxSimultaneousTransactions virtual inline

std::size_t maxSimultaneousTransactions() const;

pendingTransactions virtual inline

std::size_t pendingTransactions() const;

readCoils virtual inline

std::vector < bool > readCoils(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 startingAddress,
    Poco::UInt16 nOfCoils
);

readDiscreteInputs virtual inline

std::vector < bool > readDiscreteInputs(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 startingAddress,
    Poco::UInt16 nOfInputs
);

readExceptionStatus virtual inline

Poco::UInt8 readExceptionStatus(
    Poco::UInt8 slaveAddress
);

readFIFOQueue virtual inline

std::vector < Poco::UInt16 > readFIFOQueue(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 fifoPointerAddress
);

readHoldingRegisters virtual inline

std::vector < Poco::UInt16 > readHoldingRegisters(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 startingAddress,
    Poco::UInt16 nOfRegisters
);

readInputRegisters virtual inline

std::vector < Poco::UInt16 > readInputRegisters(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 startingAddress,
    Poco::UInt16 nOfRegisters
);

readWriteMultipleRegisters virtual inline

std::vector < Poco::UInt16 > readWriteMultipleRegisters(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 writeStartingAddress,
    const std::vector < Poco::UInt16 > & writeValues,
    Poco::UInt16 readStartingAddress,
    Poco::UInt8 nOfReadRegisters
);

reset virtual inline

void reset();

sendMaskWriteRegisterRequest virtual inline

Poco::UInt16 sendMaskWriteRegisterRequest(
    const MaskWriteRegisterRequest & request
);

sendReadCoilsRequest virtual inline

Poco::UInt16 sendReadCoilsRequest(
    const ReadCoilsRequest & request
);

sendReadDiscreteInputsRequest virtual inline

Poco::UInt16 sendReadDiscreteInputsRequest(
    const ReadDiscreteInputsRequest & request
);

sendReadExceptionStatusRequest virtual inline

Poco::UInt16 sendReadExceptionStatusRequest(
    const ReadExceptionStatusRequest & request
);

sendReadFIFOQueueRequest virtual inline

Poco::UInt16 sendReadFIFOQueueRequest(
    const ReadFIFOQueueRequest & request
);

sendReadHoldingRegistersRequest virtual inline

Poco::UInt16 sendReadHoldingRegistersRequest(
    const ReadHoldingRegistersRequest & request
);

sendReadInputRegistersRequest virtual inline

Poco::UInt16 sendReadInputRegistersRequest(
    const ReadInputRegistersRequest & request
);

sendReadWriteMultipleRegistersRequest virtual inline

Poco::UInt16 sendReadWriteMultipleRegistersRequest(
    const ReadWriteMultipleRegistersRequest & request
);

sendRequest virtual inline

Poco::UInt16 sendRequest(
    const GenericMessage & message
);

sendWriteMultipleCoilsRequest virtual inline

Poco::UInt16 sendWriteMultipleCoilsRequest(
    const WriteMultipleCoilsRequest & request
);

sendWriteMultipleRegistersRequest virtual inline

Poco::UInt16 sendWriteMultipleRegistersRequest(
    const WriteMultipleRegistersRequest & request
);

sendWriteSingleCoilRequest virtual inline

Poco::UInt16 sendWriteSingleCoilRequest(
    const WriteSingleCoilRequest & request
);

sendWriteSingleRegisterRequest virtual inline

Poco::UInt16 sendWriteSingleRegisterRequest(
    const WriteSingleRegisterRequest & request
);

writeMultipleCoils virtual inline

void writeMultipleCoils(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 outputAddress,
    const std::vector < bool > & values
);

writeMultipleRegisters virtual inline

void writeMultipleRegisters(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 startingAddress,
    const std::vector < Poco::UInt16 > & values
);

writeSingleCoil virtual inline

void writeSingleCoil(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 outputAddress,
    bool value
);

writeSingleRegister virtual inline

void writeSingleRegister(
    Poco::UInt8 slaveAddress,
    Poco::UInt16 registerAddress,
    Poco::UInt16 value
);

abortPending protected inline

void abortPending(
    RequestFailureReason reason,
    const std::string & message
);

addPending protected inline

void addPending(
    const ModbusMessage & message
);

clearPending protected inline

void clearPending();

countPending protected inline

std::size_t countPending() const;

countPendingSent protected inline

std::pair < std::size_t, std::size_t > countPendingSent() const;

decodeFrameAndCheckTransactionID protected inline

template < typename M > void decodeFrameAndCheckTransactionID(
    M & message,
    Poco::UInt16 transactionID
);

decodeFrameAndFixTransactionID protected inline

template < typename M > void decodeFrameAndFixTransactionID(
    M & message
);

disableEvents protected inline

void disableEvents();

enableEvents protected inline

void enableEvents();

markPendingSent protected inline

void markPendingSent(
    Poco::UInt16 transactionID
);

onConnectionStateChanged protected inline

void onConnectionStateChanged(
    const ConnectionState & state
);

processFrame protected inline

void processFrame();

processPendingTimeouts protected inline

void processPendingTimeouts();

removePending protected inline

bool removePending(
    Poco::UInt16 transactionID
);

resetImpl protected inline

void resetImpl();

run protected virtual inline

void run();

sendFrame protected inline

template < typename M > Poco::UInt16 sendFrame(
    const M & message
);

Securely control IoT edge devices from anywhere   Connect a Device