| Airoha M0 BLE API 1.0.5.4

bt.h
1 /******************************************************************************
2 Copyright (c) Airoha 2016 - All rights reserved
3
4 FILE NAME
5 bt.h
6 DESCRIPTION
7 NOTES
8 ********************************************************************************/
9 #ifndef __BT_HH__
10 #define __BT_HH__
11
12 #include "ble_gap.h"
13 #include "ble_sm.h"
14 #include "ble_gap_sm.h"
15 #include "ble_gatt_client.h"
16
17
28 /*************************************************************************
29 * macro
30 *************************************************************************/
37 #define BT_LOG_NONE 0x00000000
38 #define BT_LOG_HCI_CMD 0x00000001
39 #define BT_LOG_HCI_EVT 0x00000002
40 #define BT_LOG_HCI_TXDAT 0x00000004
41 #define BT_LOG_HCI_RXDAT 0x00000008
42
44 /*************************************************************************
45 * Typedef
46 *************************************************************************/
47
52 typedef enum
53 {
54 BT_MISC_EVENT_INITED = BT_EVENT_MISC,
55 }bt_misc_event_id;
56
57
61 typedef struct
62 {
63 bool is_success;
64 }bt_init_evt_t;
65
66
70 typedef struct
71 {
72 union
73 {
74 bt_init_evt_t inited;
75 }param;
76 } ble_misc_evt_t;
77
81 typedef struct
82 {
83 uint32_t evt_id;
84
85 union
86 {
87 ble_misc_evt_t misc_evt;
88 ble_gap_evt_t gap_evt;
89 ble_sm_evt_t sm_evt;
90 ble_gatt_evt_t gatt_evt;
91 } evt;
92 } bt_evt_t;
93
98 typedef void (*bt_event_handler)(bt_evt_t *);
99 /*************************************************************************
100 * API
101 *************************************************************************/
107 void BT_Init(bt_event_handler handler);
108
116 void BT_InitEx(bt_event_handler handler, void *cdata, uint32_t log_level);
117
125 void BT_InitEx2(bt_event_handler handler, void *cdata[], uint8_t count, uint32_t log_level);
126
130 void BT_Loop(void);
131
136 void BT_Log_Enable(uint32_t log_level);
137
142 uint32_t BT_Pending_TxCnt(void);
143
147 void BT_Pause_Tx(bool is_pause);
148
149
153 #endif
bt_misc_event_id
bt_misc_event_id
MISC Event IDs. IDs that uniquely identify an event.
Definition: bt.h:52
bt_event_handler
void(* bt_event_handler)(bt_evt_t *)
Event handler Event handler, passed in Bt_Init function.
Definition: bt.h:98
bt_evt_t::misc_evt
ble_misc_evt_t misc_evt
MISC event structure.
Definition: bt.h:87
ble_sm_evt_t
Event structure.
Definition: ble_sm.h:165
BT_Init
void BT_Init(bt_event_handler handler)
Initialize BT.
bt_init_evt_t
Event structure for BT_MISC_EVENT_INITED.
Definition: bt.h:61
BT_MISC_EVENT_INITED
Event for BT Initailized.
Definition: bt.h:54
bt_evt_t::gatt_evt
ble_gatt_evt_t gatt_evt
GATT event structure.
Definition: bt.h:90
BT_InitEx
void BT_InitEx(bt_event_handler handler, void *cdata, uint32_t log_level)
Initialize BT with controller specific data.
BT_Log_Enable
void BT_Log_Enable(uint32_t log_level)
BT log enable/disable.
bt_evt_t
All event structure.
Definition: bt.h:81
bt_evt_t::sm_evt
ble_sm_evt_t sm_evt
SM event structure.
Definition: bt.h:89
ble_gatt_evt_t
GATT event structure.
Definition: ble_gatt_client.h:267
bt_evt_t::gap_evt
ble_gap_evt_t gap_evt
GAP event structure.
Definition: bt.h:88
BT_Loop
void BT_Loop(void)
BT main Loop.
ble_misc_evt_t::inited
bt_init_evt_t inited
BT_MISC_EVENT_INITED event structure.
Definition: bt.h:74
BT_EVENT_MISC
MISC event.
Definition: bt_constants.h:42
ble_gap_evt_t
GAP event structure.
Definition: ble_gap.h:696
bt_evt_t::evt_id
uint32_t evt_id
Event ID.
Definition: bt.h:83
BT_Pending_TxCnt
uint32_t BT_Pending_TxCnt(void)
BT Pending TX Data Query how manay data (In bytes) is not send out.
BT_InitEx2
void BT_InitEx2(bt_event_handler handler, void *cdata[], uint8_t count, uint32_t log_level)
Initialize BT with controller specific data.
ble_misc_evt_t
MISC event structure.
Definition: bt.h:70
BT_Pause_Tx
void BT_Pause_Tx(bool is_pause)
Pause BT TX data transmit.