ESPHome 2026.10.0-dev
Loading...
Searching...
No Matches
esphome::modbus_controller::WriterEntity Class Reference

Gives a writer entity the write API of the WriterDevice it owns. More...

#include <modbus_controller.h>

Inheritance diagram for esphome::modbus_controller::WriterEntity:
esphome::modbus_controller::ModbusBinaryOutput esphome::modbus_controller::ModbusFloatOutput esphome::modbus_controller::ModbusNumber esphome::modbus_controller::ModbusSelect esphome::modbus_controller::ModbusSwitch

Public Member Functions

bool dispatched () const
 Whether the lambda called a request helper since the last clear_dispatched_().
 
bool write_single_register (uint16_t address, uint16_t value)
 
bool write_single_coil (uint16_t address, bool value)
 
bool write_multiple_registers (uint16_t address, std::span< const uint16_t > values)
 
bool write_multiple_coils (uint16_t address, std::span< const bool > values)
 
bool write_multiple_coils (uint16_t address, modbus::PackedBits bits)
 
bool queue_pdu (std::span< const uint8_t > pdu, modbus::CommandOptions options={})
 
void clear_tx_queue_for_device ()
 

Protected Member Functions

bool send_raw_frame_deprecated_ (std::span< const uint8_t > frame)
 
void set_controller_ (ModbusController *controller)
 
void clear_dispatched_ ()
 
void warn_write_buffer_deprecated_ (const LogString *platform, uint16_t address)
 

Detailed Description

Gives a writer entity the write API of the WriterDevice it owns.

The device is a member, not a base: the mixin declares no virtual function, so an entity mixing it in gains no second vtable and all the writer platforms share the single WriterDevice vtable instead of each emitting its own copy. The forwarders keep item->write_*() working unchanged inside a write_lambda, and record every dispatch, so the write path can tell "the lambda sent it itself" from "use the default write".

Definition at line 324 of file modbus_controller.h.

Member Function Documentation

◆ clear_dispatched_()

void esphome::modbus_controller::WriterEntity::clear_dispatched_ ( )
inlineprotected

Definition at line 361 of file modbus_controller.h.

◆ clear_tx_queue_for_device()

void esphome::modbus_controller::WriterEntity::clear_tx_queue_for_device ( )
inline

Definition at line 353 of file modbus_controller.h.

◆ dispatched()

bool esphome::modbus_controller::WriterEntity::dispatched ( ) const
inline

Whether the lambda called a request helper since the last clear_dispatched_().

Deliberately records the call, not the hub's accept/refuse: a refused lambda write must not fall through to the default write.

Definition at line 328 of file modbus_controller.h.

◆ queue_pdu()

bool esphome::modbus_controller::WriterEntity::queue_pdu ( std::span< const uint8_t > pdu,
modbus::CommandOptions options = {} )
inline

Definition at line 349 of file modbus_controller.h.

◆ send_raw_frame_deprecated_()

bool esphome::modbus_controller::WriterEntity::send_raw_frame_deprecated_ ( std::span< const uint8_t > frame)
inlineprotected

Definition at line 356 of file modbus_controller.h.

◆ set_controller_()

void esphome::modbus_controller::WriterEntity::set_controller_ ( ModbusController * controller)
inlineprotected

Definition at line 360 of file modbus_controller.h.

◆ warn_write_buffer_deprecated_()

void esphome::modbus_controller::WriterEntity::warn_write_buffer_deprecated_ ( const LogString * platform,
uint16_t address )
inlineprotected

Definition at line 362 of file modbus_controller.h.

◆ write_multiple_coils() [1/2]

bool esphome::modbus_controller::WriterEntity::write_multiple_coils ( uint16_t address,
modbus::PackedBits bits )
inline

Definition at line 345 of file modbus_controller.h.

◆ write_multiple_coils() [2/2]

bool esphome::modbus_controller::WriterEntity::write_multiple_coils ( uint16_t address,
std::span< const bool > values )
inline

Definition at line 341 of file modbus_controller.h.

◆ write_multiple_registers()

bool esphome::modbus_controller::WriterEntity::write_multiple_registers ( uint16_t address,
std::span< const uint16_t > values )
inline

Definition at line 337 of file modbus_controller.h.

◆ write_single_coil()

bool esphome::modbus_controller::WriterEntity::write_single_coil ( uint16_t address,
bool value )
inline

Definition at line 333 of file modbus_controller.h.

◆ write_single_register()

bool esphome::modbus_controller::WriterEntity::write_single_register ( uint16_t address,
uint16_t value )
inline

Definition at line 329 of file modbus_controller.h.


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