Flipper Zero Firmware
Loading...
Searching...
No Matches
event_dispatcher.h
1#pragma once
2
3#include <stdint.h>
4#include <core/common_defines.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10typedef enum {
11 BleEventNotAck,
12 BleEventAckFlowEnable,
13 BleEventAckFlowDisable,
14} BleEventAckStatus;
15
16typedef enum {
17 BleEventFlowDisable,
18 BleEventFlowEnable,
19} BleEventFlowStatus;
20
21/* Using other types so not to leak all the BLE stack headers
22 (we don't have a wrapper for them yet)
23 * Event data is hci_uart_pckt*
24 * Context is user-defined
25 */
26typedef BleEventAckStatus (*BleSvcEventHandlerCb)(void* event, void* context);
27
29
30/* To be called once at BLE system startup */
31void ble_event_dispatcher_init(void);
32
33/* To be called at stack reset - ensures that all handlers are unregistered */
34void ble_event_dispatcher_reset(void);
35
36BleEventFlowStatus ble_event_dispatcher_process_event(void* payload);
37
38/* Final handler for event not ack'd by services - to be implemented by app */
39BleEventFlowStatus ble_event_app_notification(void* pckt);
40
41/* Add a handler to the list of handlers */
42FURI_WARN_UNUSED GapSvcEventHandler*
43 ble_event_dispatcher_register_svc_handler(BleSvcEventHandlerCb handler, void* context);
44
45/* Remove a handler from the list of handlers */
46void ble_event_dispatcher_unregister_svc_handler(GapSvcEventHandler* handler);
47
48#ifdef __cplusplus
49}
50#endif
Definition event_dispatcher.c:8