ESPHome  2024.11.0
Public Member Functions | Protected Attributes
esphome::api::ProtoWriteBuffer Class Reference

#include <proto.h>

Public Member Functions

 ProtoWriteBuffer (std::vector< uint8_t > *buffer)
 
void write (uint8_t value)
 
void encode_varint_raw (ProtoVarInt value)
 
void encode_varint_raw (uint32_t value)
 
void encode_field_raw (uint32_t field_id, uint32_t type)
 
void encode_string (uint32_t field_id, const char *string, size_t len, bool force=false)
 
void encode_string (uint32_t field_id, const std::string &value, bool force=false)
 
void encode_bytes (uint32_t field_id, const uint8_t *data, size_t len, bool force=false)
 
void encode_uint32 (uint32_t field_id, uint32_t value, bool force=false)
 
void encode_uint64 (uint32_t field_id, uint64_t value, bool force=false)
 
void encode_bool (uint32_t field_id, bool value, bool force=false)
 
void encode_fixed32 (uint32_t field_id, uint32_t value, bool force=false)
 
void encode_fixed64 (uint32_t field_id, uint64_t value, bool force=false)
 
template<typename T >
void encode_enum (uint32_t field_id, T value, bool force=false)
 
void encode_float (uint32_t field_id, float value, bool force=false)
 
void encode_int32 (uint32_t field_id, int32_t value, bool force=false)
 
void encode_int64 (uint32_t field_id, int64_t value, bool force=false)
 
void encode_sint32 (uint32_t field_id, int32_t value, bool force=false)
 
void encode_sint64 (uint32_t field_id, int64_t value, bool force=false)
 
template<class C >
void encode_message (uint32_t field_id, const C &value, bool force=false)
 
std::vector< uint8_t > * get_buffer () const
 

Protected Attributes

std::vector< uint8_t > * buffer_
 

Detailed Description

Definition at line 146 of file proto.h.

Constructor & Destructor Documentation

◆ ProtoWriteBuffer()

esphome::api::ProtoWriteBuffer::ProtoWriteBuffer ( std::vector< uint8_t > *  buffer)
inline

Definition at line 148 of file proto.h.

Member Function Documentation

◆ encode_bool()

void esphome::api::ProtoWriteBuffer::encode_bool ( uint32_t  field_id,
bool  value,
bool  force = false 
)
inline

Definition at line 183 of file proto.h.

◆ encode_bytes()

void esphome::api::ProtoWriteBuffer::encode_bytes ( uint32_t  field_id,
const uint8_t *  data,
size_t  len,
bool  force = false 
)
inline

Definition at line 168 of file proto.h.

◆ encode_enum()

template<typename T >
void esphome::api::ProtoWriteBuffer::encode_enum ( uint32_t  field_id,
value,
bool  force = false 
)
inline

Definition at line 213 of file proto.h.

◆ encode_field_raw()

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

Definition at line 152 of file proto.h.

◆ encode_fixed32()

void esphome::api::ProtoWriteBuffer::encode_fixed32 ( uint32_t  field_id,
uint32_t  value,
bool  force = false 
)
inline

Definition at line 189 of file proto.h.

◆ encode_fixed64()

void esphome::api::ProtoWriteBuffer::encode_fixed64 ( uint32_t  field_id,
uint64_t  value,
bool  force = false 
)
inline

Definition at line 199 of file proto.h.

◆ encode_float()

void esphome::api::ProtoWriteBuffer::encode_float ( uint32_t  field_id,
float  value,
bool  force = false 
)
inline

Definition at line 216 of file proto.h.

◆ encode_int32()

void esphome::api::ProtoWriteBuffer::encode_int32 ( uint32_t  field_id,
int32_t  value,
bool  force = false 
)
inline

Definition at line 227 of file proto.h.

◆ encode_int64()

void esphome::api::ProtoWriteBuffer::encode_int64 ( uint32_t  field_id,
int64_t  value,
bool  force = false 
)
inline

Definition at line 235 of file proto.h.

◆ encode_message()

template<class C >
void esphome::api::ProtoWriteBuffer::encode_message ( uint32_t  field_id,
const C &  value,
bool  force = false 
)
inline

Definition at line 256 of file proto.h.

◆ encode_sint32()

void esphome::api::ProtoWriteBuffer::encode_sint32 ( uint32_t  field_id,
int32_t  value,
bool  force = false 
)
inline

Definition at line 238 of file proto.h.

◆ encode_sint64()

void esphome::api::ProtoWriteBuffer::encode_sint64 ( uint32_t  field_id,
int64_t  value,
bool  force = false 
)
inline

Definition at line 247 of file proto.h.

◆ encode_string() [1/2]

void esphome::api::ProtoWriteBuffer::encode_string ( uint32_t  field_id,
const char *  string,
size_t  len,
bool  force = false 
)
inline

Definition at line 156 of file proto.h.

◆ encode_string() [2/2]

void esphome::api::ProtoWriteBuffer::encode_string ( uint32_t  field_id,
const std::string &  value,
bool  force = false 
)
inline

Definition at line 165 of file proto.h.

◆ encode_uint32()

void esphome::api::ProtoWriteBuffer::encode_uint32 ( uint32_t  field_id,
uint32_t  value,
bool  force = false 
)
inline

Definition at line 171 of file proto.h.

◆ encode_uint64()

void esphome::api::ProtoWriteBuffer::encode_uint64 ( uint32_t  field_id,
uint64_t  value,
bool  force = false 
)
inline

Definition at line 177 of file proto.h.

◆ encode_varint_raw() [1/2]

void esphome::api::ProtoWriteBuffer::encode_varint_raw ( ProtoVarInt  value)
inline

Definition at line 150 of file proto.h.

◆ encode_varint_raw() [2/2]

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

Definition at line 151 of file proto.h.

◆ get_buffer()

std::vector<uint8_t>* esphome::api::ProtoWriteBuffer::get_buffer ( ) const
inline

Definition at line 268 of file proto.h.

◆ write()

void esphome::api::ProtoWriteBuffer::write ( uint8_t  value)
inline

Definition at line 149 of file proto.h.

Field Documentation

◆ buffer_

std::vector<uint8_t>* esphome::api::ProtoWriteBuffer::buffer_
protected

Definition at line 271 of file proto.h.


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