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 {
56 
57 
61 typedef struct
62 {
63  bool is_success;
65 
66 
70 typedef struct
71 {
72  union
73  {
75  }param;
77 
81 typedef struct
82 {
83  uint32_t evt_id;
84 
85  union
86  {
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
MISC Event IDs. IDs that uniquely identify an event.
Definition: bt.h:52
void(* bt_event_handler)(bt_evt_t *)
Event handler Event handler, passed in Bt_Init function.
Definition: bt.h:98
ble_misc_evt_t misc_evt
MISC event structure.
Definition: bt.h:87
Event structure.
Definition: ble_sm.h:165
void BT_Init(bt_event_handler handler)
Initialize BT.
Event structure for BT_MISC_EVENT_INITED.
Definition: bt.h:61
Event for BT Initailized.
Definition: bt.h:54
ble_gatt_evt_t gatt_evt
GATT event structure.
Definition: bt.h:90
void BT_InitEx(bt_event_handler handler, void *cdata, uint32_t log_level)
Initialize BT with controller specific data.
void BT_Log_Enable(uint32_t log_level)
BT log enable/disable.
All event structure.
Definition: bt.h:81
ble_sm_evt_t sm_evt
SM event structure.
Definition: bt.h:89
GATT event structure.
Definition: ble_gatt_client.h:267
ble_gap_evt_t gap_evt
GAP event structure.
Definition: bt.h:88
void BT_Loop(void)
BT main Loop.
bt_init_evt_t inited
BT_MISC_EVENT_INITED event structure.
Definition: bt.h:74
MISC event.
Definition: bt_constants.h:42
GAP event structure.
Definition: ble_gap.h:696
uint32_t evt_id
Event ID.
Definition: bt.h:83
uint32_t BT_Pending_TxCnt(void)
BT Pending TX Data Query how manay data (In bytes) is not send out.
void BT_InitEx2(bt_event_handler handler, void *cdata[], uint8_t count, uint32_t log_level)
Initialize BT with controller specific data.
MISC event structure.
Definition: bt.h:70
void BT_Pause_Tx(bool is_pause)
Pause BT TX data transmit.