Telink TLSR8232 BLE SDK Developer Handbook
AN-19112700-E1
104
Ver.1.0.0
3.4.3.7 Exchange MTU Request, Exchange MTU Response
Please refer to Core_v5.0 (Vol 3/Part F/3.4.2.1 and 3.4.2.2)
for details about “Exchange
MTU Request
” and “Exchange MTU Response”.
As shown below, Master and Slave obtain MTU size of the other
via the “Exchange MTU
Request
” and “Exchange MTU Response” commands.
Figure 3-41 Exchange MTU Request/Exchange MTU Response
During data access process of Telink BLE Slave GATT
layer, if there’s data exceeding a
RF packet length, which involves packet assembly and disassembly in GATT layer, Slave
and Master need to exchange RX MTU size of each other in advance. Transfer of long
packet data in GATT layer can be implemented via MTU size exchange.
1) Callback function of MTU size exchange
Function prototype:
typedef
void
(*
attRxMtuSizeExchangeCommpleteCb
)(
u16
connHandle,
u16
remoteMtuSize,
u16
effectMtuSize);
The first u16 is current connection handle
, and it should be “BLS_CONN_HANDLE”
in Slave applications. The second u16 is ClientRxMTU of Master. The third is the Rx
MTU size finally used.
The API is for registerring this callback function:
void
blc_att_registerMtuSizeExchangeCb
(
attRxMtuSizeExchangeCommpleteCb
cb);
2) Processing of long Rx packet data in 5316 Slave GATT layer
5316 Slave Server Rx MTU is set as 23 by default. Actually maximum Server Rx
MTU can reach 247, i.e. 247-byte packet data on Master can be correctly re-
assembl
ed on Slave. When it’s needed to use packet re-assembly of Master in an
application, the API below should be called to modify RX size of Slave first.
ble_sts_t
blc_att_setRxMtuSize
(
u16
mtu_size);
The return values are shown as below:
ble_sts_t
Value
ERR Reason
BLE_SUCCESS
0