W801 BLE和手机再次配对失败

发布于 2022-06-30 13:50:23

编译W801的固件代码(没记错是wm_sdk_w80x_20211115.zip),然后烧录固件到W801。

在串口调试助手输入:
t-bt-on
t-ble-adv(1)
蓝牙启动成功,并正常发送广播报文

手机打开蓝牙并扫描到W801。点击配对成功。

然后,手机端将配对好的W801设备删除,板子也重新上电(排除干扰)。

串口助手丽依次输入t-bt-on, t-ble-adv(1),手机端还是能扫描到W801设备。但是
点击配对时却失败,串口终端内容是这样的:

[WM_I] <0:00:01.288> adapter status = bt_state_on
[WM_I] <0:00:01.294> init base application
[WM_I] <0:00:06.968> ### tls_ble_demo_adv type=1
[WM_I] <0:00:06.974> Starting advertising
GAP procedure initiated: advertise; disc_mode=2 direct_addr_type=0 direct_addr=00:00:00:00:00:00 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=64 adv_itvl_max=64
[WM_I] <0:00:11.806> gap_event, [BLE_GAP_EVENT_CONNECT]
[WM_I] <0:00:12.068> gap_event, [BLE_GAP_EVENT_REPEAT_PAIRING]
[WM_I] <0:00:45.070> gap_event, [BLE_GAP_EVENT_DISCONNECT]

是不是这个BLE_GAP_EVENT_REPEAT_PAIRING没处理好?源码没有改动,只是编译后烧录到板子上。

查看更多

关注者
0
被浏览
79
1 个回答
haoronMango
haoronMango 2022-07-02
This guy hasn't written anything yet

OK,我们做个记录
https://github.com/h2zero/NimBLE-Arduino/issues/116

case BLE_GAP_EVENT_REPEAT_PAIRING:
    /* We already have a bond with the peer, but it is attempting to
     * establish a new secure link.  This app sacrifices security for
     * convenience: just throw away the old bond and accept the new link.
     */
    /* Delete the old bond. */
    rc = ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc);
    assert(rc == 0);
    ble_store_util_delete_peer(&desc.peer_id_addr);
    
    TLS_BT_APPL_TRACE_DEBUG("!!!BLE_GAP_EVENT_REPEAT_PAIRING\r\n");
    return BLE_GAP_REPEAT_PAIRING_RETRY;

搜索后发现,原来是要删除原来的配对信息(持久化存储)。然后再wm_ble_server_api_demo.c里是有个case处理的。但是wm_ble_gap.c里没有。所以发送广播时就酱紫。

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览