esp_event.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  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_H_
  15. #define ESP_EVENT_H_
  16. #include "esp_err.h"
  17. #include "freertos/FreeRTOS.h"
  18. #include "freertos/task.h"
  19. #include "freertos/queue.h"
  20. #include "freertos/semphr.h"
  21. #include "esp_event_base.h"
  22. // Legacy event loop not implemented on Linux target
  23. #if !CONFIG_IDF_TARGET_LINUX
  24. #include "esp_event_legacy.h"
  25. #endif
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. /// Configuration for creating event loops
  30. typedef struct {
  31. int32_t queue_size; /**< size of the event loop queue */
  32. const char *task_name; /**< name of the event loop task; if NULL,
  33. a dedicated task is not created for event loop*/
  34. UBaseType_t task_priority; /**< priority of the event loop task, ignored if task name is NULL */
  35. uint32_t task_stack_size; /**< stack size of the event loop task, ignored if task name is NULL */
  36. BaseType_t task_core_id; /**< core to which the event loop task is pinned to,
  37. ignored if task name is NULL */
  38. } esp_event_loop_args_t;
  39. /**
  40. * @brief Create a new event loop.
  41. *
  42. * @param[in] event_loop_args configuration structure for the event loop to create
  43. * @param[out] event_loop handle to the created event loop
  44. *
  45. * @return
  46. * - ESP_OK: Success
  47. * - ESP_ERR_INVALID_ARG: event_loop_args or event_loop was NULL
  48. * - ESP_ERR_NO_MEM: Cannot allocate memory for event loops list
  49. * - ESP_FAIL: Failed to create task loop
  50. * - Others: Fail
  51. */
  52. esp_err_t esp_event_loop_create(const esp_event_loop_args_t *event_loop_args, esp_event_loop_handle_t *event_loop);
  53. /**
  54. * @brief Delete an existing event loop.
  55. *
  56. * @param[in] event_loop event loop to delete, must not be NULL
  57. *
  58. * @return
  59. * - ESP_OK: Success
  60. * - Others: Fail
  61. */
  62. esp_err_t esp_event_loop_delete(esp_event_loop_handle_t event_loop);
  63. /**
  64. * @brief Create default event loop
  65. *
  66. * @return
  67. * - ESP_OK: Success
  68. * - ESP_ERR_NO_MEM: Cannot allocate memory for event loops list
  69. * - ESP_FAIL: Failed to create task loop
  70. * - Others: Fail
  71. */
  72. esp_err_t esp_event_loop_create_default(void);
  73. /**
  74. * @brief Delete the default event loop
  75. *
  76. * @return
  77. * - ESP_OK: Success
  78. * - Others: Fail
  79. */
  80. esp_err_t esp_event_loop_delete_default(void);
  81. /**
  82. * @brief Dispatch events posted to an event loop.
  83. *
  84. * This function is used to dispatch events posted to a loop with no dedicated task, i.e task name was set to NULL
  85. * in event_loop_args argument during loop creation. This function includes an argument to limit the amount of time
  86. * it runs, returning control to the caller when that time expires (or some time afterwards). There is no guarantee
  87. * that a call to this function will exit at exactly the time of expiry. There is also no guarantee that events have
  88. * been dispatched during the call, as the function might have spent all of the alloted time waiting on the event queue.
  89. * Once an event has been unqueued, however, it is guaranteed to be dispatched. This guarantee contributes to not being
  90. * able to exit exactly at time of expiry as (1) blocking on internal mutexes is necessary for dispatching the unqueued
  91. * event, and (2) during dispatch of the unqueued event there is no way to control the time occupied by handler code
  92. * execution. The guaranteed time of exit is therefore the alloted time + amount of time required to dispatch
  93. * the last unqueued event.
  94. *
  95. * In cases where waiting on the queue times out, ESP_OK is returned and not ESP_ERR_TIMEOUT, since it is
  96. * normal behavior.
  97. *
  98. * @param[in] event_loop event loop to dispatch posted events from, must not be NULL
  99. * @param[in] ticks_to_run number of ticks to run the loop
  100. *
  101. * @note encountering an unknown event that has been posted to the loop will only generate a warning, not an error.
  102. *
  103. * @return
  104. * - ESP_OK: Success
  105. * - Others: Fail
  106. */
  107. esp_err_t esp_event_loop_run(esp_event_loop_handle_t event_loop, TickType_t ticks_to_run);
  108. /**
  109. * @brief Register an event handler to the system event loop (legacy).
  110. *
  111. * @note This function is obsolete and will be deprecated soon, please use esp_event_handler_instance_register()
  112. * instead.
  113. *
  114. * This function can be used to register a handler for either: (1) specific events,
  115. * (2) all events of a certain event base, or (3) all events known by the system event loop.
  116. *
  117. * - specific events: specify exact event_base and event_id
  118. * - all events of a certain base: specify exact event_base and use ESP_EVENT_ANY_ID as the event_id
  119. * - all events known by the loop: use ESP_EVENT_ANY_BASE for event_base and ESP_EVENT_ANY_ID as the event_id
  120. *
  121. * Registering multiple handlers to events is possible. Registering a single handler to multiple events is
  122. * also possible. However, registering the same handler to the same event multiple times would cause the
  123. * previous registrations to be overwritten.
  124. *
  125. * @param[in] event_base the base id of the event to register the handler for
  126. * @param[in] event_id the id of the event to register the handler for
  127. * @param[in] event_handler the handler function which gets called when the event is dispatched
  128. * @param[in] event_handler_arg data, aside from event data, that is passed to the handler when it is called
  129. *
  130. * @note the event loop library does not maintain a copy of event_handler_arg, therefore the user should
  131. * ensure that event_handler_arg still points to a valid location by the time the handler gets called
  132. *
  133. * @return
  134. * - ESP_OK: Success
  135. * - ESP_ERR_NO_MEM: Cannot allocate memory for the handler
  136. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id
  137. * - Others: Fail
  138. */
  139. esp_err_t esp_event_handler_register(esp_event_base_t event_base,
  140. int32_t event_id,
  141. esp_event_handler_t event_handler,
  142. void *event_handler_arg);
  143. /**
  144. * @brief Register an event handler to a specific loop (legacy).
  145. *
  146. * @note This function is obsolete and will be deprecated soon, please use esp_event_handler_instance_register_with()
  147. * instead.
  148. *
  149. * This function behaves in the same manner as esp_event_handler_register, except the additional
  150. * specification of the event loop to register the handler to.
  151. *
  152. * @param[in] event_loop the event loop to register this handler function to, must not be NULL
  153. * @param[in] event_base the base id of the event to register the handler for
  154. * @param[in] event_id the id of the event to register the handler for
  155. * @param[in] event_handler the handler function which gets called when the event is dispatched
  156. * @param[in] event_handler_arg data, aside from event data, that is passed to the handler when it is called
  157. *
  158. * @note the event loop library does not maintain a copy of event_handler_arg, therefore the user should
  159. * ensure that event_handler_arg still points to a valid location by the time the handler gets called
  160. *
  161. * @return
  162. * - ESP_OK: Success
  163. * - ESP_ERR_NO_MEM: Cannot allocate memory for the handler
  164. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id
  165. * - Others: Fail
  166. */
  167. esp_err_t esp_event_handler_register_with(esp_event_loop_handle_t event_loop,
  168. esp_event_base_t event_base,
  169. int32_t event_id,
  170. esp_event_handler_t event_handler,
  171. void *event_handler_arg);
  172. /**
  173. * @brief Register an instance of event handler to a specific loop.
  174. *
  175. * This function can be used to register a handler for either: (1) specific events,
  176. * (2) all events of a certain event base, or (3) all events known by the system event loop.
  177. *
  178. * - specific events: specify exact event_base and event_id
  179. * - all events of a certain base: specify exact event_base and use ESP_EVENT_ANY_ID as the event_id
  180. * - all events known by the loop: use ESP_EVENT_ANY_BASE for event_base and ESP_EVENT_ANY_ID as the event_id
  181. *
  182. * Besides the error, the function returns an instance object as output parameter to identify each registration.
  183. * This is necessary to remove (unregister) the registration before the event loop is deleted.
  184. *
  185. * Registering multiple handlers to events, registering a single handler to multiple events as well as registering
  186. * the same handler to the same event multiple times is possible.
  187. * Each registration yields a distinct instance object which identifies it over the registration
  188. * lifetime.
  189. *
  190. * @param[in] event_loop the event loop to register this handler function to, must not be NULL
  191. * @param[in] event_base the base id of the event to register the handler for
  192. * @param[in] event_id the id of the event to register the handler for
  193. * @param[in] event_handler the handler function which gets called when the event is dispatched
  194. * @param[in] event_handler_arg data, aside from event data, that is passed to the handler when it is called
  195. * @param[out] instance An event handler instance object related to the registered event handler and data, can be NULL.
  196. * This needs to be kept if the specific callback instance should be unregistered before deleting the whole
  197. * event loop. Registering the same event handler multiple times is possible and yields distinct instance
  198. * objects. The data can be the same for all registrations.
  199. * If no unregistration is needed but the handler should be deleted when the event loop is deleted,
  200. * instance can be NULL.
  201. *
  202. * @note the event loop library does not maintain a copy of event_handler_arg, therefore the user should
  203. * ensure that event_handler_arg still points to a valid location by the time the handler gets called
  204. *
  205. * @return
  206. * - ESP_OK: Success
  207. * - ESP_ERR_NO_MEM: Cannot allocate memory for the handler
  208. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id or instance is NULL
  209. * - Others: Fail
  210. */
  211. esp_err_t esp_event_handler_instance_register_with(esp_event_loop_handle_t event_loop,
  212. esp_event_base_t event_base,
  213. int32_t event_id,
  214. esp_event_handler_t event_handler,
  215. void *event_handler_arg,
  216. esp_event_handler_instance_t *instance);
  217. /**
  218. * @brief Register an instance of event handler to the default loop.
  219. *
  220. * This function does the same as esp_event_handler_instance_register_with, except that it registers the
  221. * handler to the default event loop.
  222. *
  223. * @param[in] event_base the base id of the event to register the handler for
  224. * @param[in] event_id the id of the event to register the handler for
  225. * @param[in] event_handler the handler function which gets called when the event is dispatched
  226. * @param[in] event_handler_arg data, aside from event data, that is passed to the handler when it is called
  227. * @param[out] instance An event handler instance object related to the registered event handler and data, can be NULL.
  228. * This needs to be kept if the specific callback instance should be unregistered before deleting the whole
  229. * event loop. Registering the same event handler multiple times is possible and yields distinct instance
  230. * objects. The data can be the same for all registrations.
  231. * If no unregistration is needed but the handler should be deleted when the event loop is deleted,
  232. * instance can be NULL.
  233. *
  234. * @note the event loop library does not maintain a copy of event_handler_arg, therefore the user should
  235. * ensure that event_handler_arg still points to a valid location by the time the handler gets called
  236. *
  237. * @return
  238. * - ESP_OK: Success
  239. * - ESP_ERR_NO_MEM: Cannot allocate memory for the handler
  240. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id or instance is NULL
  241. * - Others: Fail
  242. */
  243. esp_err_t esp_event_handler_instance_register(esp_event_base_t event_base,
  244. int32_t event_id,
  245. esp_event_handler_t event_handler,
  246. void *event_handler_arg,
  247. esp_event_handler_instance_t *instance);
  248. /**
  249. * @brief Unregister a handler with the system event loop (legacy).
  250. *
  251. * @note This function is obsolete and will be deprecated soon, please use esp_event_handler_instance_unregister()
  252. * instead.
  253. *
  254. * Unregisters a handler so it will no longer be called during dispatch.
  255. * Handlers can be unregistered for any combination of event_base and event_id which were previously registered.
  256. * To unregister a handler, the event_base and event_id arguments must match exactly the arguments passed to
  257. * esp_event_handler_register() when that handler was registered. Passing ESP_EVENT_ANY_BASE and/or ESP_EVENT_ANY_ID
  258. * will only unregister handlers that were registered with the same wildcard arguments.
  259. *
  260. * @note When using ESP_EVENT_ANY_ID, handlers registered to specific event IDs using the same base will not be
  261. * unregistered. When using ESP_EVENT_ANY_BASE, events registered to specific bases will also not be
  262. * unregistered. This avoids accidental unregistration of handlers registered by other users or components.
  263. *
  264. * @param[in] event_base the base of the event with which to unregister the handler
  265. * @param[in] event_id the id of the event with which to unregister the handler
  266. * @param[in] event_handler the handler to unregister
  267. *
  268. * @return ESP_OK success
  269. * @return ESP_ERR_INVALID_ARG invalid combination of event base and event id
  270. * @return others fail
  271. */
  272. esp_err_t esp_event_handler_unregister(esp_event_base_t event_base,
  273. int32_t event_id,
  274. esp_event_handler_t event_handler);
  275. /**
  276. * @brief Unregister a handler from a specific event loop (legacy).
  277. *
  278. * @note This function is obsolete and will be deprecated soon, please use esp_event_handler_instance_unregister_with()
  279. * instead.
  280. *
  281. * This function behaves in the same manner as esp_event_handler_unregister, except the additional specification of
  282. * the event loop to unregister the handler with.
  283. *
  284. * @param[in] event_loop the event loop with which to unregister this handler function, must not be NULL
  285. * @param[in] event_base the base of the event with which to unregister the handler
  286. * @param[in] event_id the id of the event with which to unregister the handler
  287. * @param[in] event_handler the handler to unregister
  288. *
  289. * @return
  290. * - ESP_OK: Success
  291. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id
  292. * - Others: Fail
  293. */
  294. esp_err_t esp_event_handler_unregister_with(esp_event_loop_handle_t event_loop,
  295. esp_event_base_t event_base,
  296. int32_t event_id,
  297. esp_event_handler_t event_handler);
  298. /**
  299. * @brief Unregister a handler instance from a specific event loop.
  300. *
  301. * Unregisters a handler instance so it will no longer be called during dispatch.
  302. * Handler instances can be unregistered for any combination of event_base and event_id which were previously
  303. * registered. To unregister a handler instance, the event_base and event_id arguments must match exactly the
  304. * arguments passed to esp_event_handler_instance_register() when that handler instance was registered.
  305. * Passing ESP_EVENT_ANY_BASE and/or ESP_EVENT_ANY_ID will only unregister handler instances that were registered
  306. * with the same wildcard arguments.
  307. *
  308. * @note When using ESP_EVENT_ANY_ID, handlers registered to specific event IDs using the same base will not be
  309. * unregistered. When using ESP_EVENT_ANY_BASE, events registered to specific bases will also not be
  310. * unregistered. This avoids accidental unregistration of handlers registered by other users or components.
  311. *
  312. * @param[in] event_loop the event loop with which to unregister this handler function, must not be NULL
  313. * @param[in] event_base the base of the event with which to unregister the handler
  314. * @param[in] event_id the id of the event with which to unregister the handler
  315. * @param[in] instance the instance object of the registration to be unregistered
  316. *
  317. * @return
  318. * - ESP_OK: Success
  319. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id
  320. * - Others: Fail
  321. */
  322. esp_err_t esp_event_handler_instance_unregister_with(esp_event_loop_handle_t event_loop,
  323. esp_event_base_t event_base,
  324. int32_t event_id,
  325. esp_event_handler_instance_t instance);
  326. /**
  327. * @brief Unregister a handler from the system event loop.
  328. *
  329. * This function does the same as esp_event_handler_instance_unregister_with, except that it unregisters the
  330. * handler instance from the default event loop.
  331. *
  332. * @param[in] event_base the base of the event with which to unregister the handler
  333. * @param[in] event_id the id of the event with which to unregister the handler
  334. * @param[in] instance the instance object of the registration to be unregistered
  335. *
  336. * @return
  337. * - ESP_OK: Success
  338. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id
  339. * - Others: Fail
  340. */
  341. esp_err_t esp_event_handler_instance_unregister(esp_event_base_t event_base,
  342. int32_t event_id,
  343. esp_event_handler_instance_t instance);
  344. /**
  345. * @brief Posts an event to the system default event loop. The event loop library keeps a copy of event_data and manages
  346. * the copy's lifetime automatically (allocation + deletion); this ensures that the data the
  347. * handler recieves is always valid.
  348. *
  349. * @param[in] event_base the event base that identifies the event
  350. * @param[in] event_id the event id that identifies the event
  351. * @param[in] event_data the data, specific to the event occurence, that gets passed to the handler
  352. * @param[in] event_data_size the size of the event data
  353. * @param[in] ticks_to_wait number of ticks to block on a full event queue
  354. *
  355. * @return
  356. * - ESP_OK: Success
  357. * - ESP_ERR_TIMEOUT: Time to wait for event queue to unblock expired,
  358. * queue full when posting from ISR
  359. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id
  360. * - Others: Fail
  361. */
  362. esp_err_t esp_event_post(esp_event_base_t event_base,
  363. int32_t event_id,
  364. void *event_data,
  365. size_t event_data_size,
  366. TickType_t ticks_to_wait);
  367. /**
  368. * @brief Posts an event to the specified event loop. The event loop library keeps a copy of event_data and manages
  369. * the copy's lifetime automatically (allocation + deletion); this ensures that the data the
  370. * handler recieves is always valid.
  371. *
  372. * This function behaves in the same manner as esp_event_post_to, except the additional specification of the event loop
  373. * to post the event to.
  374. *
  375. * @param[in] event_loop the event loop to post to, must not be NULL
  376. * @param[in] event_base the event base that identifies the event
  377. * @param[in] event_id the event id that identifies the event
  378. * @param[in] event_data the data, specific to the event occurence, that gets passed to the handler
  379. * @param[in] event_data_size the size of the event data
  380. * @param[in] ticks_to_wait number of ticks to block on a full event queue
  381. *
  382. * @return
  383. * - ESP_OK: Success
  384. * - ESP_ERR_TIMEOUT: Time to wait for event queue to unblock expired,
  385. * queue full when posting from ISR
  386. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id
  387. * - Others: Fail
  388. */
  389. esp_err_t esp_event_post_to(esp_event_loop_handle_t event_loop,
  390. esp_event_base_t event_base,
  391. int32_t event_id,
  392. void *event_data,
  393. size_t event_data_size,
  394. TickType_t ticks_to_wait);
  395. #if CONFIG_ESP_EVENT_POST_FROM_ISR
  396. /**
  397. * @brief Special variant of esp_event_post for posting events from interrupt handlers.
  398. *
  399. * @param[in] event_base the event base that identifies the event
  400. * @param[in] event_id the event id that identifies the event
  401. * @param[in] event_data the data, specific to the event occurence, that gets passed to the handler
  402. * @param[in] event_data_size the size of the event data; max is 4 bytes
  403. * @param[out] task_unblocked an optional parameter (can be NULL) which indicates that an event task with
  404. * higher priority than currently running task has been unblocked by the posted event;
  405. * a context switch should be requested before the interrupt is existed.
  406. *
  407. * @note this function is only available when CONFIG_ESP_EVENT_POST_FROM_ISR is enabled
  408. * @note when this function is called from an interrupt handler placed in IRAM, this function should
  409. * be placed in IRAM as well by enabling CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR
  410. *
  411. * @return
  412. * - ESP_OK: Success
  413. * - ESP_FAIL: Event queue for the default event loop full
  414. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id,
  415. * data size of more than 4 bytes
  416. * - Others: Fail
  417. */
  418. esp_err_t esp_event_isr_post(esp_event_base_t event_base,
  419. int32_t event_id,
  420. void *event_data,
  421. size_t event_data_size,
  422. BaseType_t *task_unblocked);
  423. /**
  424. * @brief Special variant of esp_event_post_to for posting events from interrupt handlers
  425. *
  426. * @param[in] event_loop the event loop to post to, must not be NULL
  427. * @param[in] event_base the event base that identifies the event
  428. * @param[in] event_id the event id that identifies the event
  429. * @param[in] event_data the data, specific to the event occurence, that gets passed to the handler
  430. * @param[in] event_data_size the size of the event data
  431. * @param[out] task_unblocked an optional parameter (can be NULL) which indicates that an event task with
  432. * higher priority than currently running task has been unblocked by the posted event;
  433. * a context switch should be requested before the interrupt is existed.
  434. *
  435. * @note this function is only available when CONFIG_ESP_EVENT_POST_FROM_ISR is enabled
  436. * @note when this function is called from an interrupt handler placed in IRAM, this function should
  437. * be placed in IRAM as well by enabling CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR
  438. *
  439. * @return
  440. * - ESP_OK: Success
  441. * - ESP_FAIL: Event queue for the loop full
  442. * - ESP_ERR_INVALID_ARG: Invalid combination of event base and event id,
  443. * data size of more than 4 bytes
  444. * - Others: Fail
  445. */
  446. esp_err_t esp_event_isr_post_to(esp_event_loop_handle_t event_loop,
  447. esp_event_base_t event_base,
  448. int32_t event_id,
  449. void *event_data,
  450. size_t event_data_size,
  451. BaseType_t *task_unblocked);
  452. #endif
  453. /**
  454. * @brief Dumps statistics of all event loops.
  455. *
  456. * Dumps event loop info in the format:
  457. *
  458. @verbatim
  459. event loop
  460. handler
  461. handler
  462. ...
  463. event loop
  464. handler
  465. handler
  466. ...
  467. where:
  468. event loop
  469. format: address,name rx:total_recieved dr:total_dropped
  470. where:
  471. address - memory address of the event loop
  472. name - name of the event loop, 'none' if no dedicated task
  473. total_recieved - number of successfully posted events
  474. total_dropped - number of events unsuccessfully posted due to queue being full
  475. handler
  476. format: address ev:base,id inv:total_invoked run:total_runtime
  477. where:
  478. address - address of the handler function
  479. base,id - the event specified by event base and id this handler executes
  480. total_invoked - number of times this handler has been invoked
  481. total_runtime - total amount of time used for invoking this handler
  482. @endverbatim
  483. *
  484. * @param[in] file the file stream to output to
  485. *
  486. * @note this function is a noop when CONFIG_ESP_EVENT_LOOP_PROFILING is disabled
  487. *
  488. * @return
  489. * - ESP_OK: Success
  490. * - ESP_ERR_NO_MEM: Cannot allocate memory for event loops list
  491. * - Others: Fail
  492. */
  493. esp_err_t esp_event_dump(FILE *file);
  494. #ifdef __cplusplus
  495. } // extern "C"
  496. #endif
  497. #endif // #ifndef ESP_EVENT_H_