Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
64
Ver.1.0.0
The two methods to implement Telink defined event is mutually exclusive. It is
recommended to use the first one “independent registration” as most SDKs use this one.
Only 5316 module
uses the second one “shared event entry”.
For the usage of Telink defined event, please see the demo code of project
“5316_ble_remote” for method 1 “independent registration”; please see the demo code of
project
“5316_module” for method 2 “shared event entry”.
The implementation of the two methods are shown below by taking connect event
callback and terminate event callback for example.
1) M
ethod 1 “independent registration”
void task_connect (u8 e, u8 *p, int n)
{
//add connect callback code here.
}
void task_terminate (u8 e, u8 *p, int n)
{
//add terminate callback code here.
}
bls_app_registerEventCallback (BLT_EV_FLAG_CONNECT,
&task_connect);
bls_app_registerEventCallback(BLT_EV_FLAG_TERMINATE,
&ble_remote_terminate);
2) Method 2
“shared event entry”
int
controller_event_handler
(
u32
h,
u8
*para,
int
n)
{
if
((h&HCI_FLAG_EVENT_TLK_MODULE)!= 0)
//module event
{
switch
(event)
{
case
BLT_EV_FLAG_CONNECT:
{
bls_l2cap_requestConnParamUpdate (8, 12, 99, 400);
spp_send_data(HCI_FLAG_EVENT_TLK_MODULE, pEvt);
}
break
;
case
BLT_EV_FLAG_TERMINATE: