Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
80
Ver.1.0.0
The Tx power configured by this API is valid for both adv packets and conn packets, and
it can be set anywhere in the firmware. The actual Tx power is subject to the latest
setting.
3.2.8.12 bls_ll_terminateConnection
ble_sts_t
bls_ll_terminateConnection
(
u8
reason);
This API applies to BLE Slave device.
In order to actively terminate connection, this API can be invoked by APP Layer to send a
“Terminate” to Master in Link Layer.
“reason” indicates the specified reason for
disconnection and it corresponds to the “ble_sts_t” defined in “ble_common.h”. Please
refer to
Core_v5.0
(Vol 2/Part D/2
“Error Code Descriptions”).
If connection is not terminated due to system operation abnormity, generally APP layer
specifies the “reason” as:
HCI_ERR_REMOTE_USER_TERM_CONN = 0x13
bls_ll_terminateConnection(
HCI_ERR_REMOTE_USER_TERM_CONN
);
In bottom-layer stack of Telink BLE SDK, this API is invoked only in one case to actively
terminate connection: When data packets from peer device are decrypted, if an
authentication data MIC error is detected, the
“bls_ll_terminateConnection(HCI_ERR_CONN_TERM_MIC_FAILURE)” will be called to
inform the peer device of the decryption error, and connection is terminated.
After Slave invokes this API to actively initiate disconnection, the event
“BLT_EV_FLAG_TERMINATE” will be triggered. The terminate reason in the callback
function of this event will be consistent with the reason manually configured in this API.
In Connection state Slave role, generally connection will be terminated successfully by
invoking this API; however, in some special cases, the API may fail to terminate
connection, and the error reason will be indicated by the return value “
ble_sts_t
”. It’s
recommended to check whether the return value is “BLE_SUCCESS” when this API is
invoked by APP layer.
ble_sts_t
Value
ERR Reason
BLE_SUCCESS
0
HCI_ERR_CONN_NOT_ESTAB
LISH
0x3E
Link Layer
处于非
Connection state Slave
role
Link Layer is not in Connection state Slave
role.
HCI_ERR_CONTROLLER_BUS
Y
0x3A
Controller busy (mass data are being
transferred), this command cannot be
accepted for the moment.