mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
cleanup
This commit is contained in:
@@ -11,6 +11,10 @@ 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) {
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "%s: %s", name, msg.dump_to(dump_buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type, const uint8_t *msg_data) {
|
||||
@@ -19,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_hello_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_hello_request", msg);
|
||||
#endif
|
||||
this->on_hello_request(msg);
|
||||
break;
|
||||
@@ -29,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_disconnect_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_disconnect_request", msg);
|
||||
#endif
|
||||
this->on_disconnect_request(msg);
|
||||
break;
|
||||
@@ -39,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_disconnect_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_disconnect_response", msg);
|
||||
#endif
|
||||
this->on_disconnect_response(msg);
|
||||
break;
|
||||
@@ -49,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_ping_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_ping_request", msg);
|
||||
#endif
|
||||
this->on_ping_request(msg);
|
||||
break;
|
||||
@@ -59,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_ping_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_ping_response", msg);
|
||||
#endif
|
||||
this->on_ping_response(msg);
|
||||
break;
|
||||
@@ -69,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_device_info_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_device_info_request", msg);
|
||||
#endif
|
||||
this->on_device_info_request(msg);
|
||||
break;
|
||||
@@ -79,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_list_entities_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_list_entities_request", msg);
|
||||
#endif
|
||||
this->on_list_entities_request(msg);
|
||||
break;
|
||||
@@ -89,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_subscribe_states_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_subscribe_states_request", msg);
|
||||
#endif
|
||||
this->on_subscribe_states_request(msg);
|
||||
break;
|
||||
@@ -99,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_subscribe_logs_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_subscribe_logs_request", msg);
|
||||
#endif
|
||||
this->on_subscribe_logs_request(msg);
|
||||
break;
|
||||
@@ -110,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_cover_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_cover_command_request", msg);
|
||||
#endif
|
||||
this->on_cover_command_request(msg);
|
||||
break;
|
||||
@@ -122,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_fan_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_fan_command_request", msg);
|
||||
#endif
|
||||
this->on_fan_command_request(msg);
|
||||
break;
|
||||
@@ -134,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_light_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_light_command_request", msg);
|
||||
#endif
|
||||
this->on_light_command_request(msg);
|
||||
break;
|
||||
@@ -146,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_switch_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_switch_command_request", msg);
|
||||
#endif
|
||||
this->on_switch_command_request(msg);
|
||||
break;
|
||||
@@ -158,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_subscribe_homeassistant_services_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_subscribe_homeassistant_services_request", msg);
|
||||
#endif
|
||||
this->on_subscribe_homeassistant_services_request(msg);
|
||||
break;
|
||||
@@ -169,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_get_time_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_get_time_response", msg);
|
||||
#endif
|
||||
this->on_get_time_response(msg);
|
||||
break;
|
||||
@@ -180,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_subscribe_home_assistant_states_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_subscribe_home_assistant_states_request", msg);
|
||||
#endif
|
||||
this->on_subscribe_home_assistant_states_request(msg);
|
||||
break;
|
||||
@@ -192,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_home_assistant_state_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_home_assistant_state_response", msg);
|
||||
#endif
|
||||
this->on_home_assistant_state_response(msg);
|
||||
break;
|
||||
@@ -204,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_execute_service_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_execute_service_request", msg);
|
||||
#endif
|
||||
this->on_execute_service_request(msg);
|
||||
break;
|
||||
@@ -216,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_camera_image_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_camera_image_request", msg);
|
||||
#endif
|
||||
this->on_camera_image_request(msg);
|
||||
break;
|
||||
@@ -228,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_climate_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_climate_command_request", msg);
|
||||
#endif
|
||||
this->on_climate_command_request(msg);
|
||||
break;
|
||||
@@ -240,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_number_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_number_command_request", msg);
|
||||
#endif
|
||||
this->on_number_command_request(msg);
|
||||
break;
|
||||
@@ -252,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_select_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_select_command_request", msg);
|
||||
#endif
|
||||
this->on_select_command_request(msg);
|
||||
break;
|
||||
@@ -264,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_siren_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_siren_command_request", msg);
|
||||
#endif
|
||||
this->on_siren_command_request(msg);
|
||||
break;
|
||||
@@ -276,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_lock_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_lock_command_request", msg);
|
||||
#endif
|
||||
this->on_lock_command_request(msg);
|
||||
break;
|
||||
@@ -288,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_button_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_button_command_request", msg);
|
||||
#endif
|
||||
this->on_button_command_request(msg);
|
||||
break;
|
||||
@@ -300,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_media_player_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_media_player_command_request", msg);
|
||||
#endif
|
||||
this->on_media_player_command_request(msg);
|
||||
break;
|
||||
@@ -312,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_subscribe_bluetooth_le_advertisements_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_subscribe_bluetooth_le_advertisements_request", msg);
|
||||
#endif
|
||||
this->on_subscribe_bluetooth_le_advertisements_request(msg);
|
||||
break;
|
||||
@@ -324,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_device_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_device_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_device_request(msg);
|
||||
break;
|
||||
@@ -336,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_gatt_get_services_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_gatt_get_services_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_gatt_get_services_request(msg);
|
||||
break;
|
||||
@@ -348,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_gatt_read_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_gatt_read_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_gatt_read_request(msg);
|
||||
break;
|
||||
@@ -360,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_gatt_write_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_gatt_write_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_gatt_write_request(msg);
|
||||
break;
|
||||
@@ -372,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_gatt_read_descriptor_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_gatt_read_descriptor_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_gatt_read_descriptor_request(msg);
|
||||
break;
|
||||
@@ -384,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_gatt_write_descriptor_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_gatt_write_descriptor_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_gatt_write_descriptor_request(msg);
|
||||
break;
|
||||
@@ -396,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_gatt_notify_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_gatt_notify_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_gatt_notify_request(msg);
|
||||
break;
|
||||
@@ -408,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_subscribe_bluetooth_connections_free_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_subscribe_bluetooth_connections_free_request", msg);
|
||||
#endif
|
||||
this->on_subscribe_bluetooth_connections_free_request(msg);
|
||||
break;
|
||||
@@ -420,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_unsubscribe_bluetooth_le_advertisements_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_unsubscribe_bluetooth_le_advertisements_request", msg);
|
||||
#endif
|
||||
this->on_unsubscribe_bluetooth_le_advertisements_request(msg);
|
||||
break;
|
||||
@@ -432,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_subscribe_voice_assistant_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_subscribe_voice_assistant_request", msg);
|
||||
#endif
|
||||
this->on_subscribe_voice_assistant_request(msg);
|
||||
break;
|
||||
@@ -444,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_voice_assistant_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_voice_assistant_response", msg);
|
||||
#endif
|
||||
this->on_voice_assistant_response(msg);
|
||||
break;
|
||||
@@ -456,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_voice_assistant_event_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_voice_assistant_event_response", msg);
|
||||
#endif
|
||||
this->on_voice_assistant_event_response(msg);
|
||||
break;
|
||||
@@ -468,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_alarm_control_panel_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_alarm_control_panel_command_request", msg);
|
||||
#endif
|
||||
this->on_alarm_control_panel_command_request(msg);
|
||||
break;
|
||||
@@ -480,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_text_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_text_command_request", msg);
|
||||
#endif
|
||||
this->on_text_command_request(msg);
|
||||
break;
|
||||
@@ -492,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_date_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_date_command_request", msg);
|
||||
#endif
|
||||
this->on_date_command_request(msg);
|
||||
break;
|
||||
@@ -504,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_time_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_time_command_request", msg);
|
||||
#endif
|
||||
this->on_time_command_request(msg);
|
||||
break;
|
||||
@@ -516,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_voice_assistant_audio: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_voice_assistant_audio", msg);
|
||||
#endif
|
||||
this->on_voice_assistant_audio(msg);
|
||||
break;
|
||||
@@ -528,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_valve_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_valve_command_request", msg);
|
||||
#endif
|
||||
this->on_valve_command_request(msg);
|
||||
break;
|
||||
@@ -540,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_date_time_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_date_time_command_request", msg);
|
||||
#endif
|
||||
this->on_date_time_command_request(msg);
|
||||
break;
|
||||
@@ -552,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_voice_assistant_timer_event_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_voice_assistant_timer_event_response", msg);
|
||||
#endif
|
||||
this->on_voice_assistant_timer_event_response(msg);
|
||||
break;
|
||||
@@ -564,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_update_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_update_command_request", msg);
|
||||
#endif
|
||||
this->on_update_command_request(msg);
|
||||
break;
|
||||
@@ -576,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_voice_assistant_announce_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_voice_assistant_announce_request", msg);
|
||||
#endif
|
||||
this->on_voice_assistant_announce_request(msg);
|
||||
break;
|
||||
@@ -588,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_voice_assistant_configuration_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_voice_assistant_configuration_request", msg);
|
||||
#endif
|
||||
this->on_voice_assistant_configuration_request(msg);
|
||||
break;
|
||||
@@ -600,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_voice_assistant_set_configuration: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_voice_assistant_set_configuration", msg);
|
||||
#endif
|
||||
this->on_voice_assistant_set_configuration(msg);
|
||||
break;
|
||||
@@ -612,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_noise_encryption_set_key_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_noise_encryption_set_key_request", msg);
|
||||
#endif
|
||||
this->on_noise_encryption_set_key_request(msg);
|
||||
break;
|
||||
@@ -624,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_bluetooth_scanner_set_mode_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_bluetooth_scanner_set_mode_request", msg);
|
||||
#endif
|
||||
this->on_bluetooth_scanner_set_mode_request(msg);
|
||||
break;
|
||||
@@ -636,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_z_wave_proxy_frame: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_z_wave_proxy_frame", msg);
|
||||
#endif
|
||||
this->on_z_wave_proxy_frame(msg);
|
||||
break;
|
||||
@@ -648,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_z_wave_proxy_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_z_wave_proxy_request", msg);
|
||||
#endif
|
||||
this->on_z_wave_proxy_request(msg);
|
||||
break;
|
||||
@@ -660,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_homeassistant_action_response: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_homeassistant_action_response", msg);
|
||||
#endif
|
||||
this->on_homeassistant_action_response(msg);
|
||||
break;
|
||||
@@ -672,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_water_heater_command_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_water_heater_command_request", msg);
|
||||
#endif
|
||||
this->on_water_heater_command_request(msg);
|
||||
break;
|
||||
@@ -684,8 +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
|
||||
DumpBuffer dump_buf;
|
||||
ESP_LOGVV(TAG, "on_infrared_rf_transmit_raw_timings_request: %s", msg.dump_to(dump_buf));
|
||||
this->log_receive_message_("on_infrared_rf_transmit_raw_timings_request", msg);
|
||||
#endif
|
||||
this->on_infrared_rf_transmit_raw_timings_request(msg);
|
||||
break;
|
||||
|
||||
@@ -13,6 +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);
|
||||
|
||||
public:
|
||||
#endif
|
||||
|
||||
@@ -2519,8 +2519,7 @@ def build_service_message_type(
|
||||
case += "// Empty message: no decode needed\n"
|
||||
if log:
|
||||
case += "#ifdef HAS_PROTO_MESSAGE_DUMP\n"
|
||||
case += "DumpBuffer dump_buf;\n"
|
||||
case += f'ESP_LOGVV(TAG, "{func}: %s", msg.dump_to(dump_buf));\n'
|
||||
case += f'this->log_receive_message_("{func}", msg);\n'
|
||||
case += "#endif\n"
|
||||
case += f"this->{func}(msg);\n"
|
||||
case += "break;"
|
||||
@@ -2842,10 +2841,11 @@ static const char *const TAG = "api.service";
|
||||
hpp += f"class {class_name} : public ProtoService {{\n"
|
||||
hpp += " public:\n"
|
||||
|
||||
# Add logging helper method declaration
|
||||
# Add logging helper method declarations
|
||||
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 += " public:\n"
|
||||
hpp += "#endif\n\n"
|
||||
|
||||
@@ -2858,13 +2858,17 @@ static const char *const TAG = "api.service";
|
||||
hpp += " return this->send_message_(msg, message_type);\n"
|
||||
hpp += " }\n\n"
|
||||
|
||||
# Add logging helper method implementation to cpp
|
||||
# Add logging helper method implementations to cpp
|
||||
cpp += "#ifdef HAS_PROTO_MESSAGE_DUMP\n"
|
||||
cpp += (
|
||||
f"void {class_name}::log_send_message_(const char *name, const char *dump) {{\n"
|
||||
)
|
||||
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 += " DumpBuffer dump_buf;\n"
|
||||
cpp += ' ESP_LOGVV(TAG, "%s: %s", name, msg.dump_to(dump_buf));\n'
|
||||
cpp += "}\n"
|
||||
cpp += "#endif\n\n"
|
||||
|
||||
for mt in file.message_type:
|
||||
|
||||
Reference in New Issue
Block a user