#include <modbus.h>
|
| | ModbusClientDevice ()=default |
| |
| | ModbusClientDevice (ModbusClientHub *parent, uint8_t address) |
| |
| virtual | ~ModbusClientDevice () |
| |
| | ModbusClientDevice (const ModbusClientDevice &)=delete |
| |
| ModbusClientDevice & | operator= (const ModbusClientDevice &)=delete |
| |
| | ModbusClientDevice (ModbusClientDevice &&)=delete |
| |
| ModbusClientDevice & | operator= (ModbusClientDevice &&)=delete |
| |
| void | set_parent (ModbusClientHub *parent) |
| |
| void | set_address (uint8_t address) |
| |
| virtual void | on_response (std::span< const uint8_t > request_pdu, std::span< const uint8_t > response_pdu) |
| | Called with the request PDU this device sent and the response PDU received (both: function code + data, no address, no CRC).
|
| |
| virtual void | on_error (std::span< const uint8_t > request_pdu, ModbusExceptionCode exception_code) |
| | Called with the request PDU and the modbus exception code decoded from the error response.
|
| |
| virtual void | on_not_sent () |
| |
| virtual bool | on_no_response () |
| | Called when no (valid) response arrived; return true to have the hub re-queue the frame for a retry.
|
| |
| | ESPDEPRECATED ("Override on_not_sent() instead. Removed in 2027.2.0", "2026.8.0") virtual void on_modbus_not_sent() |
| |
| | ESPDEPRECATED ("Override on_no_response() instead. Removed in 2027.2.0", "2026.8.0") virtual bool on_modbus_no_response() |
| |
| void | send (uint8_t function, uint16_t start_address, uint16_t number_of_entities, uint8_t payload_len=0, const uint8_t *payload=nullptr) |
| |
| void | send_pdu (std::span< const uint8_t > pdu) |
| |
| void | send_raw (const std::vector< uint8_t > &payload) |
| |
| void | clear_tx_queue_for_address (bool clear_sent=true) |
| |
| void | clear_tx_queue_for_device () |
| |
| | ESPDEPRECATED ("Use ready_for_immediate_send() instead. Removed in 2026.9.0", "2026.3.0") bool waiting_for_response() |
| |
| bool | ready_for_immediate_send () |
| |
Definition at line 168 of file modbus.h.
◆ ModbusClientDevice() [1/4]
| esphome::modbus::ModbusClientDevice::ModbusClientDevice |
( |
| ) |
|
|
default |
◆ ModbusClientDevice() [2/4]
| esphome::modbus::ModbusClientDevice::ModbusClientDevice |
( |
ModbusClientHub * | parent, |
|
|
uint8_t | address ) |
|
inline |
◆ ~ModbusClientDevice()
| virtual esphome::modbus::ModbusClientDevice::~ModbusClientDevice |
( |
| ) |
|
|
inlinevirtual |
◆ ModbusClientDevice() [3/4]
◆ ModbusClientDevice() [4/4]
◆ clear_tx_queue_for_address()
| void esphome::modbus::ModbusClientDevice::clear_tx_queue_for_address |
( |
bool | clear_sent = true | ) |
|
|
inline |
◆ clear_tx_queue_for_device()
| void esphome::modbus::ModbusClientDevice::clear_tx_queue_for_device |
( |
| ) |
|
|
inline |
◆ ESPDEPRECATED() [1/3]
| esphome::modbus::ModbusClientDevice::ESPDEPRECATED |
( |
"Override on_no_response() instead. Removed in 2027.2.0" | , |
|
|
"2026.8.0" | ) |
|
inline |
◆ ESPDEPRECATED() [2/3]
| esphome::modbus::ModbusClientDevice::ESPDEPRECATED |
( |
"Override on_not_sent() instead. Removed in 2027.2.0" | , |
|
|
"2026.8.0" | ) |
|
inline |
◆ ESPDEPRECATED() [3/3]
| esphome::modbus::ModbusClientDevice::ESPDEPRECATED |
( |
"Use ready_for_immediate_send() instead. Removed in 2026.9.0" | , |
|
|
"2026.3.0" | ) |
|
inline |
◆ on_error()
| virtual void esphome::modbus::ModbusClientDevice::on_error |
( |
std::span< const uint8_t > | request_pdu, |
|
|
ModbusExceptionCode | exception_code ) |
|
inlinevirtual |
◆ on_no_response()
| virtual bool esphome::modbus::ModbusClientDevice::on_no_response |
( |
| ) |
|
|
inlinevirtual |
Called when no (valid) response arrived; return true to have the hub re-queue the frame for a retry.
The hub does not bound retries: the device is responsible for limiting them (e.g. track a counter and return false when exhausted), or an unresponsive peer will starve other traffic on the bus.
Definition at line 200 of file modbus.h.
◆ on_not_sent()
| virtual void esphome::modbus::ModbusClientDevice::on_not_sent |
( |
| ) |
|
|
inlinevirtual |
◆ on_response()
| virtual void esphome::modbus::ModbusClientDevice::on_response |
( |
std::span< const uint8_t > | request_pdu, |
|
|
std::span< const uint8_t > | response_pdu ) |
|
inlinevirtual |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ ready_for_immediate_send()
| bool esphome::modbus::ModbusClientDevice::ready_for_immediate_send |
( |
| ) |
|
|
inline |
◆ send()
| void esphome::modbus::ModbusClientDevice::send |
( |
uint8_t | function, |
|
|
uint16_t | start_address, |
|
|
uint16_t | number_of_entities, |
|
|
uint8_t | payload_len = 0, |
|
|
const uint8_t * | payload = nullptr ) |
|
inline |
◆ send_pdu()
| void esphome::modbus::ModbusClientDevice::send_pdu |
( |
std::span< const uint8_t > | pdu | ) |
|
|
inline |
◆ send_raw()
| void esphome::modbus::ModbusClientDevice::send_raw |
( |
const std::vector< uint8_t > & | payload | ) |
|
|
inline |
◆ set_address()
| void esphome::modbus::ModbusClientDevice::set_address |
( |
uint8_t | address | ) |
|
|
inline |
◆ set_parent()
| void esphome::modbus::ModbusClientDevice::set_parent |
( |
ModbusClientHub * | parent | ) |
|
|
inline |
◆ address_
| uint8_t esphome::modbus::ModbusClientDevice::address_ {0} |
|
protected |
◆ parent_
The documentation for this class was generated from the following file: