1 // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef ESP_EVENT_BASE_H_ 16 #define ESP_EVENT_BASE_H_ 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 // Defines for declaring and defining event base 23 #define ESP_EVENT_DECLARE_BASE(id) extern esp_event_base_t id 24 #define ESP_EVENT_DEFINE_BASE(id) esp_event_base_t id = #id 25 26 // Event loop library types 27 typedef const char* esp_event_base_t; /**< unique pointer to a subsystem that exposes events */ 28 typedef void* esp_event_loop_handle_t; /**< a number that identifies an event with respect to a base */ 29 typedef void (*esp_event_handler_t)(void* event_handler_arg, 30 esp_event_base_t event_base, 31 int32_t event_id, 32 void* event_data); /**< function called when an event is posted to the queue */ 33 typedef void* esp_event_handler_instance_t; /**< context identifying an instance of a registered event handler */ 34 35 // Defines for registering/unregistering event handlers 36 #define ESP_EVENT_ANY_BASE NULL /**< register handler for any event base */ 37 #define ESP_EVENT_ANY_ID -1 /**< register handler for any event id */ 38 39 #ifdef __cplusplus 40 } 41 #endif 42 43 #endif // #ifndef ESP_EVENT_BASE_H_ 44