Merge remote-tracking branch 'upstream/devirtualize-api-dispatch' into integration

This commit is contained in:
J. Nick Koston
2026-03-20 21:11:11 -10:00
2 changed files with 12 additions and 11 deletions
+12
View File
@@ -59,6 +59,18 @@ class APIConnection final : public APIServerConnectionBase {
// compiler can devirtualize and inline on_* handler calls within this class.
void read_message(uint32_t msg_size, uint32_t msg_type, const uint8_t *msg_data) override;
// Auth helpers defined here (not in ProtoService) so the compiler can
// devirtualize is_connection_setup()/on_no_setup_connection() calls
// within this final class.
inline bool check_connection_setup_() {
if (!this->is_connection_setup()) {
this->on_no_setup_connection();
return false;
}
return true;
}
inline bool check_authenticated_() { return this->check_connection_setup_(); }
public:
bool send_list_info_done() {
return this->schedule_message_(nullptr, ListEntitiesDoneResponse::MESSAGE_TYPE,
-11
View File
@@ -730,17 +730,6 @@ class ProtoService {
virtual void on_no_setup_connection() = 0;
virtual bool send_buffer(ProtoWriteBuffer buffer, uint8_t message_type) = 0;
virtual void read_message(uint32_t msg_size, uint32_t msg_type, const uint8_t *msg_data) = 0;
// Authentication helper methods
inline bool check_connection_setup_() {
if (!this->is_connection_setup()) {
this->on_no_setup_connection();
return false;
}
return true;
}
inline bool check_authenticated_() { return this->check_connection_setup_(); }
};
} // namespace esphome::api