liblightmodbus 3.0
A lightweight, header-only, hardware-agnostic Modbus RTU/TCP library
Loading...
Searching...
No Matches
llm::Slave Class Reference

Represents a Modbus slave device. More...

#include <lightmodbus.hpp>

+ Collaboration diagram for llm::Slave:

Public Member Functions

 Slave (ModbusRegisterCallback registerCallback, ModbusSlaveExceptionCallback exceptionCallback=nullptr, ModbusAllocator allocator=modbusDefaultAllocator, ModbusSlaveFunctionHandler *functions=modbusSlaveDefaultFunctions, uint16_t functionCount=modbusSlaveDefaultFunctionCount)
 
 ~Slave ()
 
 Slave (const Slave &)=delete
 
 Slave (Slave &&)=delete
 
Slaveoperator= (const Slave &)=delete
 
Slaveoperator= (Slave &&)=delete
 
void parseRequestPDU (const uint8_t *frame, uint16_t length)
 
void parseRequestRTU (uint8_t address, const uint8_t *frame, uint16_t length)
 
void parseRequestTCP (const uint8_t *frame, uint16_t length)
 
void buildExceptionPDU (uint8_t function, ModbusExceptionCode code)
 
void buildExceptionRTU (uint8_t address, uint8_t function, ModbusExceptionCode code)
 
void buildExceptionTCP (uint16_t transactionID, uint8_t unitID, uint8_t function, ModbusExceptionCode code)
 
const uint8_t * getResponse () const
 
uint16_t getResponseLength () const
 
void freeResponse ()
 
void setUserPointer (void *ptr)
 
void * getUserPointer () const
 

Protected Attributes

ModbusSlave m_slave
 
bool m_ok = false
 

Detailed Description

Represents a Modbus slave device.

Constructor & Destructor Documentation

◆ Slave() [1/3]

llm::Slave::Slave ( ModbusRegisterCallback  registerCallback,
ModbusSlaveExceptionCallback  exceptionCallback = nullptr,
ModbusAllocator  allocator = modbusDefaultAllocator,
ModbusSlaveFunctionHandler functions = modbusSlaveDefaultFunctions,
uint16_t  functionCount = modbusSlaveDefaultFunctionCount 
)
inline
+ Here is the call graph for this function:

◆ ~Slave()

llm::Slave::~Slave ( )
inline
+ Here is the call graph for this function:

◆ Slave() [2/3]

llm::Slave::Slave ( const Slave )
delete

◆ Slave() [3/3]

llm::Slave::Slave ( Slave &&  )
delete

Member Function Documentation

◆ buildExceptionPDU()

void llm::Slave::buildExceptionPDU ( uint8_t  function,
ModbusExceptionCode  code 
)
inline
+ Here is the call graph for this function:

◆ buildExceptionRTU()

void llm::Slave::buildExceptionRTU ( uint8_t  address,
uint8_t  function,
ModbusExceptionCode  code 
)
inline
+ Here is the call graph for this function:

◆ buildExceptionTCP()

void llm::Slave::buildExceptionTCP ( uint16_t  transactionID,
uint8_t  unitID,
uint8_t  function,
ModbusExceptionCode  code 
)
inline
+ Here is the call graph for this function:

◆ freeResponse()

void llm::Slave::freeResponse ( )
inline
+ Here is the call graph for this function:

◆ getResponse()

const uint8_t * llm::Slave::getResponse ( ) const
inline
+ Here is the call graph for this function:

◆ getResponseLength()

uint16_t llm::Slave::getResponseLength ( ) const
inline
+ Here is the call graph for this function:

◆ getUserPointer()

void * llm::Slave::getUserPointer ( ) const
inline
+ Here is the call graph for this function:

◆ operator=() [1/2]

Slave & llm::Slave::operator= ( const Slave )
delete

◆ operator=() [2/2]

Slave & llm::Slave::operator= ( Slave &&  )
delete

◆ parseRequestPDU()

void llm::Slave::parseRequestPDU ( const uint8_t *  frame,
uint16_t  length 
)
inline
+ Here is the call graph for this function:

◆ parseRequestRTU()

void llm::Slave::parseRequestRTU ( uint8_t  address,
const uint8_t *  frame,
uint16_t  length 
)
inline
+ Here is the call graph for this function:

◆ parseRequestTCP()

void llm::Slave::parseRequestTCP ( const uint8_t *  frame,
uint16_t  length 
)
inline
+ Here is the call graph for this function:

◆ setUserPointer()

void llm::Slave::setUserPointer ( void *  ptr)
inline
+ Here is the call graph for this function:

Field Documentation

◆ m_ok

bool llm::Slave::m_ok = false
protected

◆ m_slave

ModbusSlave llm::Slave::m_slave
protected

The documentation for this class was generated from the following file: