mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-29 22:24:26 +00:00 
			
		
		
		
	[api] Remove deprecated protobuf fields to reduce flash usage (#9679)
This commit is contained in:
		| @@ -230,14 +230,16 @@ message DeviceInfoResponse { | ||||
|  | ||||
|   uint32 webserver_port = 10 [(field_ifdef) = "USE_WEBSERVER"]; | ||||
|  | ||||
|   uint32 legacy_bluetooth_proxy_version = 11 [(field_ifdef) = "USE_BLUETOOTH_PROXY"]; | ||||
|   // Deprecated in API version 1.9 | ||||
|   uint32 legacy_bluetooth_proxy_version = 11 [deprecated=true, (field_ifdef) = "USE_BLUETOOTH_PROXY"]; | ||||
|   uint32 bluetooth_proxy_feature_flags = 15 [(field_ifdef) = "USE_BLUETOOTH_PROXY"]; | ||||
|  | ||||
|   string manufacturer = 12; | ||||
|  | ||||
|   string friendly_name = 13; | ||||
|  | ||||
|   uint32 legacy_voice_assistant_version = 14 [(field_ifdef) = "USE_VOICE_ASSISTANT"]; | ||||
|   // Deprecated in API version 1.10 | ||||
|   uint32 legacy_voice_assistant_version = 14 [deprecated=true, (field_ifdef) = "USE_VOICE_ASSISTANT"]; | ||||
|   uint32 voice_assistant_feature_flags = 17 [(field_ifdef) = "USE_VOICE_ASSISTANT"]; | ||||
|  | ||||
|   string suggested_area = 16 [(field_ifdef) = "USE_AREAS"]; | ||||
| @@ -337,7 +339,9 @@ message ListEntitiesCoverResponse { | ||||
|   uint32 device_id = 13 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // Deprecated in API version 1.1 | ||||
| enum LegacyCoverState { | ||||
|   option deprecated = true; | ||||
|   LEGACY_COVER_STATE_OPEN = 0; | ||||
|   LEGACY_COVER_STATE_CLOSED = 1; | ||||
| } | ||||
| @@ -356,7 +360,8 @@ message CoverStateResponse { | ||||
|   fixed32 key = 1; | ||||
|   // legacy: state has been removed in 1.13 | ||||
|   // clients/servers must still send/accept it until the next protocol change | ||||
|   LegacyCoverState legacy_state = 2; | ||||
|   // Deprecated in API version 1.1 | ||||
|   LegacyCoverState legacy_state = 2 [deprecated=true]; | ||||
|  | ||||
|   float position = 3; | ||||
|   float tilt = 4; | ||||
| @@ -364,7 +369,9 @@ message CoverStateResponse { | ||||
|   uint32 device_id = 6 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
|  | ||||
| // Deprecated in API version 1.1 | ||||
| enum LegacyCoverCommand { | ||||
|   option deprecated = true; | ||||
|   LEGACY_COVER_COMMAND_OPEN = 0; | ||||
|   LEGACY_COVER_COMMAND_CLOSE = 1; | ||||
|   LEGACY_COVER_COMMAND_STOP = 2; | ||||
| @@ -380,8 +387,10 @@ message CoverCommandRequest { | ||||
|  | ||||
|   // legacy: command has been removed in 1.13 | ||||
|   // clients/servers must still send/accept it until the next protocol change | ||||
|   bool has_legacy_command = 2; | ||||
|   LegacyCoverCommand legacy_command = 3; | ||||
|   // Deprecated in API version 1.1 | ||||
|   bool has_legacy_command = 2 [deprecated=true]; | ||||
|   // Deprecated in API version 1.1 | ||||
|   LegacyCoverCommand legacy_command = 3 [deprecated=true]; | ||||
|  | ||||
|   bool has_position = 4; | ||||
|   float position = 5; | ||||
| @@ -413,7 +422,9 @@ message ListEntitiesFanResponse { | ||||
|   repeated string supported_preset_modes = 12; | ||||
|   uint32 device_id = 13 [(field_ifdef) = "USE_DEVICES"]; | ||||
| } | ||||
| // Deprecated in API version 1.6 - only used in deprecated fields | ||||
| enum FanSpeed { | ||||
|   option deprecated = true; | ||||
|   FAN_SPEED_LOW = 0; | ||||
|   FAN_SPEED_MEDIUM = 1; | ||||
|   FAN_SPEED_HIGH = 2; | ||||
| @@ -432,7 +443,8 @@ message FanStateResponse { | ||||
|   fixed32 key = 1; | ||||
|   bool state = 2; | ||||
|   bool oscillating = 3; | ||||
|   FanSpeed speed = 4 [deprecated = true]; | ||||
|   // Deprecated in API version 1.6 | ||||
|   FanSpeed speed = 4 [deprecated=true]; | ||||
|   FanDirection direction = 5; | ||||
|   int32 speed_level = 6; | ||||
|   string preset_mode = 7; | ||||
| @@ -448,8 +460,10 @@ message FanCommandRequest { | ||||
|   fixed32 key = 1; | ||||
|   bool has_state = 2; | ||||
|   bool state = 3; | ||||
|   bool has_speed = 4 [deprecated = true]; | ||||
|   FanSpeed speed = 5 [deprecated = true]; | ||||
|   // Deprecated in API version 1.6 | ||||
|   bool has_speed = 4 [deprecated=true]; | ||||
|   // Deprecated in API version 1.6 | ||||
|   FanSpeed speed = 5 [deprecated=true]; | ||||
|   bool has_oscillating = 6; | ||||
|   bool oscillating = 7; | ||||
|   bool has_direction = 8; | ||||
| @@ -488,9 +502,13 @@ message ListEntitiesLightResponse { | ||||
|  | ||||
|   repeated ColorMode supported_color_modes = 12; | ||||
|   // next four supports_* are for legacy clients, newer clients should use color modes | ||||
|   // Deprecated in API version 1.6 | ||||
|   bool legacy_supports_brightness = 5 [deprecated=true]; | ||||
|   // Deprecated in API version 1.6 | ||||
|   bool legacy_supports_rgb = 6 [deprecated=true]; | ||||
|   // Deprecated in API version 1.6 | ||||
|   bool legacy_supports_white_value = 7 [deprecated=true]; | ||||
|   // Deprecated in API version 1.6 | ||||
|   bool legacy_supports_color_temperature = 8 [deprecated=true]; | ||||
|   float min_mireds = 9; | ||||
|   float max_mireds = 10; | ||||
| @@ -567,7 +585,9 @@ enum SensorStateClass { | ||||
|   STATE_CLASS_TOTAL = 3; | ||||
| } | ||||
|  | ||||
| // Deprecated in API version 1.5 | ||||
| enum SensorLastResetType { | ||||
|   option deprecated = true; | ||||
|   LAST_RESET_NONE = 0; | ||||
|   LAST_RESET_NEVER = 1; | ||||
|   LAST_RESET_AUTO = 2; | ||||
| @@ -591,7 +611,8 @@ message ListEntitiesSensorResponse { | ||||
|   string device_class = 9; | ||||
|   SensorStateClass state_class = 10; | ||||
|   // Last reset type removed in 2021.9.0 | ||||
|   SensorLastResetType legacy_last_reset_type = 11; | ||||
|   // Deprecated in API version 1.5 | ||||
|   SensorLastResetType legacy_last_reset_type = 11 [deprecated=true]; | ||||
|   bool disabled_by_default = 12; | ||||
|   EntityCategory entity_category = 13; | ||||
|   uint32 device_id = 14 [(field_ifdef) = "USE_DEVICES"]; | ||||
| @@ -947,7 +968,8 @@ message ListEntitiesClimateResponse { | ||||
|   float visual_target_temperature_step = 10; | ||||
|   // for older peer versions - in new system this | ||||
|   // is if CLIMATE_PRESET_AWAY exists is supported_presets | ||||
|   bool legacy_supports_away = 11; | ||||
|   // Deprecated in API version 1.5 | ||||
|   bool legacy_supports_away = 11 [deprecated=true]; | ||||
|   bool supports_action = 12; | ||||
|   repeated ClimateFanMode supported_fan_modes = 13; | ||||
|   repeated ClimateSwingMode supported_swing_modes = 14; | ||||
| @@ -978,7 +1000,8 @@ message ClimateStateResponse { | ||||
|   float target_temperature_low = 5; | ||||
|   float target_temperature_high = 6; | ||||
|   // For older peers, equal to preset == CLIMATE_PRESET_AWAY | ||||
|   bool unused_legacy_away = 7; | ||||
|   // Deprecated in API version 1.5 | ||||
|   bool unused_legacy_away = 7 [deprecated=true]; | ||||
|   ClimateAction action = 8; | ||||
|   ClimateFanMode fan_mode = 9; | ||||
|   ClimateSwingMode swing_mode = 10; | ||||
| @@ -1006,8 +1029,10 @@ message ClimateCommandRequest { | ||||
|   bool has_target_temperature_high = 8; | ||||
|   float target_temperature_high = 9; | ||||
|   // legacy, for older peers, newer ones should use CLIMATE_PRESET_AWAY in preset | ||||
|   bool unused_has_legacy_away = 10; | ||||
|   bool unused_legacy_away = 11; | ||||
|   // Deprecated in API version 1.5 | ||||
|   bool unused_has_legacy_away = 10 [deprecated=true]; | ||||
|   // Deprecated in API version 1.5 | ||||
|   bool unused_legacy_away = 11 [deprecated=true]; | ||||
|   bool has_fan_mode = 12; | ||||
|   ClimateFanMode fan_mode = 13; | ||||
|   bool has_swing_mode = 14; | ||||
| @@ -1354,12 +1379,17 @@ message SubscribeBluetoothLEAdvertisementsRequest { | ||||
|   uint32 flags = 1; | ||||
| } | ||||
|  | ||||
| // Deprecated - only used by deprecated BluetoothLEAdvertisementResponse | ||||
| message BluetoothServiceData { | ||||
|   option deprecated = true; | ||||
|   string uuid = 1; | ||||
|   repeated uint32 legacy_data = 2 [deprecated = true];  // Removed in api version 1.7 | ||||
|   // Deprecated in API version 1.7 | ||||
|   repeated uint32 legacy_data = 2 [deprecated=true];  // Removed in api version 1.7 | ||||
|   bytes data = 3;  // Added in api version 1.7 | ||||
| } | ||||
| // Removed in ESPHome 2025.8.0 - use BluetoothLERawAdvertisementsResponse instead | ||||
| message BluetoothLEAdvertisementResponse { | ||||
|   option deprecated = true; | ||||
|   option (id) = 67; | ||||
|   option (source) = SOURCE_SERVER; | ||||
|   option (ifdef) = "USE_BLUETOOTH_PROXY"; | ||||
|   | ||||
| @@ -362,8 +362,6 @@ uint16_t APIConnection::try_send_cover_state(EntityBase *entity, APIConnection * | ||||
|   auto *cover = static_cast<cover::Cover *>(entity); | ||||
|   CoverStateResponse msg; | ||||
|   auto traits = cover->get_traits(); | ||||
|   msg.legacy_state = | ||||
|       (cover->position == cover::COVER_OPEN) ? enums::LEGACY_COVER_STATE_OPEN : enums::LEGACY_COVER_STATE_CLOSED; | ||||
|   msg.position = cover->position; | ||||
|   if (traits.get_supports_tilt()) | ||||
|     msg.tilt = cover->tilt; | ||||
| @@ -385,19 +383,6 @@ uint16_t APIConnection::try_send_cover_info(EntityBase *entity, APIConnection *c | ||||
| } | ||||
| void APIConnection::cover_command(const CoverCommandRequest &msg) { | ||||
|   ENTITY_COMMAND_MAKE_CALL(cover::Cover, cover, cover) | ||||
|   if (msg.has_legacy_command) { | ||||
|     switch (msg.legacy_command) { | ||||
|       case enums::LEGACY_COVER_COMMAND_OPEN: | ||||
|         call.set_command_open(); | ||||
|         break; | ||||
|       case enums::LEGACY_COVER_COMMAND_CLOSE: | ||||
|         call.set_command_close(); | ||||
|         break; | ||||
|       case enums::LEGACY_COVER_COMMAND_STOP: | ||||
|         call.set_command_stop(); | ||||
|         break; | ||||
|     } | ||||
|   } | ||||
|   if (msg.has_position) | ||||
|     call.set_position(msg.position); | ||||
|   if (msg.has_tilt) | ||||
| @@ -495,14 +480,8 @@ uint16_t APIConnection::try_send_light_info(EntityBase *entity, APIConnection *c | ||||
|   auto traits = light->get_traits(); | ||||
|   for (auto mode : traits.get_supported_color_modes()) | ||||
|     msg.supported_color_modes.push_back(static_cast<enums::ColorMode>(mode)); | ||||
|   msg.legacy_supports_brightness = traits.supports_color_capability(light::ColorCapability::BRIGHTNESS); | ||||
|   msg.legacy_supports_rgb = traits.supports_color_capability(light::ColorCapability::RGB); | ||||
|   msg.legacy_supports_white_value = | ||||
|       msg.legacy_supports_rgb && (traits.supports_color_capability(light::ColorCapability::WHITE) || | ||||
|                                   traits.supports_color_capability(light::ColorCapability::COLD_WARM_WHITE)); | ||||
|   msg.legacy_supports_color_temperature = traits.supports_color_capability(light::ColorCapability::COLOR_TEMPERATURE) || | ||||
|                                           traits.supports_color_capability(light::ColorCapability::COLD_WARM_WHITE); | ||||
|   if (msg.legacy_supports_color_temperature) { | ||||
|   if (traits.supports_color_capability(light::ColorCapability::COLOR_TEMPERATURE) || | ||||
|       traits.supports_color_capability(light::ColorCapability::COLD_WARM_WHITE)) { | ||||
|     msg.min_mireds = traits.get_min_mireds(); | ||||
|     msg.max_mireds = traits.get_max_mireds(); | ||||
|   } | ||||
| @@ -692,7 +671,6 @@ uint16_t APIConnection::try_send_climate_info(EntityBase *entity, APIConnection | ||||
|   msg.visual_current_temperature_step = traits.get_visual_current_temperature_step(); | ||||
|   msg.visual_min_humidity = traits.get_visual_min_humidity(); | ||||
|   msg.visual_max_humidity = traits.get_visual_max_humidity(); | ||||
|   msg.legacy_supports_away = traits.supports_preset(climate::CLIMATE_PRESET_AWAY); | ||||
|   msg.supports_action = traits.get_supports_action(); | ||||
|   for (auto fan_mode : traits.get_supported_fan_modes()) | ||||
|     msg.supported_fan_modes.push_back(static_cast<enums::ClimateFanMode>(fan_mode)); | ||||
| @@ -1113,21 +1091,6 @@ void APIConnection::subscribe_bluetooth_le_advertisements(const SubscribeBluetoo | ||||
| void APIConnection::unsubscribe_bluetooth_le_advertisements(const UnsubscribeBluetoothLEAdvertisementsRequest &msg) { | ||||
|   bluetooth_proxy::global_bluetooth_proxy->unsubscribe_api_connection(this); | ||||
| } | ||||
| bool APIConnection::send_bluetooth_le_advertisement(const BluetoothLEAdvertisementResponse &msg) { | ||||
|   if (this->client_api_version_major_ < 1 || this->client_api_version_minor_ < 7) { | ||||
|     BluetoothLEAdvertisementResponse resp = msg; | ||||
|     for (auto &service : resp.service_data) { | ||||
|       service.legacy_data.assign(service.data.begin(), service.data.end()); | ||||
|       service.data.clear(); | ||||
|     } | ||||
|     for (auto &manufacturer_data : resp.manufacturer_data) { | ||||
|       manufacturer_data.legacy_data.assign(manufacturer_data.data.begin(), manufacturer_data.data.end()); | ||||
|       manufacturer_data.data.clear(); | ||||
|     } | ||||
|     return this->send_message(resp, BluetoothLEAdvertisementResponse::MESSAGE_TYPE); | ||||
|   } | ||||
|   return this->send_message(msg, BluetoothLEAdvertisementResponse::MESSAGE_TYPE); | ||||
| } | ||||
| void APIConnection::bluetooth_device_request(const BluetoothDeviceRequest &msg) { | ||||
|   bluetooth_proxy::global_bluetooth_proxy->bluetooth_device_request(msg); | ||||
| } | ||||
| @@ -1499,12 +1462,10 @@ DeviceInfoResponse APIConnection::device_info(const DeviceInfoRequest &msg) { | ||||
|   resp.webserver_port = USE_WEBSERVER_PORT; | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   resp.legacy_bluetooth_proxy_version = bluetooth_proxy::global_bluetooth_proxy->get_legacy_version(); | ||||
|   resp.bluetooth_proxy_feature_flags = bluetooth_proxy::global_bluetooth_proxy->get_feature_flags(); | ||||
|   resp.bluetooth_mac_address = bluetooth_proxy::global_bluetooth_proxy->get_bluetooth_mac_address_pretty(); | ||||
| #endif | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   resp.legacy_voice_assistant_version = voice_assistant::global_voice_assistant->get_legacy_version(); | ||||
|   resp.voice_assistant_feature_flags = voice_assistant::global_voice_assistant->get_feature_flags(); | ||||
| #endif | ||||
| #ifdef USE_API_NOISE | ||||
|   | ||||
| @@ -126,7 +126,6 @@ class APIConnection : public APIServerConnection { | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   void subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) override; | ||||
|   void unsubscribe_bluetooth_le_advertisements(const UnsubscribeBluetoothLEAdvertisementsRequest &msg) override; | ||||
|   bool send_bluetooth_le_advertisement(const BluetoothLEAdvertisementResponse &msg); | ||||
|  | ||||
|   void bluetooth_device_request(const BluetoothDeviceRequest &msg) override; | ||||
|   void bluetooth_gatt_read(const BluetoothGATTReadRequest &msg) override; | ||||
|   | ||||
| @@ -94,17 +94,11 @@ void DeviceInfoResponse::encode(ProtoWriteBuffer buffer) const { | ||||
| #ifdef USE_WEBSERVER | ||||
|   buffer.encode_uint32(10, this->webserver_port); | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   buffer.encode_uint32(11, this->legacy_bluetooth_proxy_version); | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   buffer.encode_uint32(15, this->bluetooth_proxy_feature_flags); | ||||
| #endif | ||||
|   buffer.encode_string(12, this->manufacturer); | ||||
|   buffer.encode_string(13, this->friendly_name); | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   buffer.encode_uint32(14, this->legacy_voice_assistant_version); | ||||
| #endif | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   buffer.encode_uint32(17, this->voice_assistant_feature_flags); | ||||
| #endif | ||||
| @@ -150,17 +144,11 @@ void DeviceInfoResponse::calculate_size(uint32_t &total_size) const { | ||||
| #ifdef USE_WEBSERVER | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->webserver_port); | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->legacy_bluetooth_proxy_version); | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->bluetooth_proxy_feature_flags); | ||||
| #endif | ||||
|   ProtoSize::add_string_field(total_size, 1, this->manufacturer); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->friendly_name); | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->legacy_voice_assistant_version); | ||||
| #endif | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   ProtoSize::add_uint32_field(total_size, 2, this->voice_assistant_feature_flags); | ||||
| #endif | ||||
| @@ -270,7 +258,6 @@ void ListEntitiesCoverResponse::calculate_size(uint32_t &total_size) const { | ||||
| } | ||||
| void CoverStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_uint32(2, static_cast<uint32_t>(this->legacy_state)); | ||||
|   buffer.encode_float(3, this->position); | ||||
|   buffer.encode_float(4, this->tilt); | ||||
|   buffer.encode_uint32(5, static_cast<uint32_t>(this->current_operation)); | ||||
| @@ -280,7 +267,6 @@ void CoverStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
| } | ||||
| void CoverStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->legacy_state)); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->position); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->tilt); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->current_operation)); | ||||
| @@ -290,12 +276,6 @@ void CoverStateResponse::calculate_size(uint32_t &total_size) const { | ||||
| } | ||||
| bool CoverCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|   switch (field_id) { | ||||
|     case 2: | ||||
|       this->has_legacy_command = value.as_bool(); | ||||
|       break; | ||||
|     case 3: | ||||
|       this->legacy_command = static_cast<enums::LegacyCoverCommand>(value.as_uint32()); | ||||
|       break; | ||||
|     case 4: | ||||
|       this->has_position = value.as_bool(); | ||||
|       break; | ||||
| @@ -379,7 +359,6 @@ void FanStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_fixed32(1, this->key); | ||||
|   buffer.encode_bool(2, this->state); | ||||
|   buffer.encode_bool(3, this->oscillating); | ||||
|   buffer.encode_uint32(4, static_cast<uint32_t>(this->speed)); | ||||
|   buffer.encode_uint32(5, static_cast<uint32_t>(this->direction)); | ||||
|   buffer.encode_int32(6, this->speed_level); | ||||
|   buffer.encode_string(7, this->preset_mode); | ||||
| @@ -391,7 +370,6 @@ void FanStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_fixed32_field(total_size, 1, this->key); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->state); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->oscillating); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->speed)); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->direction)); | ||||
|   ProtoSize::add_int32_field(total_size, 1, this->speed_level); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->preset_mode); | ||||
| @@ -407,12 +385,6 @@ bool FanCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) { | ||||
|     case 3: | ||||
|       this->state = value.as_bool(); | ||||
|       break; | ||||
|     case 4: | ||||
|       this->has_speed = value.as_bool(); | ||||
|       break; | ||||
|     case 5: | ||||
|       this->speed = static_cast<enums::FanSpeed>(value.as_uint32()); | ||||
|       break; | ||||
|     case 6: | ||||
|       this->has_oscillating = value.as_bool(); | ||||
|       break; | ||||
| @@ -473,10 +445,6 @@ void ListEntitiesLightResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   for (auto &it : this->supported_color_modes) { | ||||
|     buffer.encode_uint32(12, static_cast<uint32_t>(it), true); | ||||
|   } | ||||
|   buffer.encode_bool(5, this->legacy_supports_brightness); | ||||
|   buffer.encode_bool(6, this->legacy_supports_rgb); | ||||
|   buffer.encode_bool(7, this->legacy_supports_white_value); | ||||
|   buffer.encode_bool(8, this->legacy_supports_color_temperature); | ||||
|   buffer.encode_float(9, this->min_mireds); | ||||
|   buffer.encode_float(10, this->max_mireds); | ||||
|   for (auto &it : this->effects) { | ||||
| @@ -500,10 +468,6 @@ void ListEntitiesLightResponse::calculate_size(uint32_t &total_size) const { | ||||
|       ProtoSize::add_enum_field_repeated(total_size, 1, static_cast<uint32_t>(it)); | ||||
|     } | ||||
|   } | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_brightness); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_rgb); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_white_value); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_color_temperature); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->min_mireds); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->max_mireds); | ||||
|   if (!this->effects.empty()) { | ||||
| @@ -677,7 +641,6 @@ void ListEntitiesSensorResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_bool(8, this->force_update); | ||||
|   buffer.encode_string(9, this->device_class); | ||||
|   buffer.encode_uint32(10, static_cast<uint32_t>(this->state_class)); | ||||
|   buffer.encode_uint32(11, static_cast<uint32_t>(this->legacy_last_reset_type)); | ||||
|   buffer.encode_bool(12, this->disabled_by_default); | ||||
|   buffer.encode_uint32(13, static_cast<uint32_t>(this->entity_category)); | ||||
| #ifdef USE_DEVICES | ||||
| @@ -696,7 +659,6 @@ void ListEntitiesSensorResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->force_update); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->device_class); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->state_class)); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->legacy_last_reset_type)); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->disabled_by_default); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->entity_category)); | ||||
| #ifdef USE_DEVICES | ||||
| @@ -1105,7 +1067,6 @@ void ListEntitiesClimateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_float(8, this->visual_min_temperature); | ||||
|   buffer.encode_float(9, this->visual_max_temperature); | ||||
|   buffer.encode_float(10, this->visual_target_temperature_step); | ||||
|   buffer.encode_bool(11, this->legacy_supports_away); | ||||
|   buffer.encode_bool(12, this->supports_action); | ||||
|   for (auto &it : this->supported_fan_modes) { | ||||
|     buffer.encode_uint32(13, static_cast<uint32_t>(it), true); | ||||
| @@ -1150,7 +1111,6 @@ void ListEntitiesClimateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_float_field(total_size, 1, this->visual_min_temperature); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->visual_max_temperature); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->visual_target_temperature_step); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->legacy_supports_away); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->supports_action); | ||||
|   if (!this->supported_fan_modes.empty()) { | ||||
|     for (const auto &it : this->supported_fan_modes) { | ||||
| @@ -1198,7 +1158,6 @@ void ClimateStateResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_float(4, this->target_temperature); | ||||
|   buffer.encode_float(5, this->target_temperature_low); | ||||
|   buffer.encode_float(6, this->target_temperature_high); | ||||
|   buffer.encode_bool(7, this->unused_legacy_away); | ||||
|   buffer.encode_uint32(8, static_cast<uint32_t>(this->action)); | ||||
|   buffer.encode_uint32(9, static_cast<uint32_t>(this->fan_mode)); | ||||
|   buffer.encode_uint32(10, static_cast<uint32_t>(this->swing_mode)); | ||||
| @@ -1218,7 +1177,6 @@ void ClimateStateResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_float_field(total_size, 1, this->target_temperature); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->target_temperature_low); | ||||
|   ProtoSize::add_float_field(total_size, 1, this->target_temperature_high); | ||||
|   ProtoSize::add_bool_field(total_size, 1, this->unused_legacy_away); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->action)); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->fan_mode)); | ||||
|   ProtoSize::add_enum_field(total_size, 1, static_cast<uint32_t>(this->swing_mode)); | ||||
| @@ -1248,12 +1206,6 @@ bool ClimateCommandRequest::decode_varint(uint32_t field_id, ProtoVarInt value) | ||||
|     case 8: | ||||
|       this->has_target_temperature_high = value.as_bool(); | ||||
|       break; | ||||
|     case 10: | ||||
|       this->unused_has_legacy_away = value.as_bool(); | ||||
|       break; | ||||
|     case 11: | ||||
|       this->unused_legacy_away = value.as_bool(); | ||||
|       break; | ||||
|     case 12: | ||||
|       this->has_fan_mode = value.as_bool(); | ||||
|       break; | ||||
| @@ -1869,50 +1821,6 @@ bool SubscribeBluetoothLEAdvertisementsRequest::decode_varint(uint32_t field_id, | ||||
|   } | ||||
|   return true; | ||||
| } | ||||
| void BluetoothServiceData::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_string(1, this->uuid); | ||||
|   for (auto &it : this->legacy_data) { | ||||
|     buffer.encode_uint32(2, it, true); | ||||
|   } | ||||
|   buffer.encode_bytes(3, reinterpret_cast<const uint8_t *>(this->data.data()), this->data.size()); | ||||
| } | ||||
| void BluetoothServiceData::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_string_field(total_size, 1, this->uuid); | ||||
|   if (!this->legacy_data.empty()) { | ||||
|     for (const auto &it : this->legacy_data) { | ||||
|       ProtoSize::add_uint32_field_repeated(total_size, 1, it); | ||||
|     } | ||||
|   } | ||||
|   ProtoSize::add_string_field(total_size, 1, this->data); | ||||
| } | ||||
| void BluetoothLEAdvertisementResponse::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_uint64(1, this->address); | ||||
|   buffer.encode_bytes(2, reinterpret_cast<const uint8_t *>(this->name.data()), this->name.size()); | ||||
|   buffer.encode_sint32(3, this->rssi); | ||||
|   for (auto &it : this->service_uuids) { | ||||
|     buffer.encode_string(4, it, true); | ||||
|   } | ||||
|   for (auto &it : this->service_data) { | ||||
|     buffer.encode_message(5, it, true); | ||||
|   } | ||||
|   for (auto &it : this->manufacturer_data) { | ||||
|     buffer.encode_message(6, it, true); | ||||
|   } | ||||
|   buffer.encode_uint32(7, this->address_type); | ||||
| } | ||||
| void BluetoothLEAdvertisementResponse::calculate_size(uint32_t &total_size) const { | ||||
|   ProtoSize::add_uint64_field(total_size, 1, this->address); | ||||
|   ProtoSize::add_string_field(total_size, 1, this->name); | ||||
|   ProtoSize::add_sint32_field(total_size, 1, this->rssi); | ||||
|   if (!this->service_uuids.empty()) { | ||||
|     for (const auto &it : this->service_uuids) { | ||||
|       ProtoSize::add_string_field_repeated(total_size, 1, it); | ||||
|     } | ||||
|   } | ||||
|   ProtoSize::add_repeated_message(total_size, 1, this->service_data); | ||||
|   ProtoSize::add_repeated_message(total_size, 1, this->manufacturer_data); | ||||
|   ProtoSize::add_uint32_field(total_size, 1, this->address_type); | ||||
| } | ||||
| void BluetoothLERawAdvertisement::encode(ProtoWriteBuffer buffer) const { | ||||
|   buffer.encode_uint64(1, this->address); | ||||
|   buffer.encode_sint32(2, this->rssi); | ||||
|   | ||||
| @@ -17,27 +17,13 @@ enum EntityCategory : uint32_t { | ||||
|   ENTITY_CATEGORY_DIAGNOSTIC = 2, | ||||
| }; | ||||
| #ifdef USE_COVER | ||||
| enum LegacyCoverState : uint32_t { | ||||
|   LEGACY_COVER_STATE_OPEN = 0, | ||||
|   LEGACY_COVER_STATE_CLOSED = 1, | ||||
| }; | ||||
| enum CoverOperation : uint32_t { | ||||
|   COVER_OPERATION_IDLE = 0, | ||||
|   COVER_OPERATION_IS_OPENING = 1, | ||||
|   COVER_OPERATION_IS_CLOSING = 2, | ||||
| }; | ||||
| enum LegacyCoverCommand : uint32_t { | ||||
|   LEGACY_COVER_COMMAND_OPEN = 0, | ||||
|   LEGACY_COVER_COMMAND_CLOSE = 1, | ||||
|   LEGACY_COVER_COMMAND_STOP = 2, | ||||
| }; | ||||
| #endif | ||||
| #ifdef USE_FAN | ||||
| enum FanSpeed : uint32_t { | ||||
|   FAN_SPEED_LOW = 0, | ||||
|   FAN_SPEED_MEDIUM = 1, | ||||
|   FAN_SPEED_HIGH = 2, | ||||
| }; | ||||
| enum FanDirection : uint32_t { | ||||
|   FAN_DIRECTION_FORWARD = 0, | ||||
|   FAN_DIRECTION_REVERSE = 1, | ||||
| @@ -65,11 +51,6 @@ enum SensorStateClass : uint32_t { | ||||
|   STATE_CLASS_TOTAL_INCREASING = 2, | ||||
|   STATE_CLASS_TOTAL = 3, | ||||
| }; | ||||
| enum SensorLastResetType : uint32_t { | ||||
|   LAST_RESET_NONE = 0, | ||||
|   LAST_RESET_NEVER = 1, | ||||
|   LAST_RESET_AUTO = 2, | ||||
| }; | ||||
| #endif | ||||
| enum LogLevel : uint32_t { | ||||
|   LOG_LEVEL_NONE = 0, | ||||
| @@ -485,7 +466,7 @@ class DeviceInfo : public ProtoMessage { | ||||
| class DeviceInfoResponse : public ProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 10; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 219; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 211; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "device_info_response"; } | ||||
| #endif | ||||
| @@ -507,17 +488,11 @@ class DeviceInfoResponse : public ProtoMessage { | ||||
| #ifdef USE_WEBSERVER | ||||
|   uint32_t webserver_port{0}; | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   uint32_t legacy_bluetooth_proxy_version{0}; | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   uint32_t bluetooth_proxy_feature_flags{0}; | ||||
| #endif | ||||
|   std::string manufacturer{}; | ||||
|   std::string friendly_name{}; | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   uint32_t legacy_voice_assistant_version{0}; | ||||
| #endif | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   uint32_t voice_assistant_feature_flags{0}; | ||||
| #endif | ||||
| @@ -646,11 +621,10 @@ class ListEntitiesCoverResponse : public InfoResponseProtoMessage { | ||||
| class CoverStateResponse : public StateResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 22; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 23; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 21; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "cover_state_response"; } | ||||
| #endif | ||||
|   enums::LegacyCoverState legacy_state{}; | ||||
|   float position{0.0f}; | ||||
|   float tilt{0.0f}; | ||||
|   enums::CoverOperation current_operation{}; | ||||
| @@ -665,12 +639,10 @@ class CoverStateResponse : public StateResponseProtoMessage { | ||||
| class CoverCommandRequest : public CommandProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 30; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 29; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 25; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "cover_command_request"; } | ||||
| #endif | ||||
|   bool has_legacy_command{false}; | ||||
|   enums::LegacyCoverCommand legacy_command{}; | ||||
|   bool has_position{false}; | ||||
|   float position{0.0f}; | ||||
|   bool has_tilt{false}; | ||||
| @@ -709,13 +681,12 @@ class ListEntitiesFanResponse : public InfoResponseProtoMessage { | ||||
| class FanStateResponse : public StateResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 23; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 30; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 28; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "fan_state_response"; } | ||||
| #endif | ||||
|   bool state{false}; | ||||
|   bool oscillating{false}; | ||||
|   enums::FanSpeed speed{}; | ||||
|   enums::FanDirection direction{}; | ||||
|   int32_t speed_level{0}; | ||||
|   std::string preset_mode{}; | ||||
| @@ -730,14 +701,12 @@ class FanStateResponse : public StateResponseProtoMessage { | ||||
| class FanCommandRequest : public CommandProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 31; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 42; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 38; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "fan_command_request"; } | ||||
| #endif | ||||
|   bool has_state{false}; | ||||
|   bool state{false}; | ||||
|   bool has_speed{false}; | ||||
|   enums::FanSpeed speed{}; | ||||
|   bool has_oscillating{false}; | ||||
|   bool oscillating{false}; | ||||
|   bool has_direction{false}; | ||||
| @@ -760,15 +729,11 @@ class FanCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesLightResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 15; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 81; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 73; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_light_response"; } | ||||
| #endif | ||||
|   std::vector<enums::ColorMode> supported_color_modes{}; | ||||
|   bool legacy_supports_brightness{false}; | ||||
|   bool legacy_supports_rgb{false}; | ||||
|   bool legacy_supports_white_value{false}; | ||||
|   bool legacy_supports_color_temperature{false}; | ||||
|   float min_mireds{0.0f}; | ||||
|   float max_mireds{0.0f}; | ||||
|   std::vector<std::string> effects{}; | ||||
| @@ -854,7 +819,7 @@ class LightCommandRequest : public CommandProtoMessage { | ||||
| class ListEntitiesSensorResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 16; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 68; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 66; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_sensor_response"; } | ||||
| #endif | ||||
| @@ -863,7 +828,6 @@ class ListEntitiesSensorResponse : public InfoResponseProtoMessage { | ||||
|   bool force_update{false}; | ||||
|   std::string device_class{}; | ||||
|   enums::SensorStateClass state_class{}; | ||||
|   enums::SensorLastResetType legacy_last_reset_type{}; | ||||
|   void encode(ProtoWriteBuffer buffer) const override; | ||||
|   void calculate_size(uint32_t &total_size) const override; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
| @@ -1289,7 +1253,7 @@ class CameraImageRequest : public ProtoDecodableMessage { | ||||
| class ListEntitiesClimateResponse : public InfoResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 46; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 147; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 145; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "list_entities_climate_response"; } | ||||
| #endif | ||||
| @@ -1299,7 +1263,6 @@ class ListEntitiesClimateResponse : public InfoResponseProtoMessage { | ||||
|   float visual_min_temperature{0.0f}; | ||||
|   float visual_max_temperature{0.0f}; | ||||
|   float visual_target_temperature_step{0.0f}; | ||||
|   bool legacy_supports_away{false}; | ||||
|   bool supports_action{false}; | ||||
|   std::vector<enums::ClimateFanMode> supported_fan_modes{}; | ||||
|   std::vector<enums::ClimateSwingMode> supported_swing_modes{}; | ||||
| @@ -1322,7 +1285,7 @@ class ListEntitiesClimateResponse : public InfoResponseProtoMessage { | ||||
| class ClimateStateResponse : public StateResponseProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 47; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 70; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 68; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "climate_state_response"; } | ||||
| #endif | ||||
| @@ -1331,7 +1294,6 @@ class ClimateStateResponse : public StateResponseProtoMessage { | ||||
|   float target_temperature{0.0f}; | ||||
|   float target_temperature_low{0.0f}; | ||||
|   float target_temperature_high{0.0f}; | ||||
|   bool unused_legacy_away{false}; | ||||
|   enums::ClimateAction action{}; | ||||
|   enums::ClimateFanMode fan_mode{}; | ||||
|   enums::ClimateSwingMode swing_mode{}; | ||||
| @@ -1351,7 +1313,7 @@ class ClimateStateResponse : public StateResponseProtoMessage { | ||||
| class ClimateCommandRequest : public CommandProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 48; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 88; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 84; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "climate_command_request"; } | ||||
| #endif | ||||
| @@ -1363,8 +1325,6 @@ class ClimateCommandRequest : public CommandProtoMessage { | ||||
|   float target_temperature_low{0.0f}; | ||||
|   bool has_target_temperature_high{false}; | ||||
|   float target_temperature_high{0.0f}; | ||||
|   bool unused_has_legacy_away{false}; | ||||
|   bool unused_legacy_away{false}; | ||||
|   bool has_fan_mode{false}; | ||||
|   enums::ClimateFanMode fan_mode{}; | ||||
|   bool has_swing_mode{false}; | ||||
| @@ -1736,41 +1696,6 @@ class SubscribeBluetoothLEAdvertisementsRequest : public ProtoDecodableMessage { | ||||
|  protected: | ||||
|   bool decode_varint(uint32_t field_id, ProtoVarInt value) override; | ||||
| }; | ||||
| class BluetoothServiceData : public ProtoMessage { | ||||
|  public: | ||||
|   std::string uuid{}; | ||||
|   std::vector<uint32_t> legacy_data{}; | ||||
|   std::string data{}; | ||||
|   void encode(ProtoWriteBuffer buffer) const override; | ||||
|   void calculate_size(uint32_t &total_size) const override; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   void dump_to(std::string &out) const override; | ||||
| #endif | ||||
|  | ||||
|  protected: | ||||
| }; | ||||
| class BluetoothLEAdvertisementResponse : public ProtoMessage { | ||||
|  public: | ||||
|   static constexpr uint8_t MESSAGE_TYPE = 67; | ||||
|   static constexpr uint8_t ESTIMATED_SIZE = 107; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   const char *message_name() const override { return "bluetooth_le_advertisement_response"; } | ||||
| #endif | ||||
|   uint64_t address{0}; | ||||
|   std::string name{}; | ||||
|   int32_t rssi{0}; | ||||
|   std::vector<std::string> service_uuids{}; | ||||
|   std::vector<BluetoothServiceData> service_data{}; | ||||
|   std::vector<BluetoothServiceData> manufacturer_data{}; | ||||
|   uint32_t address_type{0}; | ||||
|   void encode(ProtoWriteBuffer buffer) const override; | ||||
|   void calculate_size(uint32_t &total_size) const override; | ||||
| #ifdef HAS_PROTO_MESSAGE_DUMP | ||||
|   void dump_to(std::string &out) const override; | ||||
| #endif | ||||
|  | ||||
|  protected: | ||||
| }; | ||||
| class BluetoothLERawAdvertisement : public ProtoMessage { | ||||
|  public: | ||||
|   uint64_t address{0}; | ||||
|   | ||||
| @@ -23,16 +23,6 @@ template<> const char *proto_enum_to_string<enums::EntityCategory>(enums::Entity | ||||
|   } | ||||
| } | ||||
| #ifdef USE_COVER | ||||
| template<> const char *proto_enum_to_string<enums::LegacyCoverState>(enums::LegacyCoverState value) { | ||||
|   switch (value) { | ||||
|     case enums::LEGACY_COVER_STATE_OPEN: | ||||
|       return "LEGACY_COVER_STATE_OPEN"; | ||||
|     case enums::LEGACY_COVER_STATE_CLOSED: | ||||
|       return "LEGACY_COVER_STATE_CLOSED"; | ||||
|     default: | ||||
|       return "UNKNOWN"; | ||||
|   } | ||||
| } | ||||
| template<> const char *proto_enum_to_string<enums::CoverOperation>(enums::CoverOperation value) { | ||||
|   switch (value) { | ||||
|     case enums::COVER_OPERATION_IDLE: | ||||
| @@ -45,32 +35,8 @@ template<> const char *proto_enum_to_string<enums::CoverOperation>(enums::CoverO | ||||
|       return "UNKNOWN"; | ||||
|   } | ||||
| } | ||||
| template<> const char *proto_enum_to_string<enums::LegacyCoverCommand>(enums::LegacyCoverCommand value) { | ||||
|   switch (value) { | ||||
|     case enums::LEGACY_COVER_COMMAND_OPEN: | ||||
|       return "LEGACY_COVER_COMMAND_OPEN"; | ||||
|     case enums::LEGACY_COVER_COMMAND_CLOSE: | ||||
|       return "LEGACY_COVER_COMMAND_CLOSE"; | ||||
|     case enums::LEGACY_COVER_COMMAND_STOP: | ||||
|       return "LEGACY_COVER_COMMAND_STOP"; | ||||
|     default: | ||||
|       return "UNKNOWN"; | ||||
|   } | ||||
| } | ||||
| #endif | ||||
| #ifdef USE_FAN | ||||
| template<> const char *proto_enum_to_string<enums::FanSpeed>(enums::FanSpeed value) { | ||||
|   switch (value) { | ||||
|     case enums::FAN_SPEED_LOW: | ||||
|       return "FAN_SPEED_LOW"; | ||||
|     case enums::FAN_SPEED_MEDIUM: | ||||
|       return "FAN_SPEED_MEDIUM"; | ||||
|     case enums::FAN_SPEED_HIGH: | ||||
|       return "FAN_SPEED_HIGH"; | ||||
|     default: | ||||
|       return "UNKNOWN"; | ||||
|   } | ||||
| } | ||||
| template<> const char *proto_enum_to_string<enums::FanDirection>(enums::FanDirection value) { | ||||
|   switch (value) { | ||||
|     case enums::FAN_DIRECTION_FORWARD: | ||||
| @@ -127,18 +93,6 @@ template<> const char *proto_enum_to_string<enums::SensorStateClass>(enums::Sens | ||||
|       return "UNKNOWN"; | ||||
|   } | ||||
| } | ||||
| template<> const char *proto_enum_to_string<enums::SensorLastResetType>(enums::SensorLastResetType value) { | ||||
|   switch (value) { | ||||
|     case enums::LAST_RESET_NONE: | ||||
|       return "LAST_RESET_NONE"; | ||||
|     case enums::LAST_RESET_NEVER: | ||||
|       return "LAST_RESET_NEVER"; | ||||
|     case enums::LAST_RESET_AUTO: | ||||
|       return "LAST_RESET_AUTO"; | ||||
|     default: | ||||
|       return "UNKNOWN"; | ||||
|   } | ||||
| } | ||||
| #endif | ||||
| template<> const char *proto_enum_to_string<enums::LogLevel>(enums::LogLevel value) { | ||||
|   switch (value) { | ||||
| @@ -737,13 +691,6 @@ void DeviceInfoResponse::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   out.append("  legacy_bluetooth_proxy_version: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->legacy_bluetooth_proxy_version); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
| #ifdef USE_BLUETOOTH_PROXY | ||||
|   out.append("  bluetooth_proxy_feature_flags: "); | ||||
| @@ -760,13 +707,6 @@ void DeviceInfoResponse::dump_to(std::string &out) const { | ||||
|   out.append("'").append(this->friendly_name).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   out.append("  legacy_voice_assistant_version: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->legacy_voice_assistant_version); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
| #endif | ||||
| #ifdef USE_VOICE_ASSISTANT | ||||
|   out.append("  voice_assistant_feature_flags: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->voice_assistant_feature_flags); | ||||
| @@ -961,10 +901,6 @@ void CoverStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  legacy_state: "); | ||||
|   out.append(proto_enum_to_string<enums::LegacyCoverState>(this->legacy_state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  position: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%g", this->position); | ||||
|   out.append(buffer); | ||||
| @@ -996,14 +932,6 @@ void CoverCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  has_legacy_command: "); | ||||
|   out.append(YESNO(this->has_legacy_command)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  legacy_command: "); | ||||
|   out.append(proto_enum_to_string<enums::LegacyCoverCommand>(this->legacy_command)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  has_position: "); | ||||
|   out.append(YESNO(this->has_position)); | ||||
|   out.append("\n"); | ||||
| @@ -1115,10 +1043,6 @@ void FanStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->oscillating)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  speed: "); | ||||
|   out.append(proto_enum_to_string<enums::FanSpeed>(this->speed)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  direction: "); | ||||
|   out.append(proto_enum_to_string<enums::FanDirection>(this->direction)); | ||||
|   out.append("\n"); | ||||
| @@ -1157,14 +1081,6 @@ void FanCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(YESNO(this->state)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  has_speed: "); | ||||
|   out.append(YESNO(this->has_speed)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  speed: "); | ||||
|   out.append(proto_enum_to_string<enums::FanSpeed>(this->speed)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  has_oscillating: "); | ||||
|   out.append(YESNO(this->has_oscillating)); | ||||
|   out.append("\n"); | ||||
| @@ -1231,22 +1147,6 @@ void ListEntitiesLightResponse::dump_to(std::string &out) const { | ||||
|     out.append("\n"); | ||||
|   } | ||||
|  | ||||
|   out.append("  legacy_supports_brightness: "); | ||||
|   out.append(YESNO(this->legacy_supports_brightness)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  legacy_supports_rgb: "); | ||||
|   out.append(YESNO(this->legacy_supports_rgb)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  legacy_supports_white_value: "); | ||||
|   out.append(YESNO(this->legacy_supports_white_value)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  legacy_supports_color_temperature: "); | ||||
|   out.append(YESNO(this->legacy_supports_color_temperature)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  min_mireds: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%g", this->min_mireds); | ||||
|   out.append(buffer); | ||||
| @@ -1537,10 +1437,6 @@ void ListEntitiesSensorResponse::dump_to(std::string &out) const { | ||||
|   out.append(proto_enum_to_string<enums::SensorStateClass>(this->state_class)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  legacy_last_reset_type: "); | ||||
|   out.append(proto_enum_to_string<enums::SensorLastResetType>(this->legacy_last_reset_type)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  disabled_by_default: "); | ||||
|   out.append(YESNO(this->disabled_by_default)); | ||||
|   out.append("\n"); | ||||
| @@ -2107,10 +2003,6 @@ void ListEntitiesClimateResponse::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  legacy_supports_away: "); | ||||
|   out.append(YESNO(this->legacy_supports_away)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  supports_action: "); | ||||
|   out.append(YESNO(this->supports_action)); | ||||
|   out.append("\n"); | ||||
| @@ -2223,10 +2115,6 @@ void ClimateStateResponse::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unused_legacy_away: "); | ||||
|   out.append(YESNO(this->unused_legacy_away)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  action: "); | ||||
|   out.append(proto_enum_to_string<enums::ClimateAction>(this->action)); | ||||
|   out.append("\n"); | ||||
| @@ -2313,14 +2201,6 @@ void ClimateCommandRequest::dump_to(std::string &out) const { | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unused_has_legacy_away: "); | ||||
|   out.append(YESNO(this->unused_has_legacy_away)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  unused_legacy_away: "); | ||||
|   out.append(YESNO(this->unused_legacy_away)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  has_fan_mode: "); | ||||
|   out.append(YESNO(this->has_fan_mode)); | ||||
|   out.append("\n"); | ||||
| @@ -3053,66 +2933,6 @@ void SubscribeBluetoothLEAdvertisementsRequest::dump_to(std::string &out) const | ||||
|   out.append("\n"); | ||||
|   out.append("}"); | ||||
| } | ||||
| void BluetoothServiceData::dump_to(std::string &out) const { | ||||
|   __attribute__((unused)) char buffer[64]; | ||||
|   out.append("BluetoothServiceData {\n"); | ||||
|   out.append("  uuid: "); | ||||
|   out.append("'").append(this->uuid).append("'"); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   for (const auto &it : this->legacy_data) { | ||||
|     out.append("  legacy_data: "); | ||||
|     snprintf(buffer, sizeof(buffer), "%" PRIu32, it); | ||||
|     out.append(buffer); | ||||
|     out.append("\n"); | ||||
|   } | ||||
|  | ||||
|   out.append("  data: "); | ||||
|   out.append(format_hex_pretty(this->data)); | ||||
|   out.append("\n"); | ||||
|   out.append("}"); | ||||
| } | ||||
| void BluetoothLEAdvertisementResponse::dump_to(std::string &out) const { | ||||
|   __attribute__((unused)) char buffer[64]; | ||||
|   out.append("BluetoothLEAdvertisementResponse {\n"); | ||||
|   out.append("  address: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%llu", this->address); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  name: "); | ||||
|   out.append(format_hex_pretty(this->name)); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   out.append("  rssi: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRId32, this->rssi); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|  | ||||
|   for (const auto &it : this->service_uuids) { | ||||
|     out.append("  service_uuids: "); | ||||
|     out.append("'").append(it).append("'"); | ||||
|     out.append("\n"); | ||||
|   } | ||||
|  | ||||
|   for (const auto &it : this->service_data) { | ||||
|     out.append("  service_data: "); | ||||
|     it.dump_to(out); | ||||
|     out.append("\n"); | ||||
|   } | ||||
|  | ||||
|   for (const auto &it : this->manufacturer_data) { | ||||
|     out.append("  manufacturer_data: "); | ||||
|     it.dump_to(out); | ||||
|     out.append("\n"); | ||||
|   } | ||||
|  | ||||
|   out.append("  address_type: "); | ||||
|   snprintf(buffer, sizeof(buffer), "%" PRIu32, this->address_type); | ||||
|   out.append(buffer); | ||||
|   out.append("\n"); | ||||
|   out.append("}"); | ||||
| } | ||||
| void BluetoothLERawAdvertisement::dump_to(std::string &out) const { | ||||
|   __attribute__((unused)) char buffer[64]; | ||||
|   out.append("BluetoothLERawAdvertisement {\n"); | ||||
|   | ||||
| @@ -127,46 +127,6 @@ void BluetoothProxy::flush_pending_advertisements() { | ||||
|   this->advertisement_count_ = 0; | ||||
| } | ||||
|  | ||||
| #ifdef USE_ESP32_BLE_DEVICE | ||||
| void BluetoothProxy::send_api_packet_(const esp32_ble_tracker::ESPBTDevice &device) { | ||||
|   api::BluetoothLEAdvertisementResponse resp; | ||||
|   resp.address = device.address_uint64(); | ||||
|   resp.address_type = device.get_address_type(); | ||||
|   if (!device.get_name().empty()) | ||||
|     resp.name = device.get_name(); | ||||
|   resp.rssi = device.get_rssi(); | ||||
|  | ||||
|   // Pre-allocate vectors based on known sizes | ||||
|   auto service_uuids = device.get_service_uuids(); | ||||
|   resp.service_uuids.reserve(service_uuids.size()); | ||||
|   for (auto &uuid : service_uuids) { | ||||
|     resp.service_uuids.emplace_back(uuid.to_string()); | ||||
|   } | ||||
|  | ||||
|   // Pre-allocate service data vector | ||||
|   auto service_datas = device.get_service_datas(); | ||||
|   resp.service_data.reserve(service_datas.size()); | ||||
|   for (auto &data : service_datas) { | ||||
|     resp.service_data.emplace_back(); | ||||
|     auto &service_data = resp.service_data.back(); | ||||
|     service_data.uuid = data.uuid.to_string(); | ||||
|     service_data.data.assign(data.data.begin(), data.data.end()); | ||||
|   } | ||||
|  | ||||
|   // Pre-allocate manufacturer data vector | ||||
|   auto manufacturer_datas = device.get_manufacturer_datas(); | ||||
|   resp.manufacturer_data.reserve(manufacturer_datas.size()); | ||||
|   for (auto &data : manufacturer_datas) { | ||||
|     resp.manufacturer_data.emplace_back(); | ||||
|     auto &manufacturer_data = resp.manufacturer_data.back(); | ||||
|     manufacturer_data.uuid = data.uuid.to_string(); | ||||
|     manufacturer_data.data.assign(data.data.begin(), data.data.end()); | ||||
|   } | ||||
|  | ||||
|   this->api_connection_->send_message(resp, api::BluetoothLEAdvertisementResponse::MESSAGE_TYPE); | ||||
| } | ||||
| #endif  // USE_ESP32_BLE_DEVICE | ||||
|  | ||||
| void BluetoothProxy::dump_config() { | ||||
|   ESP_LOGCONFIG(TAG, "Bluetooth Proxy:"); | ||||
|   ESP_LOGCONFIG(TAG, | ||||
|   | ||||
| @@ -132,9 +132,6 @@ class BluetoothProxy : public esp32_ble_tracker::ESPBTDeviceListener, public Com | ||||
|   } | ||||
|  | ||||
|  protected: | ||||
| #ifdef USE_ESP32_BLE_DEVICE | ||||
|   void send_api_packet_(const esp32_ble_tracker::ESPBTDevice &device); | ||||
| #endif | ||||
|   void send_bluetooth_scanner_state_(esp32_ble_tracker::ScannerState state); | ||||
|  | ||||
|   BluetoothConnection *get_connection_(uint64_t address, bool reserve); | ||||
|   | ||||
| @@ -971,11 +971,11 @@ class RepeatedTypeInfo(TypeInfo): | ||||
|  | ||||
| def build_type_usage_map( | ||||
|     file_desc: descriptor.FileDescriptorProto, | ||||
| ) -> tuple[dict[str, str | None], dict[str, str | None], dict[str, int]]: | ||||
| ) -> tuple[dict[str, str | None], dict[str, str | None], dict[str, int], set[str]]: | ||||
|     """Build mappings for both enums and messages to their ifdefs based on usage. | ||||
|  | ||||
|     Returns: | ||||
|         tuple: (enum_ifdef_map, message_ifdef_map, message_source_map) | ||||
|         tuple: (enum_ifdef_map, message_ifdef_map, message_source_map, used_messages) | ||||
|     """ | ||||
|     enum_ifdef_map: dict[str, str | None] = {} | ||||
|     message_ifdef_map: dict[str, str | None] = {} | ||||
| @@ -988,6 +988,7 @@ def build_type_usage_map( | ||||
|     message_usage: dict[ | ||||
|         str, set[str] | ||||
|     ] = {}  # message_name -> set of message names that use it | ||||
|     used_messages: set[str] = set()  # Track which messages are actually used | ||||
|  | ||||
|     # Build message name to ifdef mapping for quick lookup | ||||
|     message_to_ifdef: dict[str, str | None] = { | ||||
| @@ -996,17 +997,26 @@ def build_type_usage_map( | ||||
|  | ||||
|     # Analyze field usage | ||||
|     for message in file_desc.message_type: | ||||
|         # Skip deprecated messages entirely | ||||
|         if message.options.deprecated: | ||||
|             continue | ||||
|  | ||||
|         for field in message.field: | ||||
|             # Skip deprecated fields when tracking enum usage | ||||
|             if field.options.deprecated: | ||||
|                 continue | ||||
|  | ||||
|             type_name = field.type_name.split(".")[-1] if field.type_name else None | ||||
|             if not type_name: | ||||
|                 continue | ||||
|  | ||||
|             # Track enum usage | ||||
|             # Track enum usage (only from non-deprecated fields) | ||||
|             if field.type == 14:  # TYPE_ENUM | ||||
|                 enum_usage.setdefault(type_name, set()).add(message.name) | ||||
|             # Track message usage | ||||
|             elif field.type == 11:  # TYPE_MESSAGE | ||||
|                 message_usage.setdefault(type_name, set()).add(message.name) | ||||
|                 used_messages.add(type_name) | ||||
|  | ||||
|     # Helper to get unique ifdef from a set of messages | ||||
|     def get_unique_ifdef(message_names: set[str]) -> str | None: | ||||
| @@ -1069,12 +1079,18 @@ def build_type_usage_map( | ||||
|     # Build message source map | ||||
|     # First pass: Get explicit sources for messages with source option or id | ||||
|     for msg in file_desc.message_type: | ||||
|         # Skip deprecated messages | ||||
|         if msg.options.deprecated: | ||||
|             continue | ||||
|  | ||||
|         if msg.options.HasExtension(pb.source): | ||||
|             # Explicit source option takes precedence | ||||
|             message_source_map[msg.name] = get_opt(msg, pb.source, SOURCE_BOTH) | ||||
|         elif msg.options.HasExtension(pb.id): | ||||
|             # Service messages (with id) default to SOURCE_BOTH | ||||
|             message_source_map[msg.name] = SOURCE_BOTH | ||||
|             # Service messages are always used | ||||
|             used_messages.add(msg.name) | ||||
|  | ||||
|     # Second pass: Determine sources for embedded messages based on their usage | ||||
|     for msg in file_desc.message_type: | ||||
| @@ -1103,7 +1119,12 @@ def build_type_usage_map( | ||||
|             # Not used by any message and no explicit source - default to encode-only | ||||
|             message_source_map[msg.name] = SOURCE_SERVER | ||||
|  | ||||
|     return enum_ifdef_map, message_ifdef_map, message_source_map | ||||
|     return ( | ||||
|         enum_ifdef_map, | ||||
|         message_ifdef_map, | ||||
|         message_source_map, | ||||
|         used_messages, | ||||
|     ) | ||||
|  | ||||
|  | ||||
| def build_enum_type(desc, enum_ifdef_map) -> tuple[str, str, str]: | ||||
| @@ -1145,6 +1166,10 @@ def calculate_message_estimated_size(desc: descriptor.DescriptorProto) -> int: | ||||
|     total_size = 0 | ||||
|  | ||||
|     for field in desc.field: | ||||
|         # Skip deprecated fields | ||||
|         if field.options.deprecated: | ||||
|             continue | ||||
|  | ||||
|         ti = create_field_type_info(field) | ||||
|  | ||||
|         # Add estimated size for this field | ||||
| @@ -1213,6 +1238,10 @@ def build_message_type( | ||||
|         public_content.append("#endif") | ||||
|  | ||||
|     for field in desc.field: | ||||
|         # Skip deprecated fields completely | ||||
|         if field.options.deprecated: | ||||
|             continue | ||||
|  | ||||
|         ti = create_field_type_info(field) | ||||
|  | ||||
|         # Skip field declarations for fields that are in the base class | ||||
| @@ -1459,8 +1488,10 @@ def find_common_fields( | ||||
|     if not messages: | ||||
|         return [] | ||||
|  | ||||
|     # Start with fields from the first message | ||||
|     first_msg_fields = {field.name: field for field in messages[0].field} | ||||
|     # Start with fields from the first message (excluding deprecated fields) | ||||
|     first_msg_fields = { | ||||
|         field.name: field for field in messages[0].field if not field.options.deprecated | ||||
|     } | ||||
|     common_fields = [] | ||||
|  | ||||
|     # Check each field to see if it exists in all messages with same type | ||||
| @@ -1471,6 +1502,9 @@ def find_common_fields( | ||||
|         for msg in messages[1:]: | ||||
|             found = False | ||||
|             for other_field in msg.field: | ||||
|                 # Skip deprecated fields | ||||
|                 if other_field.options.deprecated: | ||||
|                     continue | ||||
|                 if ( | ||||
|                     other_field.name == field_name | ||||
|                     and other_field.type == field.type | ||||
| @@ -1599,6 +1633,10 @@ def build_service_message_type( | ||||
|     message_source_map: dict[str, int], | ||||
| ) -> tuple[str, str] | None: | ||||
|     """Builds the service message type.""" | ||||
|     # Skip deprecated messages | ||||
|     if mt.options.deprecated: | ||||
|         return None | ||||
|  | ||||
|     snake = camel_to_snake(mt.name) | ||||
|     id_: int | None = get_opt(mt, pb.id) | ||||
|     if id_ is None: | ||||
| @@ -1700,12 +1738,18 @@ namespace api { | ||||
|     content += "namespace enums {\n\n" | ||||
|  | ||||
|     # Build dynamic ifdef mappings for both enums and messages | ||||
|     enum_ifdef_map, message_ifdef_map, message_source_map = build_type_usage_map(file) | ||||
|     enum_ifdef_map, message_ifdef_map, message_source_map, used_messages = ( | ||||
|         build_type_usage_map(file) | ||||
|     ) | ||||
|  | ||||
|     # Simple grouping of enums by ifdef | ||||
|     current_ifdef = None | ||||
|  | ||||
|     for enum in file.enum_type: | ||||
|         # Skip deprecated enums | ||||
|         if enum.options.deprecated: | ||||
|             continue | ||||
|  | ||||
|         s, c, dc = build_enum_type(enum, enum_ifdef_map) | ||||
|         enum_ifdef = enum_ifdef_map.get(enum.name) | ||||
|  | ||||
| @@ -1756,6 +1800,14 @@ namespace api { | ||||
|     current_ifdef = None | ||||
|  | ||||
|     for m in mt: | ||||
|         # Skip deprecated messages | ||||
|         if m.options.deprecated: | ||||
|             continue | ||||
|  | ||||
|         # Skip messages that aren't used (unless they have an ID/service message) | ||||
|         if m.name not in used_messages and not m.options.HasExtension(pb.id): | ||||
|             continue | ||||
|  | ||||
|         s, c, dc = build_message_type(m, base_class_fields, message_source_map) | ||||
|         msg_ifdef = message_ifdef_map.get(m.name) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user