STM32WB55 获取蓝牙链接过程协商的MTU值

1、
app_conf.h修改配置宏 设备默认支持的MTU数值

/**
 * Maximum supported ATT_MTU size
 */
#define CFG_BLE_MAX_ATT_MTU             (250)

调用aci_gatt_exchange_config这个api可以产生mtu交互事件。

/**
  * @brief Perform an ATT MTU exchange procedure.
When the ATT MTU exchange procedure is completed, a @ref aci_att_exchange_mtu_resp_event
event is generated. A @ref aci_gatt_proc_complete_event event is also generated
to indicate the end of the procedure.
  * @param Connection_Handle Connection handle for which the command is given.
  * Values:
  - 0x0000 ... 0x0EFF
  * @retval Value indicating success or error code.
*/
tBleStatus aci_gatt_exchange_config(uint16_t Connection_Handle);

把它放在链接事件回调
在这里插入图片描述
2、添加mtu事件的回调

case EVT_BLUE_ATT_EXCHANGE_MTU_RESP:
{
	aci_att_exchange_mtu_resp_event_rp0 * exchange_mtu_resp;
	APP_DBG_MSG("EVT_BLUE_ATT_EXCHANGE_MTU_RESP \n");					
    exchange_mtu_resp = (aci_att_exchange_mtu_resp_event_rp0 *)blue_evt->data;
    APP_DBG_MSG("MTU_size = %d \n",exchange_mtu_resp->Server_RX_MTU );
}
	break;

在这里插入图片描述

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值