ESPHome 2026.8.0b4
Loading...
Searching...
No Matches
esphome::modbus::MutablePackedBits Class Reference

Mutable counterpart of PackedBits: set() writes bits in place (deliberately no proxy operator[]=). More...

#include <modbus_definitions.h>

Public Member Functions

 MutablePackedBits (std::span< uint8_t > data, uint16_t count)
 
bool operator[] (size_t bit) const
 
void set (size_t bit, bool value)
 Set or clear the given bit.
 
uint16_t size () const
 
 operator PackedBits () const
 

Detailed Description

Mutable counterpart of PackedBits: set() writes bits in place (deliberately no proxy operator[]=).

Converts implicitly to PackedBits for read access.

Definition at line 173 of file modbus_definitions.h.

Constructor & Destructor Documentation

◆ MutablePackedBits()

esphome::modbus::MutablePackedBits::MutablePackedBits ( std::span< uint8_t > data,
uint16_t count )
inline

Definition at line 175 of file modbus_definitions.h.

Member Function Documentation

◆ operator PackedBits()

esphome::modbus::MutablePackedBits::operator PackedBits ( ) const
inline

Definition at line 189 of file modbus_definitions.h.

◆ operator[]()

bool esphome::modbus::MutablePackedBits::operator[] ( size_t bit) const
inline

Definition at line 176 of file modbus_definitions.h.

◆ set()

void esphome::modbus::MutablePackedBits::set ( size_t bit,
bool value )
inline

Set or clear the given bit.

Out-of-range bits are dropped: on the server read path the span wraps a stack response buffer, so a handler looping past size() must not be able to smash the frame.

Definition at line 179 of file modbus_definitions.h.

◆ size()

uint16_t esphome::modbus::MutablePackedBits::size ( ) const
inline

Definition at line 188 of file modbus_definitions.h.


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