esp_event_base.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef ESP_EVENT_BASE_H_
  15. #define ESP_EVENT_BASE_H_
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. // Defines for declaring and defining event base
  20. #define ESP_EVENT_DECLARE_BASE(id) extern esp_event_base_t id
  21. #define ESP_EVENT_DEFINE_BASE(id) esp_event_base_t id = #id
  22. // Event loop library types
  23. typedef const char* esp_event_base_t; /**< unique pointer to a subsystem that exposes events */
  24. typedef void* esp_event_loop_handle_t; /**< a number that identifies an event with respect to a base */
  25. typedef void (*esp_event_handler_t)(void* event_handler_arg,
  26. esp_event_base_t event_base,
  27. int32_t event_id,
  28. void* event_data); /**< function called when an event is posted to the queue */
  29. typedef void* esp_event_handler_instance_t; /**< context identifying an instance of a registered event handler */
  30. // Defines for registering/unregistering event handlers
  31. #define ESP_EVENT_ANY_BASE NULL /**< register handler for any event base */
  32. #define ESP_EVENT_ANY_ID -1 /**< register handler for any event id */
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif // #ifndef ESP_EVENT_BASE_H_