From d9cf0143160bf8569442bca631e39e84ce65174c Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 26 Dec 2024 18:10:32 +0800 Subject: [PATCH] =?utf8?q?=E6=9B=B4=E6=AD=A3=E8=BF=9E=E6=8E=A5=E5=8F=82?= =?utf8?q?=E6=95=B0=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/bleservice/bleService.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 164cf1349..68bec9967 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -648,9 +648,11 @@ static uint16_t need_update_connect_param=BLE_CONNECT_INTERVAL_HIGH; static osTimerId_t ble_connect_timer=NULL; +static int8_t connect_updata_count=3; + static void ble_connect_Timer_CallBack(int data) { - if(get_ble_connect()) + if(get_ble_connect() && connect_updata_count>0) { gap_conn_param_update_t conn_param = { 0 }; conn_param.conn_handle = g_ble_conn_id; /* param 0: conn_handle */ @@ -660,6 +662,8 @@ static void ble_connect_Timer_CallBack(int data) conn_param.timeout_multiplier = 500; /* param 4: timeout_multiplier 10ms */ int ret = gap_ble_connect_param_update(&conn_param); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "触发 连接参数timer更新"); + connect_updata_count--; + } else { @@ -716,6 +720,8 @@ void uapi_ble_connect_param_update(uint16_t data) need_update_connect_param=data; + + uint32_t tick; osStatus_t retTimer; if(ble_connect_timer!=NULL) @@ -725,7 +731,7 @@ void uapi_ble_connect_param_update(uint16_t data) ble_connect_timer = NULL; } - ble_connect_timer = osTimerNew((osTimerFunc_t)ble_adv_Timer_CallBack, osTimerPeriodic, NULL, NULL); + ble_connect_timer = osTimerNew((osTimerFunc_t)ble_connect_Timer_CallBack, osTimerPeriodic, NULL, NULL); tick =osMs2Tick(3000); retTimer = osTimerStart(ble_connect_timer, tick); if (retTimer != osOK && ble_connect_timer != NULL) { @@ -734,6 +740,8 @@ void uapi_ble_connect_param_update(uint16_t data) ble_connect_timer = NULL; return; } + connect_updata_count=3; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"gap ble update connection parameters %d ret: %X\n",data,ret); } void svr_pair_result_cbt_cb(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) -- 2.17.1