ESPHome 2026.10.0
Loading...
Searching...
No Matches
esphome::api::ProtoDecodableMessage Class Reference

#include <proto.h>

Inheritance diagram for esphome::api::ProtoDecodableMessage:
esphome::api::ProtoMessage esphome::api::BluetoothDeviceRequest esphome::api::BluetoothGATTGetServicesRequest esphome::api::BluetoothGATTNotifyRequest esphome::api::BluetoothGATTReadDescriptorRequest esphome::api::BluetoothGATTReadRequest esphome::api::BluetoothGATTWriteDescriptorRequest esphome::api::BluetoothGATTWriteRequest esphome::api::BluetoothScannerSetModeRequest esphome::api::BluetoothSetConnectionParamsRequest esphome::api::CameraImageRequest esphome::api::CommandProtoMessage esphome::api::DSTRule esphome::api::DisconnectRequest esphome::api::ExecuteServiceArgument esphome::api::ExecuteServiceRequest esphome::api::GetTimeResponse esphome::api::HelloRequest esphome::api::HomeAssistantStateResponse esphome::api::HomeassistantActionResponse esphome::api::InfraredRFTransmitRawTimingsRequest esphome::api::NoiseEncryptionSetKeyRequest esphome::api::ParsedTimezone esphome::api::SerialProxyConfigureRequest esphome::api::SerialProxyGetModemPinsRequest esphome::api::SerialProxyRequest esphome::api::SerialProxySetModeRequest esphome::api::SerialProxySetModemPinsRequest esphome::api::SerialProxyWriteRequest esphome::api::SubscribeBluetoothLEAdvertisementsRequest esphome::api::SubscribeLogsRequest esphome::api::SubscribeVoiceAssistantRequest esphome::api::VoiceAssistantAnnounceRequest esphome::api::VoiceAssistantAudio esphome::api::VoiceAssistantConfigurationRequest esphome::api::VoiceAssistantEventData esphome::api::VoiceAssistantEventResponse esphome::api::VoiceAssistantExternalWakeWord esphome::api::VoiceAssistantResponse esphome::api::VoiceAssistantSetConfiguration esphome::api::VoiceAssistantTimerEventResponse esphome::api::WizardInputSetRequest esphome::api::ZWaveProxyFrame esphome::api::ZWaveProxyRequest

Public Types

using DecodeFieldFn = void (*)(void *msg, uint32_t tag, const uint8_t *data, proto_varint_value_t scalar)
 Stores one decoded field into msg; generated per message type.
 

Static Public Member Functions

static void decode_fields (void *msg, const uint8_t *buffer, size_t length, DecodeFieldFn field)
 Walk buffer and hand every field to field.
 
static uint32_t count_repeated_field (const uint8_t *buffer, size_t length, uint32_t target_field_id)
 Count occurrences of a repeated field in a protobuf buffer.
 
- Static Public Member Functions inherited from esphome::api::ProtoMessage
static uint8_t * encode_msg (const void *self, uint8_t *pos PROTO_ENCODE_DEBUG_PARAM)
 
static uint32_t calc_size_msg (const void *self)
 

Additional Inherited Members

- Public Member Functions inherited from esphome::api::ProtoMessage
uint8_t * encode (ProtoWriteBuffer &buffer PROTO_ENCODE_DEBUG_PARAM) const
 
uint32_t calculate_size () const
 
virtual const char * dump_to (DumpBuffer &out) const =0
 
virtual const LogString * message_name () const
 
- Protected Member Functions inherited from esphome::api::ProtoMessage
 ~ProtoMessage ()=default
 

Detailed Description

Definition at line 745 of file proto.h.

Member Typedef Documentation

◆ DecodeFieldFn

using esphome::api::ProtoDecodableMessage::DecodeFieldFn = void (*)(void *msg, uint32_t tag, const uint8_t *data, proto_varint_value_t scalar)

Stores one decoded field into msg; generated per message type.

scalar is the varint or fixed32 value, or the length of the length-delimited payload at data. An unknown field or wrong wire type matches no case and is skipped.

Definition at line 750 of file proto.h.

Member Function Documentation

◆ count_repeated_field()

uint32_t esphome::api::ProtoDecodableMessage::count_repeated_field ( const uint8_t * buffer,
size_t length,
uint32_t target_field_id )
static

Count occurrences of a repeated field in a protobuf buffer.

This is a lightweight scan that only parses tags and skips field data.

Parameters
bufferPointer to the protobuf buffer
lengthLength of the buffer in bytes
target_field_idThe field ID to count
Returns
Number of times the field appears in the buffer

Definition at line 60 of file proto.cpp.

◆ decode_fields()

void esphome::api::ProtoDecodableMessage::decode_fields ( void * msg,
const uint8_t * buffer,
size_t length,
DecodeFieldFn field )
static

Walk buffer and hand every field to field.

The generated decode() passes the message's own decode_field, so decodable messages carry no vtable.

Definition at line 205 of file proto.cpp.


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