mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	cleanup
This commit is contained in:
		| @@ -2,7 +2,6 @@ | |||||||
| #ifdef USE_API | #ifdef USE_API | ||||||
| #include "api_connection.h" | #include "api_connection.h" | ||||||
| #include "api_pb2.h" | #include "api_pb2.h" | ||||||
| #include "entity_iterator_macros.h" |  | ||||||
| #include "esphome/core/application.h" | #include "esphome/core/application.h" | ||||||
| #include "esphome/core/log.h" | #include "esphome/core/log.h" | ||||||
| #include "esphome/core/util.h" | #include "esphome/core/util.h" | ||||||
|   | |||||||
| @@ -9,6 +9,14 @@ namespace api { | |||||||
|  |  | ||||||
| class APIConnection; | class APIConnection; | ||||||
|  |  | ||||||
|  | // Macro for generating ListEntitiesIterator handlers | ||||||
|  | // 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); \ | ||||||
|  |   } | ||||||
|  |  | ||||||
| class ListEntitiesIterator : public ComponentIterator { | class ListEntitiesIterator : public ComponentIterator { | ||||||
|  public: |  public: | ||||||
|   ListEntitiesIterator(APIConnection *client); |   ListEntitiesIterator(APIConnection *client); | ||||||
|   | |||||||
| @@ -1,7 +1,6 @@ | |||||||
| #include "subscribe_state.h" | #include "subscribe_state.h" | ||||||
| #ifdef USE_API | #ifdef USE_API | ||||||
| #include "api_connection.h" | #include "api_connection.h" | ||||||
| #include "entity_iterator_macros.h" |  | ||||||
| #include "esphome/core/log.h" | #include "esphome/core/log.h" | ||||||
|  |  | ||||||
| namespace esphome { | namespace esphome { | ||||||
|   | |||||||
| @@ -10,6 +10,13 @@ namespace api { | |||||||
|  |  | ||||||
| class APIConnection; | class APIConnection; | ||||||
|  |  | ||||||
|  | // Macro for generating InitialStateIterator handlers | ||||||
|  | // 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); \ | ||||||
|  |   } | ||||||
|  |  | ||||||
| class InitialStateIterator : public ComponentIterator { | class InitialStateIterator : public ComponentIterator { | ||||||
|  public: |  public: | ||||||
|   InitialStateIterator(APIConnection *client); |   InitialStateIterator(APIConnection *client); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user