From: hcj <1224667075@qq.com> Date: Sat, 5 Oct 2024 06:22:11 +0000 (+0800) Subject: 修复可能因ble连接不稳定导致的广播误关,无法重新开启广播,导致重连失败(补 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1107%2F2;p=mirrors%2FFD230.git 修复可能因ble连接不稳定导致的广播误关,无法重新开启广播,导致重连失败(补 --- diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c index 33f156b7b..f44175549 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -397,6 +397,7 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl { ble_ancs_client_clear(conn_id); } + } else { @@ -404,8 +405,19 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "其他连接断开,不做多余处理 \r\n"); } //如果ble连接全部断连,则需要重新开启广播 + //可能因ble连接不够稳定,快速断开ble连接,无法将连接判定为app连接导致断连的时候没有正确重新开启广播 if(!get_ble_connect()) - svr_ble_adv_start(); + { + svr_ble_adv_start(); + Bleconnect = GAP_BLE_STATE_DISCONNECTED;//蓝牙已断开 + ble_disconnect_ok(); + free_ble_data(); + + if(get_ble_pair()) + { + ble_ancs_client_clear(conn_id); + } + } }