1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 08:41:59 +00:00
This commit is contained in:
J. Nick Koston
2026-01-12 17:10:21 -10:00
parent 26ed3d24c1
commit 6e82606419
3 changed files with 67 additions and 65 deletions

View File

@@ -11,9 +11,9 @@ static const char *const TAG = "api.service";
void APIServerConnectionBase::log_send_message_(const char *name, const char *dump) {
ESP_LOGVV(TAG, "send_message %s: %s", name, dump);
}
void APIServerConnectionBase::log_receive_message_(const char *name, const ProtoMessage &msg) {
void APIServerConnectionBase::log_receive_message_(const LogString *name, const ProtoMessage &msg) {
DumpBuffer dump_buf;
ESP_LOGVV(TAG, "%s: %s", name, msg.dump_to(dump_buf));
ESP_LOGVV(TAG, "%s: %s", LOG_STR_ARG(name), msg.dump_to(dump_buf));
}
#endif
@@ -23,7 +23,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
HelloRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_hello_request", msg);
this->log_receive_message_(LOG_STR("on_hello_request"), msg);
#endif
this->on_hello_request(msg);
break;
@@ -32,7 +32,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
DisconnectRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_disconnect_request", msg);
this->log_receive_message_(LOG_STR("on_disconnect_request"), msg);
#endif
this->on_disconnect_request(msg);
break;
@@ -41,7 +41,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
DisconnectResponse msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_disconnect_response", msg);
this->log_receive_message_(LOG_STR("on_disconnect_response"), msg);
#endif
this->on_disconnect_response(msg);
break;
@@ -50,7 +50,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
PingRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_ping_request", msg);
this->log_receive_message_(LOG_STR("on_ping_request"), msg);
#endif
this->on_ping_request(msg);
break;
@@ -59,7 +59,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
PingResponse msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_ping_response", msg);
this->log_receive_message_(LOG_STR("on_ping_response"), msg);
#endif
this->on_ping_response(msg);
break;
@@ -68,7 +68,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
DeviceInfoRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_device_info_request", msg);
this->log_receive_message_(LOG_STR("on_device_info_request"), msg);
#endif
this->on_device_info_request(msg);
break;
@@ -77,7 +77,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
ListEntitiesRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_list_entities_request", msg);
this->log_receive_message_(LOG_STR("on_list_entities_request"), msg);
#endif
this->on_list_entities_request(msg);
break;
@@ -86,7 +86,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SubscribeStatesRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_subscribe_states_request", msg);
this->log_receive_message_(LOG_STR("on_subscribe_states_request"), msg);
#endif
this->on_subscribe_states_request(msg);
break;
@@ -95,7 +95,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SubscribeLogsRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_subscribe_logs_request", msg);
this->log_receive_message_(LOG_STR("on_subscribe_logs_request"), msg);
#endif
this->on_subscribe_logs_request(msg);
break;
@@ -105,7 +105,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
CoverCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_cover_command_request", msg);
this->log_receive_message_(LOG_STR("on_cover_command_request"), msg);
#endif
this->on_cover_command_request(msg);
break;
@@ -116,7 +116,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
FanCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_fan_command_request", msg);
this->log_receive_message_(LOG_STR("on_fan_command_request"), msg);
#endif
this->on_fan_command_request(msg);
break;
@@ -127,7 +127,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
LightCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_light_command_request", msg);
this->log_receive_message_(LOG_STR("on_light_command_request"), msg);
#endif
this->on_light_command_request(msg);
break;
@@ -138,7 +138,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SwitchCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_switch_command_request", msg);
this->log_receive_message_(LOG_STR("on_switch_command_request"), msg);
#endif
this->on_switch_command_request(msg);
break;
@@ -149,7 +149,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SubscribeHomeassistantServicesRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_subscribe_homeassistant_services_request", msg);
this->log_receive_message_(LOG_STR("on_subscribe_homeassistant_services_request"), msg);
#endif
this->on_subscribe_homeassistant_services_request(msg);
break;
@@ -159,7 +159,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
GetTimeResponse msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_get_time_response", msg);
this->log_receive_message_(LOG_STR("on_get_time_response"), msg);
#endif
this->on_get_time_response(msg);
break;
@@ -169,7 +169,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SubscribeHomeAssistantStatesRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_subscribe_home_assistant_states_request", msg);
this->log_receive_message_(LOG_STR("on_subscribe_home_assistant_states_request"), msg);
#endif
this->on_subscribe_home_assistant_states_request(msg);
break;
@@ -180,7 +180,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
HomeAssistantStateResponse msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_home_assistant_state_response", msg);
this->log_receive_message_(LOG_STR("on_home_assistant_state_response"), msg);
#endif
this->on_home_assistant_state_response(msg);
break;
@@ -191,7 +191,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
ExecuteServiceRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_execute_service_request", msg);
this->log_receive_message_(LOG_STR("on_execute_service_request"), msg);
#endif
this->on_execute_service_request(msg);
break;
@@ -202,7 +202,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
CameraImageRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_camera_image_request", msg);
this->log_receive_message_(LOG_STR("on_camera_image_request"), msg);
#endif
this->on_camera_image_request(msg);
break;
@@ -213,7 +213,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
ClimateCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_climate_command_request", msg);
this->log_receive_message_(LOG_STR("on_climate_command_request"), msg);
#endif
this->on_climate_command_request(msg);
break;
@@ -224,7 +224,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
NumberCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_number_command_request", msg);
this->log_receive_message_(LOG_STR("on_number_command_request"), msg);
#endif
this->on_number_command_request(msg);
break;
@@ -235,7 +235,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SelectCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_select_command_request", msg);
this->log_receive_message_(LOG_STR("on_select_command_request"), msg);
#endif
this->on_select_command_request(msg);
break;
@@ -246,7 +246,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SirenCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_siren_command_request", msg);
this->log_receive_message_(LOG_STR("on_siren_command_request"), msg);
#endif
this->on_siren_command_request(msg);
break;
@@ -257,7 +257,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
LockCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_lock_command_request", msg);
this->log_receive_message_(LOG_STR("on_lock_command_request"), msg);
#endif
this->on_lock_command_request(msg);
break;
@@ -268,7 +268,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
ButtonCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_button_command_request", msg);
this->log_receive_message_(LOG_STR("on_button_command_request"), msg);
#endif
this->on_button_command_request(msg);
break;
@@ -279,7 +279,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
MediaPlayerCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_media_player_command_request", msg);
this->log_receive_message_(LOG_STR("on_media_player_command_request"), msg);
#endif
this->on_media_player_command_request(msg);
break;
@@ -290,7 +290,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SubscribeBluetoothLEAdvertisementsRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_subscribe_bluetooth_le_advertisements_request", msg);
this->log_receive_message_(LOG_STR("on_subscribe_bluetooth_le_advertisements_request"), msg);
#endif
this->on_subscribe_bluetooth_le_advertisements_request(msg);
break;
@@ -301,7 +301,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothDeviceRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_device_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_device_request"), msg);
#endif
this->on_bluetooth_device_request(msg);
break;
@@ -312,7 +312,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothGATTGetServicesRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_gatt_get_services_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_gatt_get_services_request"), msg);
#endif
this->on_bluetooth_gatt_get_services_request(msg);
break;
@@ -323,7 +323,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothGATTReadRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_gatt_read_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_gatt_read_request"), msg);
#endif
this->on_bluetooth_gatt_read_request(msg);
break;
@@ -334,7 +334,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothGATTWriteRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_gatt_write_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_gatt_write_request"), msg);
#endif
this->on_bluetooth_gatt_write_request(msg);
break;
@@ -345,7 +345,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothGATTReadDescriptorRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_gatt_read_descriptor_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_gatt_read_descriptor_request"), msg);
#endif
this->on_bluetooth_gatt_read_descriptor_request(msg);
break;
@@ -356,7 +356,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothGATTWriteDescriptorRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_gatt_write_descriptor_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_gatt_write_descriptor_request"), msg);
#endif
this->on_bluetooth_gatt_write_descriptor_request(msg);
break;
@@ -367,7 +367,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothGATTNotifyRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_gatt_notify_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_gatt_notify_request"), msg);
#endif
this->on_bluetooth_gatt_notify_request(msg);
break;
@@ -378,7 +378,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SubscribeBluetoothConnectionsFreeRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_subscribe_bluetooth_connections_free_request", msg);
this->log_receive_message_(LOG_STR("on_subscribe_bluetooth_connections_free_request"), msg);
#endif
this->on_subscribe_bluetooth_connections_free_request(msg);
break;
@@ -389,7 +389,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
UnsubscribeBluetoothLEAdvertisementsRequest msg;
// Empty message: no decode needed
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_unsubscribe_bluetooth_le_advertisements_request", msg);
this->log_receive_message_(LOG_STR("on_unsubscribe_bluetooth_le_advertisements_request"), msg);
#endif
this->on_unsubscribe_bluetooth_le_advertisements_request(msg);
break;
@@ -400,7 +400,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
SubscribeVoiceAssistantRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_subscribe_voice_assistant_request", msg);
this->log_receive_message_(LOG_STR("on_subscribe_voice_assistant_request"), msg);
#endif
this->on_subscribe_voice_assistant_request(msg);
break;
@@ -411,7 +411,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
VoiceAssistantResponse msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_voice_assistant_response", msg);
this->log_receive_message_(LOG_STR("on_voice_assistant_response"), msg);
#endif
this->on_voice_assistant_response(msg);
break;
@@ -422,7 +422,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
VoiceAssistantEventResponse msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_voice_assistant_event_response", msg);
this->log_receive_message_(LOG_STR("on_voice_assistant_event_response"), msg);
#endif
this->on_voice_assistant_event_response(msg);
break;
@@ -433,7 +433,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
AlarmControlPanelCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_alarm_control_panel_command_request", msg);
this->log_receive_message_(LOG_STR("on_alarm_control_panel_command_request"), msg);
#endif
this->on_alarm_control_panel_command_request(msg);
break;
@@ -444,7 +444,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
TextCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_text_command_request", msg);
this->log_receive_message_(LOG_STR("on_text_command_request"), msg);
#endif
this->on_text_command_request(msg);
break;
@@ -455,7 +455,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
DateCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_date_command_request", msg);
this->log_receive_message_(LOG_STR("on_date_command_request"), msg);
#endif
this->on_date_command_request(msg);
break;
@@ -466,7 +466,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
TimeCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_time_command_request", msg);
this->log_receive_message_(LOG_STR("on_time_command_request"), msg);
#endif
this->on_time_command_request(msg);
break;
@@ -477,7 +477,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
VoiceAssistantAudio msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_voice_assistant_audio", msg);
this->log_receive_message_(LOG_STR("on_voice_assistant_audio"), msg);
#endif
this->on_voice_assistant_audio(msg);
break;
@@ -488,7 +488,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
ValveCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_valve_command_request", msg);
this->log_receive_message_(LOG_STR("on_valve_command_request"), msg);
#endif
this->on_valve_command_request(msg);
break;
@@ -499,7 +499,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
DateTimeCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_date_time_command_request", msg);
this->log_receive_message_(LOG_STR("on_date_time_command_request"), msg);
#endif
this->on_date_time_command_request(msg);
break;
@@ -510,7 +510,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
VoiceAssistantTimerEventResponse msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_voice_assistant_timer_event_response", msg);
this->log_receive_message_(LOG_STR("on_voice_assistant_timer_event_response"), msg);
#endif
this->on_voice_assistant_timer_event_response(msg);
break;
@@ -521,7 +521,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
UpdateCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_update_command_request", msg);
this->log_receive_message_(LOG_STR("on_update_command_request"), msg);
#endif
this->on_update_command_request(msg);
break;
@@ -532,7 +532,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
VoiceAssistantAnnounceRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_voice_assistant_announce_request", msg);
this->log_receive_message_(LOG_STR("on_voice_assistant_announce_request"), msg);
#endif
this->on_voice_assistant_announce_request(msg);
break;
@@ -543,7 +543,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
VoiceAssistantConfigurationRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_voice_assistant_configuration_request", msg);
this->log_receive_message_(LOG_STR("on_voice_assistant_configuration_request"), msg);
#endif
this->on_voice_assistant_configuration_request(msg);
break;
@@ -554,7 +554,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
VoiceAssistantSetConfiguration msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_voice_assistant_set_configuration", msg);
this->log_receive_message_(LOG_STR("on_voice_assistant_set_configuration"), msg);
#endif
this->on_voice_assistant_set_configuration(msg);
break;
@@ -565,7 +565,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
NoiseEncryptionSetKeyRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_noise_encryption_set_key_request", msg);
this->log_receive_message_(LOG_STR("on_noise_encryption_set_key_request"), msg);
#endif
this->on_noise_encryption_set_key_request(msg);
break;
@@ -576,7 +576,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
BluetoothScannerSetModeRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_bluetooth_scanner_set_mode_request", msg);
this->log_receive_message_(LOG_STR("on_bluetooth_scanner_set_mode_request"), msg);
#endif
this->on_bluetooth_scanner_set_mode_request(msg);
break;
@@ -587,7 +587,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
ZWaveProxyFrame msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_z_wave_proxy_frame", msg);
this->log_receive_message_(LOG_STR("on_z_wave_proxy_frame"), msg);
#endif
this->on_z_wave_proxy_frame(msg);
break;
@@ -598,7 +598,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
ZWaveProxyRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_z_wave_proxy_request", msg);
this->log_receive_message_(LOG_STR("on_z_wave_proxy_request"), msg);
#endif
this->on_z_wave_proxy_request(msg);
break;
@@ -609,7 +609,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
HomeassistantActionResponse msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_homeassistant_action_response", msg);
this->log_receive_message_(LOG_STR("on_homeassistant_action_response"), msg);
#endif
this->on_homeassistant_action_response(msg);
break;
@@ -620,7 +620,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
WaterHeaterCommandRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_water_heater_command_request", msg);
this->log_receive_message_(LOG_STR("on_water_heater_command_request"), msg);
#endif
this->on_water_heater_command_request(msg);
break;
@@ -631,7 +631,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
InfraredRFTransmitRawTimingsRequest msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
this->log_receive_message_("on_infrared_rf_transmit_raw_timings_request", msg);
this->log_receive_message_(LOG_STR("on_infrared_rf_transmit_raw_timings_request"), msg);
#endif
this->on_infrared_rf_transmit_raw_timings_request(msg);
break;

View File

@@ -13,7 +13,7 @@ class APIServerConnectionBase : public ProtoService {
#ifdef HAS_PROTO_MESSAGE_DUMP
protected:
void log_send_message_(const char *name, const char *dump);
void log_receive_message_(const char *name, const ProtoMessage &msg);
void log_receive_message_(const LogString *name, const ProtoMessage &msg);
public:
#endif

View File

@@ -2519,7 +2519,7 @@ def build_service_message_type(
case += "// Empty message: no decode needed\n"
if log:
case += "#ifdef HAS_PROTO_MESSAGE_DUMP\n"
case += f'this->log_receive_message_("{func}", msg);\n'
case += f'this->log_receive_message_(LOG_STR("{func}"), msg);\n'
case += "#endif\n"
case += f"this->{func}(msg);\n"
case += "break;"
@@ -2845,7 +2845,9 @@ static const char *const TAG = "api.service";
hpp += "#ifdef HAS_PROTO_MESSAGE_DUMP\n"
hpp += " protected:\n"
hpp += " void log_send_message_(const char *name, const char *dump);\n"
hpp += " void log_receive_message_(const char *name, const ProtoMessage &msg);\n"
hpp += (
" void log_receive_message_(const LogString *name, const ProtoMessage &msg);\n"
)
hpp += " public:\n"
hpp += "#endif\n\n"
@@ -2865,9 +2867,9 @@ static const char *const TAG = "api.service";
)
cpp += ' ESP_LOGVV(TAG, "send_message %s: %s", name, dump);\n'
cpp += "}\n"
cpp += f"void {class_name}::log_receive_message_(const char *name, const ProtoMessage &msg) {{\n"
cpp += f"void {class_name}::log_receive_message_(const LogString *name, const ProtoMessage &msg) {{\n"
cpp += " DumpBuffer dump_buf;\n"
cpp += ' ESP_LOGVV(TAG, "%s: %s", name, msg.dump_to(dump_buf));\n'
cpp += ' ESP_LOGVV(TAG, "%s: %s", LOG_STR_ARG(name), msg.dump_to(dump_buf));\n'
cpp += "}\n"
cpp += "#endif\n\n"