Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
58
Ver.1.0.0
3.2.6 Controller HCI Event
Considering users may need to record and process some key actions of BLE stack
bottom layer in APP layer, 5316 BLE SDK provides two types of events: standard HCI
event defined by BLE Controller; Telink defined event.
HCI event is designed as BLE Spec standard, while Telink defined event only applies to
BLE slave (5316 ble remote/5316 module/5316 sample/5316 dual mode, etc.), which
means for BLE slaves HCI event and Telink defined event both works.
Basically the two sets of events are independent of each other, except the connect event
and disconnect event of Link Layer.
Users can select one set or use both at the same time as needed. In 5316 BLE SDK,
5316 ble remote, 5316 module, etc. use Telink defined event, while 5316 hci uses
Controller HCI event.
As the
“Host + Controller” architecture shown below, Controller HCI event reports all
events of Controller to Host via HCI.
BLE Host
HCI
BLE Controller
HCI
cmd
Host
data
Controller
data
HCI
event
Figure 3-13 HCI Event
For the definition of Controller HCI event, please refer to
Core_v5.0
(Vol 2/Part E/7.7
“Events”). “LE Meta Event” in 7.7.65 refers to HCI LE (low energy) Event, while others
are common HCI events. As defined in the Spec, 5316 BLE SDK also divides Controller
HCI event into two types: HCI Event and HCI LE event. Since 5316 BLE SDK focuses on
BLE, it supports most HCI LE events and only a few basic HCI events.
For the definition of macros and interfaces related to Controller HCI event, please refer to
head files under “proj_lib/ble/hci”.
To receive Controller HCI event in Host or APP layer, users should register callback
function of Controller HCI event, and then enable mask of corresponding event.
Following are callback function prototype and register interface of Controller HCI event:
typedef
int
(*
hci_event_handler_t
) (
u32
h,
u8
*para,
int
n);
void
blc_hci_registerControllerEventHandler
(
hci_event_handler_t
handler);
In the callback function prototype,
“u32 h” is a mark which is used frequently in bottom-
layer stack, and users only need to know the following:
#define
HCI_FLAG_EVENT_TLK_MODULE
(1<<24)