ble.h
Go to the documentation of this file.
1 
49 #ifndef __BLE_H__
50 #define __BLE_H__
51 
52 #include "ble_att.h"
53 #include "ble_error.h"
54 #include "ble_gapc.h"
55 #include "ble_gapm.h"
56 #include "ble_gatt.h"
57 #include "ble_gattc.h"
58 #include "ble_gatts.h"
59 #include "ble_l2cap.h"
60 #include "ble_prf.h"
61 #include "ble_sec.h"
62 
63 #include <stdio.h>
64 
71 typedef enum
72 {
73  BLE_RF_TX_MODE_INVALID = 0,
74  BLE_RF_TX_MODE_LP_MODE = 1,
75  BLE_RF_TX_MODE_ULP_MODE = 2,
77 
81 typedef enum
82 {
83  BLE_RF_MATCH_CIRCUIT_25OHM = 25,
84  BLE_RF_MATCH_CIRCUIT_100OHM = 100,
86 
93 typedef struct
94 {
101 
105 typedef struct
106 {
107  uint32_t *env_ret;
108  uint32_t *db_ret;
109  uint32_t *msg_ret;
110  uint32_t *non_ret;
111  uint16_t env_ret_size;
112  uint16_t db_ret_size;
113  uint16_t msg_ret_size;
114  uint16_t non_ret_size;
115  uint8_t *prf_buf;
116  uint32_t buf_size;
117  uint8_t *bm_buf;
118  uint32_t bm_size;
119  uint8_t *conn_buf;
120  uint32_t conn_size;
122 
124 typedef struct
125 {
126  void (*init)(void);
127  void (*flow_on)(void);
128  bool (*flow_off)(void);
129  void (*finish_transfers)(void);
130  void (*read)(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy);
131  void (*write)(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy);
140 typedef void (*ble_sync_evt_cb_t)(uint32_t sync_cnt, uint16_t sync_period);
153 void ble_stack_init(app_callback_t *p_app_callback, stack_heaps_table_t *p_heaps_table);
154 
163 void ble_hci_uart_register(uint8_t id, hci_uart_call_t *api);
164 
176 void ble_idle_time_notify_cb_register(void (*callback)(uint32_t hs));
177 
194 void ble_activity_start_notify_cb_register(void (*callback)(gap_activity_role_t e_role, uint8_t index));
195 
211 void ble_activity_end_notify_cb_register(void (*callback)(gap_activity_role_t e_role, uint8_t index));
212 
223 uint16_t ble_sync_source_create(uint16_t period);
224 
236 
248 uint16_t ble_sync_source_distribute(uint8_t conn_idx);
249 
257 uint16_t ble_sync_source_destroy(void);
258 
274 uint8_t ble_rf_tx_mode_set(ble_rf_tx_mode_t e_rf_tx_mode);
275 
286 
300 
312 
321 void send_signal_carrier_wave(uint8_t channel);
322 
324 #endif
325 
ble_sync_source_distribute
uint16_t ble_sync_source_distribute(uint8_t conn_idx)
Distribute sync source.
ble_sync_source_destroy
uint16_t ble_sync_source_destroy(void)
Destroy sync source.
hci_uart_call_t
The function pointers for HCI UART.
Definition: ble.h:125
ble_activity_end_notify_cb_register
void ble_activity_end_notify_cb_register(void(*callback)(gap_activity_role_t e_role, uint8_t index))
Register BLE activity end notification callback function.
ble_sync_evt_cb_register
uint16_t ble_sync_evt_cb_register(ble_sync_evt_cb_t sync_evt_cb)
Register sync event callback.
gattc_cb_fun_t
GATTC Event callback Structures.
Definition: ble_gattc.h:293
stack_heaps_table_t::prf_buf
uint8_t * prf_buf
Definition: ble.h:115
ble_sync_source_create
uint16_t ble_sync_source_create(uint16_t period)
Create sync source.
stack_heaps_table_t::msg_ret_size
uint16_t msg_ret_size
Definition: ble.h:113
app_callback_t::app_gatt_common_callback
const gatt_common_cb_fun_t * app_gatt_common_callback
Definition: ble.h:97
app_callback_t::app_gattc_callback
const gattc_cb_fun_t * app_gattc_callback
Definition: ble.h:98
ble_gatts.h
BLE GATTS API.
ble_rf_match_circuit_t
ble_rf_match_circuit_t
The resistance value (ohm) of the RF match circuit.
Definition: ble.h:82
app_ble_init_cmp_cb_t
void(* app_ble_init_cmp_cb_t)(void)
BLE initialization completed callback function for application.
Definition: ble_gapc.h:496
stack_heaps_table_t::conn_size
uint32_t conn_size
Definition: ble.h:120
stack_heaps_table_t::msg_ret
uint32_t * msg_ret
Definition: ble.h:109
ble_gatt.h
BLE GATT.
gap_activity_role_t
gap_activity_role_t
Possible roles of the activity.
Definition: ble_gapm.h:491
app_callback_t
The app callbacks for GAP, GATT, SM and L2CAP.
Definition: ble.h:94
app_callback_t::app_ble_init_cmp_callback
app_ble_init_cmp_cb_t app_ble_init_cmp_callback
Definition: ble.h:95
ble_l2cap.h
BLE L2CAP API.
ble_sec.h
BLE SEC API.
gap_cb_fun_t
The gap callback function struct.
Definition: ble_gapc.h:500
stack_heaps_table_t::bm_size
uint32_t bm_size
Definition: ble.h:118
stack_heaps_table_t::db_ret_size
uint16_t db_ret_size
Definition: ble.h:112
stack_heaps_table_t::bm_buf
uint8_t * bm_buf
Definition: ble.h:117
ble_error.h
File that contains error codes.
ble_gapc.h
BLE GAPC API.
ble_activity_start_notify_cb_register
void ble_activity_start_notify_cb_register(void(*callback)(gap_activity_role_t e_role, uint8_t index))
Register BLE activity start notification callback function.
sec_cb_fun_t
SEC register call back.
Definition: ble_sec.h:234
ble_prf.h
BLE PRF API.
ble_rf_match_circuit_get
ble_rf_match_circuit_t ble_rf_match_circuit_get(void)
Get the resistance value of the RF match circuit (unit: ohm).
stack_heaps_table_t::env_ret_size
uint16_t env_ret_size
Definition: ble.h:111
stack_heaps_table_t::buf_size
uint32_t buf_size
Definition: ble.h:116
ble_rf_match_circuit_set
void ble_rf_match_circuit_set(ble_rf_match_circuit_t e_ohm)
Set the resistance value of the RF match circuit (unit: ohm).
app_callback_t::app_sec_callback
sec_cb_fun_t * app_sec_callback
Definition: ble.h:99
ble_stack_init
void ble_stack_init(app_callback_t *p_app_callback, stack_heaps_table_t *p_heaps_table)
Initialize BEL Stack.
ble_rf_tx_mode_t
ble_rf_tx_mode_t
RF TX mode.
Definition: ble.h:72
ble_gapm.h
BLE GAPM API.
stack_heaps_table_t::conn_buf
uint8_t * conn_buf
Definition: ble.h:119
ble_rf_tx_mode_set
uint8_t ble_rf_tx_mode_set(ble_rf_tx_mode_t e_rf_tx_mode)
Change the RF TX mode of LP or ULP.
gatt_common_cb_fun_t
GATT common callback function description.
Definition: ble_gatt.h:89
ble_att.h
Attribute Protocol.
ble_idle_time_notify_cb_register
void ble_idle_time_notify_cb_register(void(*callback)(uint32_t hs))
Register BLE idle time notification callback function.
stack_heaps_table_t::non_ret_size
uint16_t non_ret_size
Definition: ble.h:114
ble_gattc.h
BLE GATTC API.
ble_rf_tx_mode_get
ble_rf_tx_mode_t ble_rf_tx_mode_get(void)
Get the RF TX mode of LP or ULP.
ble_hci_uart_register
void ble_hci_uart_register(uint8_t id, hci_uart_call_t *api)
Register UART instance for HCI.
ble_sync_evt_cb_t
void(* ble_sync_evt_cb_t)(uint32_t sync_cnt, uint16_t sync_period)
The BLE sync event callback.
Definition: ble.h:140
stack_heaps_table_t::non_ret
uint32_t * non_ret
Definition: ble.h:110
stack_heaps_table_t::env_ret
uint32_t * env_ret
Definition: ble.h:107
stack_heaps_table_t::db_ret
uint32_t * db_ret
Definition: ble.h:108
app_callback_t::app_gap_callbacks
gap_cb_fun_t * app_gap_callbacks
Definition: ble.h:96
stack_heaps_table_t
The table contains the pointers to four arrays which are used as heap memory by BLE stack in ROM....
Definition: ble.h:106
send_signal_carrier_wave
void send_signal_carrier_wave(uint8_t channel)
Generate a signal carrier wave.