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
被浏覽
1.2k
1 個回答
haoronMango
haoronMango 2022-07-02
這家夥很懶,什麼也沒寫!

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裡沒有。所以發送廣播時就醬紫。

撰寫答案

請登錄後再發布答案,點擊登錄

發布
問題

分享
好友

手機
浏覽

掃碼手機浏覽