mirror of
https://github.com/esphome/esphome.git
synced 2025-08-09 11:57:46 +00:00
cleanup
This commit is contained in:
parent
187cbde0db
commit
fca9befa63
@ -1,28 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/defines.h"
|
||||
#ifdef USE_API
|
||||
|
||||
namespace esphome {
|
||||
namespace api {
|
||||
|
||||
// Macro-based approach to eliminate duplication without runtime overhead
|
||||
// This generates the entity handler methods at compile time
|
||||
|
||||
// For ListEntitiesIterator - calls schedule_message_ with try_send_*_info
|
||||
#define LIST_ENTITIES_HANDLER(entity_type, EntityClass, ResponseType) \
|
||||
bool ListEntitiesIterator::on_##entity_type(EntityClass *entity) { \
|
||||
return this->client_->schedule_message_(entity, &APIConnection::try_send_##entity_type##_info, \
|
||||
ResponseType::MESSAGE_TYPE); \
|
||||
}
|
||||
|
||||
// For InitialStateIterator - calls send_*_state
|
||||
#define INITIAL_STATE_HANDLER(entity_type, EntityClass) \
|
||||
bool InitialStateIterator::on_##entity_type(EntityClass *entity) { \
|
||||
return this->client_->send_##entity_type##_state(entity); \
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
} // namespace esphome
|
||||
|
||||
#endif // USE_API
|
Loading…
x
Reference in New Issue
Block a user