要实现peripheral从机主动申请更新MTU
在蓝牙连接成功后我就调用
GATT_UpdateMTU(connectionHandle, mtuSize);
也成功产生了ATT_MTU_UPDATED_EVENT事件,可以根据我的mtuSize来设置MTU,但是我的APP端就获取不到服务UUID那些了,断开连接还可以正常
void autoUpdateMTU(void)
{
uint16_t connectionHandle = NULL;
uint16_t mtuSize = 30;
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connectionHandle);
myLog("peripheral","processStateChangeEvt=>GATT_ExchangeMTU:%d %d \r\n",
GAPROLE_CONNHANDLE,
GATT_UpdateMTU(connectionHandle, mtuSize));
}
调用
// If RTOS queue is not empty, process app message.
if (events & SBP_QUEUE_EVT)
{
while (!Queue_empty(appMsgQueue))
{
sbpEvt_t *pMsg = (sbpEvt_t *)Util_dequeueMsg(appMsgQueue);
if (pMsg)
{
// Process message.
SimplePeripheral_processAppMsg(pMsg);
// Free the space from the message.
ICall_free(pMsg);
if(toUpdateMTU){
toUpdateMTU = 0;
autoUpdateMTU();
}
}
}
}