ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
esphome::api::ProtoWriteBuffer Class Reference

#include <proto.h>

Public Member Functions

 ProtoWriteBuffer (APIBuffer *buffer)
 
 ProtoWriteBuffer (APIBuffer *buffer, size_t write_pos)
 
void ESPHOME_ALWAYS_INLINE encode_varint_raw (uint32_t value)
 
void encode_field_raw (uint32_t field_id, uint32_t type)
 Encode a field key (tag/wire type combination).
 
APIBuffer * get_buffer () const
 
uint8_t * get_pos () const
 
void set_pos (uint8_t *pos)
 

Protected Member Functions

void encode_varint_raw_slow_ (uint32_t value) __attribute__((noinline))
 
void debug_check_bounds_ (size_t bytes, const char *caller=__builtin_FUNCTION())
 
void debug_check_bounds_ (size_t bytes)
 

Protected Attributes

APIBuffer * buffer_
 
uint8_t * pos_
 

Detailed Description

Definition at line 244 of file proto.h.

Constructor & Destructor Documentation

◆ ProtoWriteBuffer() [1/2]

esphome::api::ProtoWriteBuffer::ProtoWriteBuffer ( APIBuffer * buffer)
inline

Definition at line 246 of file proto.h.

◆ ProtoWriteBuffer() [2/2]

esphome::api::ProtoWriteBuffer::ProtoWriteBuffer ( APIBuffer * buffer,
size_t write_pos )
inline

Definition at line 247 of file proto.h.

Member Function Documentation

◆ debug_check_bounds_() [1/2]

void esphome::api::ProtoWriteBuffer::debug_check_bounds_ ( size_t bytes)
inlineprotected

Definition at line 280 of file proto.h.

◆ debug_check_bounds_() [2/2]

void esphome::api::ProtoWriteBuffer::debug_check_bounds_ ( size_t bytes,
const char * caller = __builtin_FUNCTION() )
protected

Definition at line 195 of file proto.cpp.

◆ encode_field_raw()

void esphome::api::ProtoWriteBuffer::encode_field_raw ( uint32_t field_id,
uint32_t type )
inline

Encode a field key (tag/wire type combination).

Parameters
field_idField number (tag) in the protobuf message
typeWire type value:
  • 0: Varint (int32, int64, uint32, uint64, sint32, sint64, bool, enum)
  • 2: Length-delimited (string, bytes, embedded messages, packed repeated fields)
  • 5: 32-bit (fixed32, sfixed32, float)
  • Note: Wire type 1 (64-bit fixed) is not supported

Following https://protobuf.dev/programming-guides/encoding/#structure

Definition at line 268 of file proto.h.

◆ encode_varint_raw()

void ESPHOME_ALWAYS_INLINE esphome::api::ProtoWriteBuffer::encode_varint_raw ( uint32_t value)
inline

Definition at line 248 of file proto.h.

◆ encode_varint_raw_slow_()

void esphome::api::ProtoWriteBuffer::encode_varint_raw_slow_ ( uint32_t value)
protected

Definition at line 13 of file proto.cpp.

◆ get_buffer()

APIBuffer * esphome::api::ProtoWriteBuffer::get_buffer ( ) const
inline

Definition at line 269 of file proto.h.

◆ get_pos()

uint8_t * esphome::api::ProtoWriteBuffer::get_pos ( ) const
inline

Definition at line 270 of file proto.h.

◆ set_pos()

void esphome::api::ProtoWriteBuffer::set_pos ( uint8_t * pos)
inline

Definition at line 271 of file proto.h.

Field Documentation

◆ buffer_

APIBuffer* esphome::api::ProtoWriteBuffer::buffer_
protected

Definition at line 283 of file proto.h.

◆ pos_

uint8_t* esphome::api::ProtoWriteBuffer::pos_
protected

Definition at line 284 of file proto.h.


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