empty messages

This commit is contained in:
J. Nick Koston
2026-02-08 09:14:15 -06:00
parent d71f7df367
commit a7d1686cfd
3 changed files with 18 additions and 24 deletions
+12 -22
View File
@@ -15,6 +15,7 @@ void APIServerConnectionBase::log_receive_message_(const LogString *name, const
DumpBuffer dump_buf;
ESP_LOGVV(TAG, "%s: %s", LOG_STR_ARG(name), msg.dump_to(dump_buf));
}
void APIServerConnectionBase::log_receive_message_(const LogString *name) { ESP_LOGVV(TAG, "%s", LOG_STR_ARG(name)); }
#endif
void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type, const uint8_t *msg_data) {
@@ -30,56 +31,49 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
}
case DisconnectRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
DisconnectRequest msg;
this->log_receive_message_(LOG_STR("on_disconnect_request"), msg);
this->log_receive_message_(LOG_STR("on_disconnect_request"));
#endif
this->on_disconnect_request();
break;
}
case DisconnectResponse::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
DisconnectResponse msg;
this->log_receive_message_(LOG_STR("on_disconnect_response"), msg);
this->log_receive_message_(LOG_STR("on_disconnect_response"));
#endif
this->on_disconnect_response();
break;
}
case PingRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
PingRequest msg;
this->log_receive_message_(LOG_STR("on_ping_request"), msg);
this->log_receive_message_(LOG_STR("on_ping_request"));
#endif
this->on_ping_request();
break;
}
case PingResponse::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
PingResponse msg;
this->log_receive_message_(LOG_STR("on_ping_response"), msg);
this->log_receive_message_(LOG_STR("on_ping_response"));
#endif
this->on_ping_response();
break;
}
case DeviceInfoRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
DeviceInfoRequest msg;
this->log_receive_message_(LOG_STR("on_device_info_request"), msg);
this->log_receive_message_(LOG_STR("on_device_info_request"));
#endif
this->on_device_info_request();
break;
}
case ListEntitiesRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
ListEntitiesRequest msg;
this->log_receive_message_(LOG_STR("on_list_entities_request"), msg);
this->log_receive_message_(LOG_STR("on_list_entities_request"));
#endif
this->on_list_entities_request();
break;
}
case SubscribeStatesRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
SubscribeStatesRequest msg;
this->log_receive_message_(LOG_STR("on_subscribe_states_request"), msg);
this->log_receive_message_(LOG_STR("on_subscribe_states_request"));
#endif
this->on_subscribe_states_request();
break;
@@ -140,8 +134,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
#ifdef USE_API_HOMEASSISTANT_SERVICES
case SubscribeHomeassistantServicesRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
SubscribeHomeassistantServicesRequest msg;
this->log_receive_message_(LOG_STR("on_subscribe_homeassistant_services_request"), msg);
this->log_receive_message_(LOG_STR("on_subscribe_homeassistant_services_request"));
#endif
this->on_subscribe_homeassistant_services_request();
break;
@@ -159,8 +152,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
#ifdef USE_API_HOMEASSISTANT_STATES
case SubscribeHomeAssistantStatesRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
SubscribeHomeAssistantStatesRequest msg;
this->log_receive_message_(LOG_STR("on_subscribe_home_assistant_states_request"), msg);
this->log_receive_message_(LOG_STR("on_subscribe_home_assistant_states_request"));
#endif
this->on_subscribe_home_assistant_states_request();
break;
@@ -367,8 +359,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
#ifdef USE_BLUETOOTH_PROXY
case SubscribeBluetoothConnectionsFreeRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
SubscribeBluetoothConnectionsFreeRequest msg;
this->log_receive_message_(LOG_STR("on_subscribe_bluetooth_connections_free_request"), msg);
this->log_receive_message_(LOG_STR("on_subscribe_bluetooth_connections_free_request"));
#endif
this->on_subscribe_bluetooth_connections_free_request();
break;
@@ -377,8 +368,7 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
#ifdef USE_BLUETOOTH_PROXY
case UnsubscribeBluetoothLEAdvertisementsRequest::MESSAGE_TYPE: {
#ifdef HAS_PROTO_MESSAGE_DUMP
UnsubscribeBluetoothLEAdvertisementsRequest msg;
this->log_receive_message_(LOG_STR("on_unsubscribe_bluetooth_le_advertisements_request"), msg);
this->log_receive_message_(LOG_STR("on_unsubscribe_bluetooth_le_advertisements_request"));
#endif
this->on_unsubscribe_bluetooth_le_advertisements_request();
break;
+1
View File
@@ -14,6 +14,7 @@ class APIServerConnectionBase : public ProtoService {
protected:
void log_send_message_(const char *name, const char *dump);
void log_receive_message_(const LogString *name, const ProtoMessage &msg);
void log_receive_message_(const LogString *name);
public:
#endif
+5 -2
View File
@@ -2530,8 +2530,7 @@ def build_service_message_type(
case = ""
if log:
case += "#ifdef HAS_PROTO_MESSAGE_DUMP\n"
case += f"{mt.name} msg;\n"
case += f'this->log_receive_message_(LOG_STR("{func}"), msg);\n'
case += f'this->log_receive_message_(LOG_STR("{func}"));\n'
case += "#endif\n"
case += f"this->{func}();\n"
case += "break;"
@@ -2851,6 +2850,7 @@ static const char *const TAG = "api.service";
hpp += (
" void log_receive_message_(const LogString *name, const ProtoMessage &msg);\n"
)
hpp += " void log_receive_message_(const LogString *name);\n"
hpp += " public:\n"
hpp += "#endif\n\n"
@@ -2874,6 +2874,9 @@ static const char *const TAG = "api.service";
cpp += " DumpBuffer dump_buf;\n"
cpp += ' ESP_LOGVV(TAG, "%s: %s", LOG_STR_ARG(name), msg.dump_to(dump_buf));\n'
cpp += "}\n"
cpp += f"void {class_name}::log_receive_message_(const LogString *name) {{\n"
cpp += ' ESP_LOGVV(TAG, "%s", LOG_STR_ARG(name));\n'
cpp += "}\n"
cpp += "#endif\n\n"
for mt in file.message_type: