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

One decoded field: the payload pointer and a scalar holding the varint or fixed32 value, or the length of a length-delimited field. More...

#include <proto.h>

Public Member Functions

 ProtoFieldValue (const uint8_t *data, proto_varint_value_t scalar)
 
proto_varint_value_t as_varint () const
 
bool as_bool () const
 
const uint8_t * data () const
 
size_t size () const
 
std::string as_string () const
 
template<typename T >
void decode_to_message (T &msg) const
 Decode the length-delimited payload into a message instance.
 
uint32_t as_fixed32 () const
 
int32_t as_sfixed32 () const
 
float as_float () const
 

Detailed Description

One decoded field: the payload pointer and a scalar holding the varint or fixed32 value, or the length of a length-delimited field.

The wire type in the tag says which applies; accessors do not check.

Definition at line 184 of file proto.h.

Constructor & Destructor Documentation

◆ ProtoFieldValue()

esphome::api::ProtoFieldValue::ProtoFieldValue ( const uint8_t * data,
proto_varint_value_t scalar )
inline

Definition at line 186 of file proto.h.

Member Function Documentation

◆ as_bool()

bool esphome::api::ProtoFieldValue::as_bool ( ) const
inline

Definition at line 190 of file proto.h.

◆ as_fixed32()

uint32_t esphome::api::ProtoFieldValue::as_fixed32 ( ) const
inline

Definition at line 201 of file proto.h.

◆ as_float()

float esphome::api::ProtoFieldValue::as_float ( ) const
inline

Definition at line 203 of file proto.h.

◆ as_sfixed32()

int32_t esphome::api::ProtoFieldValue::as_sfixed32 ( ) const
inline

Definition at line 202 of file proto.h.

◆ as_string()

std::string esphome::api::ProtoFieldValue::as_string ( ) const
inline

Definition at line 195 of file proto.h.

◆ as_varint()

proto_varint_value_t esphome::api::ProtoFieldValue::as_varint ( ) const
inline

Definition at line 188 of file proto.h.

◆ data()

const uint8_t * esphome::api::ProtoFieldValue::data ( ) const
inline

Definition at line 193 of file proto.h.

◆ decode_to_message()

template<typename T >
void esphome::api::ProtoFieldValue::decode_to_message ( T & msg) const
inline

Decode the length-delimited payload into a message instance.

Template preserves concrete type so decode() resolves statically.

Definition at line 198 of file proto.h.

◆ size()

size_t esphome::api::ProtoFieldValue::size ( ) const
inline

Definition at line 194 of file proto.h.


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