mirror of
https://github.com/esphome/esphome.git
synced 2026-09-11 23:37:34 +00:00
[api] Use proto_varint_value_t type alias instead of #ifdef blocks
Replace per-override #ifdef USE_API_VARINT64 conditionals with a single type alias proto_varint_value_t, eliminating preprocessor blocks from every decode_varint signature in api_pb2.cpp/h. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
fcd72336f0
commit
b838085e41
@@ -7,11 +7,7 @@
|
||||
|
||||
namespace esphome::api {
|
||||
|
||||
#ifdef USE_API_VARINT64
|
||||
bool HelloRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool HelloRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool HelloRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->api_version_major = value;
|
||||
@@ -320,11 +316,7 @@ uint32_t CoverStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool CoverCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool CoverCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool CoverCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 4:
|
||||
this->has_position = value != 0;
|
||||
@@ -431,11 +423,7 @@ uint32_t FanStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool FanCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool FanCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool FanCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_state = value != 0;
|
||||
@@ -583,11 +571,7 @@ uint32_t LightStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool LightCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool LightCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool LightCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_state = value != 0;
|
||||
@@ -803,11 +787,7 @@ uint32_t SwitchStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SwitchCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SwitchCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SwitchCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->state = value != 0;
|
||||
@@ -883,11 +863,7 @@ uint32_t TextSensorStateResponse::calculate_size() const {
|
||||
return size;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SubscribeLogsRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SubscribeLogsRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SubscribeLogsRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->level = static_cast<enums::LogLevel>(value);
|
||||
@@ -995,11 +971,7 @@ uint32_t HomeassistantActionRequest::calculate_size() const {
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
|
||||
#ifdef USE_API_VARINT64
|
||||
bool HomeassistantActionResponse::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool HomeassistantActionResponse::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool HomeassistantActionResponse::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->call_id = value;
|
||||
@@ -1064,11 +1036,7 @@ bool HomeAssistantStateResponse::decode_length(uint32_t field_id, ProtoLengthDel
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_API_VARINT64
|
||||
bool DSTRule::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool DSTRule::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool DSTRule::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->time_seconds = decode_zigzag32(value);
|
||||
@@ -1093,11 +1061,7 @@ bool DSTRule::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool ParsedTimezone::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool ParsedTimezone::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool ParsedTimezone::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->std_offset_seconds = decode_zigzag32(value);
|
||||
@@ -1178,11 +1142,7 @@ uint32_t ListEntitiesServicesResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_uint32(1, static_cast<uint32_t>(this->supports_response));
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool ExecuteServiceArgument::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool ExecuteServiceArgument::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool ExecuteServiceArgument::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->bool_ = value != 0;
|
||||
@@ -1242,11 +1202,7 @@ void ExecuteServiceArgument::decode(const uint8_t *buffer, size_t length) {
|
||||
this->string_array.init(count_string_array);
|
||||
ProtoDecodableMessage::decode(buffer, length);
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool ExecuteServiceRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool ExecuteServiceRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool ExecuteServiceRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
|
||||
case 3:
|
||||
@@ -1357,11 +1313,7 @@ uint32_t CameraImageResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool CameraImageRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool CameraImageRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool CameraImageRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->single = value != 0;
|
||||
@@ -1516,11 +1468,7 @@ uint32_t ClimateStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool ClimateCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool ClimateCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool ClimateCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_mode = value != 0;
|
||||
@@ -1683,11 +1631,7 @@ uint32_t WaterHeaterStateResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_float(1, this->target_temperature_high);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool WaterHeaterCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool WaterHeaterCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool WaterHeaterCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_fields = value;
|
||||
@@ -1787,11 +1731,7 @@ uint32_t NumberStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool NumberCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool NumberCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool NumberCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
#ifdef USE_DEVICES
|
||||
case 3:
|
||||
@@ -1872,11 +1812,7 @@ uint32_t SelectStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SelectCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SelectCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SelectCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
#ifdef USE_DEVICES
|
||||
case 3:
|
||||
@@ -1967,11 +1903,7 @@ uint32_t SirenStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SirenCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SirenCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SirenCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_state = value != 0;
|
||||
@@ -2079,11 +2011,7 @@ uint32_t LockStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool LockCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool LockCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool LockCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->command = static_cast<enums::LockCommand>(value);
|
||||
@@ -2154,11 +2082,7 @@ uint32_t ListEntitiesButtonResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool ButtonCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool ButtonCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool ButtonCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
#ifdef USE_DEVICES
|
||||
case 2:
|
||||
@@ -2258,11 +2182,7 @@ uint32_t MediaPlayerStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool MediaPlayerCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool MediaPlayerCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool MediaPlayerCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_command = value != 0;
|
||||
@@ -2318,11 +2238,7 @@ bool MediaPlayerCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SubscribeBluetoothLEAdvertisementsRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SubscribeBluetoothLEAdvertisementsRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SubscribeBluetoothLEAdvertisementsRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->flags = value;
|
||||
@@ -2358,11 +2274,7 @@ uint32_t BluetoothLERawAdvertisementsResponse::calculate_size() const {
|
||||
}
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothDeviceRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothDeviceRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothDeviceRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
@@ -2395,11 +2307,7 @@ uint32_t BluetoothDeviceConnectionResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_int32(1, this->error);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothGATTGetServicesRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothGATTGetServicesRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothGATTGetServicesRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
@@ -2505,11 +2413,7 @@ uint32_t BluetoothGATTGetServicesDoneResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_uint64(1, this->address);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothGATTReadRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothGATTReadRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothGATTReadRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
@@ -2534,11 +2438,7 @@ uint32_t BluetoothGATTReadResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_length(1, this->data_len_);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothGATTWriteRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothGATTWriteRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothGATTWriteRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
@@ -2566,11 +2466,7 @@ bool BluetoothGATTWriteRequest::decode_length(uint32_t field_id, ProtoLengthDeli
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothGATTReadDescriptorRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothGATTReadDescriptorRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothGATTReadDescriptorRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
@@ -2583,11 +2479,7 @@ bool BluetoothGATTReadDescriptorRequest::decode_varint(uint32_t field_id, uint32
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothGATTWriteDescriptorRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothGATTWriteDescriptorRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothGATTWriteDescriptorRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
@@ -2612,11 +2504,7 @@ bool BluetoothGATTWriteDescriptorRequest::decode_length(uint32_t field_id, Proto
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothGATTNotifyRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothGATTNotifyRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothGATTNotifyRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
@@ -2744,11 +2632,7 @@ uint32_t BluetoothScannerStateResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_uint32(1, static_cast<uint32_t>(this->configured_mode));
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothScannerSetModeRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothScannerSetModeRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothScannerSetModeRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->mode = static_cast<enums::BluetoothScannerMode>(value);
|
||||
@@ -2760,11 +2644,7 @@ bool BluetoothScannerSetModeRequest::decode_varint(uint32_t field_id, uint32_t v
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SubscribeVoiceAssistantRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SubscribeVoiceAssistantRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SubscribeVoiceAssistantRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->subscribe = value != 0;
|
||||
@@ -2805,11 +2685,7 @@ uint32_t VoiceAssistantRequest::calculate_size() const {
|
||||
size += ProtoSize::calc_length(1, this->wake_word_phrase.size());
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool VoiceAssistantResponse::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool VoiceAssistantResponse::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool VoiceAssistantResponse::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->port = value;
|
||||
@@ -2837,11 +2713,7 @@ bool VoiceAssistantEventData::decode_length(uint32_t field_id, ProtoLengthDelimi
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool VoiceAssistantEventResponse::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool VoiceAssistantEventResponse::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool VoiceAssistantEventResponse::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->event_type = static_cast<enums::VoiceAssistantEvent>(value);
|
||||
@@ -2862,11 +2734,7 @@ bool VoiceAssistantEventResponse::decode_length(uint32_t field_id, ProtoLengthDe
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool VoiceAssistantAudio::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool VoiceAssistantAudio::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool VoiceAssistantAudio::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->end = value != 0;
|
||||
@@ -2898,11 +2766,7 @@ uint32_t VoiceAssistantAudio::calculate_size() const {
|
||||
size += ProtoSize::calc_bool(1, this->end);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool VoiceAssistantTimerEventResponse::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool VoiceAssistantTimerEventResponse::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool VoiceAssistantTimerEventResponse::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->event_type = static_cast<enums::VoiceAssistantTimerEvent>(value);
|
||||
@@ -2936,11 +2800,7 @@ bool VoiceAssistantTimerEventResponse::decode_length(uint32_t field_id, ProtoLen
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool VoiceAssistantAnnounceRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool VoiceAssistantAnnounceRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool VoiceAssistantAnnounceRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 4:
|
||||
this->start_conversation = value != 0;
|
||||
@@ -2993,11 +2853,7 @@ uint32_t VoiceAssistantWakeWord::calculate_size() const {
|
||||
}
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool VoiceAssistantExternalWakeWord::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool VoiceAssistantExternalWakeWord::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool VoiceAssistantExternalWakeWord::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 5:
|
||||
this->model_size = value;
|
||||
@@ -3134,11 +2990,7 @@ uint32_t AlarmControlPanelStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool AlarmControlPanelCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool AlarmControlPanelCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool AlarmControlPanelCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->command = static_cast<enums::AlarmControlPanelStateCommand>(value);
|
||||
@@ -3230,11 +3082,7 @@ uint32_t TextStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool TextCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool TextCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool TextCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
#ifdef USE_DEVICES
|
||||
case 3:
|
||||
@@ -3319,11 +3167,7 @@ uint32_t DateStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool DateCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool DateCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool DateCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->year = value;
|
||||
@@ -3406,11 +3250,7 @@ uint32_t TimeStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool TimeCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool TimeCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool TimeCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->hour = value;
|
||||
@@ -3553,11 +3393,7 @@ uint32_t ValveStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool ValveCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool ValveCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool ValveCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->has_position = value != 0;
|
||||
@@ -3636,11 +3472,7 @@ uint32_t DateTimeStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool DateTimeCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool DateTimeCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool DateTimeCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
#ifdef USE_DEVICES
|
||||
case 3:
|
||||
@@ -3729,11 +3561,7 @@ uint32_t UpdateStateResponse::calculate_size() const {
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool UpdateCommandRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool UpdateCommandRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool UpdateCommandRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 2:
|
||||
this->command = static_cast<enums::UpdateCommand>(value);
|
||||
@@ -3778,11 +3606,7 @@ uint32_t ZWaveProxyFrame::calculate_size() const {
|
||||
size += ProtoSize::calc_length(1, this->data_len);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool ZWaveProxyRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool ZWaveProxyRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool ZWaveProxyRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->type = static_cast<enums::ZWaveProxyRequestType>(value);
|
||||
@@ -3848,11 +3672,7 @@ uint32_t ListEntitiesInfraredResponse::calculate_size() const {
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_IR_RF
|
||||
#ifdef USE_API_VARINT64
|
||||
bool InfraredRFTransmitRawTimingsRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool InfraredRFTransmitRawTimingsRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool InfraredRFTransmitRawTimingsRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
#ifdef USE_DEVICES
|
||||
case 1:
|
||||
@@ -3917,11 +3737,7 @@ uint32_t InfraredRFReceiveEvent::calculate_size() const {
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_SERIAL_PROXY
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SerialProxyConfigureRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SerialProxyConfigureRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SerialProxyConfigureRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->instance = value;
|
||||
@@ -3956,11 +3772,7 @@ uint32_t SerialProxyDataReceived::calculate_size() const {
|
||||
size += ProtoSize::calc_length(1, this->data_len_);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SerialProxyWriteRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SerialProxyWriteRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SerialProxyWriteRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->instance = value;
|
||||
@@ -3982,11 +3794,7 @@ bool SerialProxyWriteRequest::decode_length(uint32_t field_id, ProtoLengthDelimi
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SerialProxySetModemPinsRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SerialProxySetModemPinsRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SerialProxySetModemPinsRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->instance = value;
|
||||
@@ -3999,11 +3807,7 @@ bool SerialProxySetModemPinsRequest::decode_varint(uint32_t field_id, uint32_t v
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SerialProxyGetModemPinsRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SerialProxyGetModemPinsRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SerialProxyGetModemPinsRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->instance = value;
|
||||
@@ -4023,11 +3827,7 @@ uint32_t SerialProxyGetModemPinsResponse::calculate_size() const {
|
||||
size += ProtoSize::calc_uint32(1, this->line_states);
|
||||
return size;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
bool SerialProxyRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool SerialProxyRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool SerialProxyRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->instance = value;
|
||||
@@ -4056,11 +3856,7 @@ uint32_t SerialProxyRequestResponse::calculate_size() const {
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
#ifdef USE_API_VARINT64
|
||||
bool BluetoothSetConnectionParamsRequest::decode_varint(uint32_t field_id, uint64_t value) {
|
||||
#else
|
||||
bool BluetoothSetConnectionParamsRequest::decode_varint(uint32_t field_id, uint32_t value) {
|
||||
#endif
|
||||
bool BluetoothSetConnectionParamsRequest::decode_varint(uint32_t field_id, proto_varint_value_t value) {
|
||||
switch (field_id) {
|
||||
case 1:
|
||||
this->address = value;
|
||||
|
||||
@@ -399,11 +399,7 @@ class HelloRequest final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class HelloResponse final : public ProtoMessage {
|
||||
public:
|
||||
@@ -692,11 +688,7 @@ class CoverCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_FAN
|
||||
@@ -764,11 +756,7 @@ class FanCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_LIGHT
|
||||
@@ -858,11 +846,7 @@ class LightCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_SENSOR
|
||||
@@ -952,11 +936,7 @@ class SwitchCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_TEXT_SENSOR
|
||||
@@ -1008,11 +988,7 @@ class SubscribeLogsRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class SubscribeLogsResponse final : public ProtoMessage {
|
||||
public:
|
||||
@@ -1134,11 +1110,7 @@ class HomeassistantActionResponse final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_API_HOMEASSISTANT_STATES
|
||||
@@ -1204,11 +1176,7 @@ class DSTRule final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class ParsedTimezone final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -1222,11 +1190,7 @@ class ParsedTimezone final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class GetTimeResponse final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -1297,11 +1261,7 @@ class ExecuteServiceArgument final : public ProtoDecodableMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class ExecuteServiceRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -1326,11 +1286,7 @@ class ExecuteServiceRequest final : public ProtoDecodableMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_API_USER_DEFINED_ACTION_RESPONSES
|
||||
@@ -1409,11 +1365,7 @@ class CameraImageRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_CLIMATE
|
||||
@@ -1512,11 +1464,7 @@ class ClimateCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_WATER_HEATER
|
||||
@@ -1580,11 +1528,7 @@ class WaterHeaterCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_NUMBER
|
||||
@@ -1640,11 +1584,7 @@ class NumberCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_SELECT
|
||||
@@ -1696,11 +1636,7 @@ class SelectCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_SIREN
|
||||
@@ -1760,11 +1696,7 @@ class SirenCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_LOCK
|
||||
@@ -1820,11 +1752,7 @@ class LockCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_BUTTON
|
||||
@@ -1857,11 +1785,7 @@ class ButtonCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_MEDIA_PLAYER
|
||||
@@ -1938,11 +1862,7 @@ class MediaPlayerCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_BLUETOOTH_PROXY
|
||||
@@ -1959,11 +1879,7 @@ class SubscribeBluetoothLEAdvertisementsRequest final : public ProtoDecodableMes
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothLERawAdvertisement final : public ProtoMessage {
|
||||
public:
|
||||
@@ -2013,11 +1929,7 @@ class BluetoothDeviceRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothDeviceConnectionResponse final : public ProtoMessage {
|
||||
public:
|
||||
@@ -2051,11 +1963,7 @@ class BluetoothGATTGetServicesRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothGATTDescriptor final : public ProtoMessage {
|
||||
public:
|
||||
@@ -2146,11 +2054,7 @@ class BluetoothGATTReadRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothGATTReadResponse final : public ProtoMessage {
|
||||
public:
|
||||
@@ -2193,11 +2097,7 @@ class BluetoothGATTWriteRequest final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothGATTReadDescriptorRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2213,11 +2113,7 @@ class BluetoothGATTReadDescriptorRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothGATTWriteDescriptorRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2236,11 +2132,7 @@ class BluetoothGATTWriteDescriptorRequest final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothGATTNotifyRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2257,11 +2149,7 @@ class BluetoothGATTNotifyRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothGATTNotifyDataResponse final : public ProtoMessage {
|
||||
public:
|
||||
@@ -2441,11 +2329,7 @@ class BluetoothScannerSetModeRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_VOICE_ASSISTANT
|
||||
@@ -2463,11 +2347,7 @@ class SubscribeVoiceAssistantRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class VoiceAssistantAudioSettings final : public ProtoMessage {
|
||||
public:
|
||||
@@ -2516,11 +2396,7 @@ class VoiceAssistantResponse final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class VoiceAssistantEventData final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2548,11 +2424,7 @@ class VoiceAssistantEventResponse final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class VoiceAssistantAudio final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2572,11 +2444,7 @@ class VoiceAssistantAudio final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class VoiceAssistantTimerEventResponse final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2597,11 +2465,7 @@ class VoiceAssistantTimerEventResponse final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class VoiceAssistantAnnounceRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2620,11 +2484,7 @@ class VoiceAssistantAnnounceRequest final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class VoiceAssistantAnnounceFinished final : public ProtoMessage {
|
||||
public:
|
||||
@@ -2670,11 +2530,7 @@ class VoiceAssistantExternalWakeWord final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class VoiceAssistantConfigurationRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -2776,11 +2632,7 @@ class AlarmControlPanelCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_TEXT
|
||||
@@ -2835,11 +2687,7 @@ class TextCommandRequest final : public CommandProtoMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_DATETIME_DATE
|
||||
@@ -2893,11 +2741,7 @@ class DateCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_DATETIME_TIME
|
||||
@@ -2951,11 +2795,7 @@ class TimeCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_EVENT
|
||||
@@ -3046,11 +2886,7 @@ class ValveCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_DATETIME_DATETIME
|
||||
@@ -3100,11 +2936,7 @@ class DateTimeCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_UPDATE
|
||||
@@ -3162,11 +2994,7 @@ class UpdateCommandRequest final : public CommandProtoMessage {
|
||||
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_ZWAVE_PROXY
|
||||
@@ -3206,11 +3034,7 @@ class ZWaveProxyRequest final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
#endif
|
||||
#ifdef USE_INFRARED
|
||||
@@ -3255,11 +3079,7 @@ class InfraredRFTransmitRawTimingsRequest final : public ProtoDecodableMessage {
|
||||
protected:
|
||||
bool decode_32bit(uint32_t field_id, Proto32Bit value) override;
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class InfraredRFReceiveEvent final : public ProtoMessage {
|
||||
public:
|
||||
@@ -3301,11 +3121,7 @@ class SerialProxyConfigureRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class SerialProxyDataReceived final : public ProtoMessage {
|
||||
public:
|
||||
@@ -3345,11 +3161,7 @@ class SerialProxyWriteRequest final : public ProtoDecodableMessage {
|
||||
|
||||
protected:
|
||||
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class SerialProxySetModemPinsRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -3365,11 +3177,7 @@ class SerialProxySetModemPinsRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class SerialProxyGetModemPinsRequest final : public ProtoDecodableMessage {
|
||||
public:
|
||||
@@ -3384,11 +3192,7 @@ class SerialProxyGetModemPinsRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class SerialProxyGetModemPinsResponse final : public ProtoMessage {
|
||||
public:
|
||||
@@ -3421,11 +3225,7 @@ class SerialProxyRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class SerialProxyRequestResponse final : public ProtoMessage {
|
||||
public:
|
||||
@@ -3465,11 +3265,7 @@ class BluetoothSetConnectionParamsRequest final : public ProtoDecodableMessage {
|
||||
#endif
|
||||
|
||||
protected:
|
||||
#ifdef USE_API_VARINT64
|
||||
bool decode_varint(uint32_t field_id, uint64_t value) override;
|
||||
#else
|
||||
bool decode_varint(uint32_t field_id, uint32_t value) override;
|
||||
#endif
|
||||
bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;
|
||||
};
|
||||
class BluetoothSetConnectionParamsResponse final : public ProtoMessage {
|
||||
public:
|
||||
|
||||
@@ -227,11 +227,7 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) {
|
||||
ESP_LOGV(TAG, "Invalid VarInt at offset %ld", (long) (ptr - buffer));
|
||||
return;
|
||||
}
|
||||
#ifdef USE_API_VARINT64
|
||||
if (!this->decode_varint(field_id, res.as_uint64())) {
|
||||
#else
|
||||
if (!this->decode_varint(field_id, res.as_uint32())) {
|
||||
#endif
|
||||
if (!this->decode_varint(field_id, res.value)) {
|
||||
ESP_LOGV(TAG, "Cannot decode VarInt field %" PRIu32 " with value %" PRIu32 "!", field_id, res.as_uint32());
|
||||
}
|
||||
ptr += res.consumed;
|
||||
|
||||
@@ -98,17 +98,20 @@ inline void encode_varint_to_buffer(uint32_t val, uint8_t *buffer) {
|
||||
* within the same function scope where temporaries are created.
|
||||
*/
|
||||
|
||||
/// Type used for decoded varint values - uint64_t when BLE needs 64-bit addresses, uint32_t otherwise
|
||||
#ifdef USE_API_VARINT64
|
||||
using proto_varint_value_t = uint64_t;
|
||||
#else
|
||||
using proto_varint_value_t = uint32_t;
|
||||
#endif
|
||||
|
||||
/// Sentinel value for consumed field indicating parse failure
|
||||
inline constexpr uint32_t PROTO_VARINT_PARSE_FAILED = 0;
|
||||
|
||||
/// Result of parsing a varint: value + number of bytes consumed.
|
||||
/// consumed == PROTO_VARINT_PARSE_FAILED indicates parse failure (not enough data or invalid).
|
||||
struct ProtoVarIntResult {
|
||||
#ifdef USE_API_VARINT64
|
||||
uint64_t value;
|
||||
#else
|
||||
uint32_t value;
|
||||
#endif
|
||||
proto_varint_value_t value;
|
||||
uint32_t consumed; // PROTO_VARINT_PARSE_FAILED = parse failed
|
||||
|
||||
constexpr bool has_value() const { return this->consumed != PROTO_VARINT_PARSE_FAILED; }
|
||||
@@ -506,11 +509,7 @@ class ProtoDecodableMessage : public ProtoMessage {
|
||||
|
||||
protected:
|
||||
~ProtoDecodableMessage() = default;
|
||||
#ifdef USE_API_VARINT64
|
||||
virtual bool decode_varint(uint32_t field_id, uint64_t value) { return false; }
|
||||
#else
|
||||
virtual bool decode_varint(uint32_t field_id, uint32_t value) { return false; }
|
||||
#endif
|
||||
virtual bool decode_varint(uint32_t field_id, proto_varint_value_t value) { return false; }
|
||||
virtual bool decode_length(uint32_t field_id, ProtoLengthDelimited value) { return false; }
|
||||
virtual bool decode_32bit(uint32_t field_id, Proto32Bit value) { return false; }
|
||||
// NOTE: decode_64bit removed - wire type 1 not supported
|
||||
|
||||
@@ -2213,12 +2213,7 @@ def build_message_type(
|
||||
|
||||
cpp = ""
|
||||
if decode_varint:
|
||||
# Use conditional parameter type to match base class
|
||||
o = "#ifdef USE_API_VARINT64\n"
|
||||
o += f"bool {desc.name}::decode_varint(uint32_t field_id, uint64_t value) {{\n"
|
||||
o += "#else\n"
|
||||
o += f"bool {desc.name}::decode_varint(uint32_t field_id, uint32_t value) {{\n"
|
||||
o += "#endif\n"
|
||||
o = f"bool {desc.name}::decode_varint(uint32_t field_id, proto_varint_value_t value) {{\n"
|
||||
o += " switch (field_id) {\n"
|
||||
o += indent("\n".join(decode_varint), " ") + "\n"
|
||||
o += " default: return false;\n"
|
||||
@@ -2226,15 +2221,8 @@ def build_message_type(
|
||||
o += " return true;\n"
|
||||
o += "}\n"
|
||||
cpp += o
|
||||
prot_lines = [
|
||||
"#ifdef USE_API_VARINT64",
|
||||
"bool decode_varint(uint32_t field_id, uint64_t value) override;",
|
||||
"#else",
|
||||
"bool decode_varint(uint32_t field_id, uint32_t value) override;",
|
||||
"#endif",
|
||||
]
|
||||
for i, line in enumerate(prot_lines):
|
||||
protected_content.insert(i, line)
|
||||
prot = "bool decode_varint(uint32_t field_id, proto_varint_value_t value) override;"
|
||||
protected_content.insert(0, prot)
|
||||
if decode_length:
|
||||
o = f"bool {desc.name}::decode_length(uint32_t field_id, ProtoLengthDelimited value) {{\n"
|
||||
o += " switch (field_id) {\n"
|
||||
|
||||
Reference in New Issue
Block a user