From: hcj <1224667075@qq.com> Date: Sat, 5 Oct 2024 06:13:35 +0000 (+0800) Subject: 修复可能因ble连接不稳定导致的广播误关,无法重新开启广播,导致重连失败 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a7e10e4dad4053f170cf6a307155d6f79a4cd097;p=mirrors%2FFD230.git 修复可能因ble连接不稳定导致的广播误关,无法重新开启广播,导致重连失败 --- diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 2a8ad5193..7e2ee1f3f 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -6160,8 +6160,6 @@ void Send_Sleep_Bin_Data(uint8_t day, uint16_t num) send_big_data(type_,NULL,0); //send_big_data(1,NULL,0,0,1,1,0x4b,1); - - sendbigDataBufState = false;//分包同步数据不允许打断 return; } @@ -6281,7 +6279,7 @@ bool Read_Health_BIN_file_buf_send_bin_Data(uint8_t day, uint16_t num,uint16_t i void Read_BIN_file_buf_send_bin_Data(uint8_t day,uint32_t pack_size,uint16_t id) { - sendbigDataBufState = true;//分包同步数据不允许打断 + const char *data=NULL; uint32_t data_len = 0; @@ -6293,7 +6291,6 @@ void Read_BIN_file_buf_send_bin_Data(uint8_t day,uint32_t pack_size,uint16_t id) send_big_data(type_,NULL,0); //send_big_data(1,NULL,0,0,1,1,id,1); - sendbigDataBufState = false;//分包同步数据不允许打断 return; } uint8_t single_data=8; @@ -6383,7 +6380,6 @@ void readDevDataBle(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u bleSendTypeID=cmd-((cmd/256)*256); // printf("同步第%d天的数据\r\n",data[0]); int num; - sendbigDataBufState = true;//分包同步数据不允许打断 switch (bleSendTypeID) { @@ -6564,7 +6560,6 @@ void readDevDataBle(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u default: break; } - sendbigDataBufState = false;//分包同步数据不允许打断 //sendReadData(); }else{ sendBuf[18] = 0; @@ -7581,7 +7576,6 @@ static uint32_t file_size=0; bool Read_tar_file_buf_send_Data(uint16_t pack_size,uint8_t id) { - sendbigDataBufState = true;//分包同步数据不允许打断 char *data= (char *)malloc(pack_size+1); uint16_t read_size=0; @@ -7595,7 +7589,6 @@ bool Read_tar_file_buf_send_Data(uint16_t pack_size,uint8_t id) { printf("fopen fail %s\r\n",file_name); free(data); - sendbigDataBufState = false; return false; } @@ -8490,12 +8483,6 @@ void bleDataRecv(uint8_t *totalData, uint16_t event_size,uint16_t handle) printf("event size (%d) is less than msg_header_t (%d) ",event_size,sizeof(msg_header_t)); // return ; } - if(sendbigDataBufState == true)//正在发送大数据不接收任何app指令下发的数据 - { - printf("sendbigDataBufState :(%d)",sendbigDataBufState); - - // return; - } #ifdef BLE_LOG printf("bleDataRecv handle:%d\r\n",handle); #endif 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 a5be1cc21..33f156b7b 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleService.c @@ -388,8 +388,6 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl ble_disconnect_ok(); - svr_ble_adv_start(); - g_ble_conn_id=0; //APP断连 @@ -399,13 +397,15 @@ void svr_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t *addr, gap_bl { ble_ancs_client_clear(conn_id); } - } else { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "其他连接断开,不做多余处理 \r\n"); } - + //如果ble连接全部断连,则需要重新开启广播 + if(!get_ble_connect()) + svr_ble_adv_start(); }