From c4665925642c9e7ecb0f7fdbde4f5a6da3333ec7 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 5 Oct 2024 14:22:11 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD=E5=9B=A0ble?= =?utf8?q?=E8=BF=9E=E6=8E=A5=E4=B8=8D=E7=A8=B3=E5=AE=9A=E5=AF=BC=E8=87=B4?= =?utf8?q?=E7=9A=84=E5=B9=BF=E6=92=AD=E8=AF=AF=E5=85=B3=EF=BC=8C=E6=97=A0?= =?utf8?q?=E6=B3=95=E9=87=8D=E6=96=B0=E5=BC=80=E5=90=AF=E5=B9=BF=E6=92=AD?= =?utf8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E9=87=8D=E8=BF=9E=E5=A4=B1=E8=B4=A5?= =?utf8?q?=EF=BC=88=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/bleservice/bleService.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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); + } + } } -- 2.17.1