From 09cb8111b0a304780d59ace20dd8cc77a66ae720 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 27 Jun 2024 15:09:04 +0800 Subject: [PATCH] =?utf8?q?=E4=B8=B4=E6=97=B6=E8=A7=A3=E5=86=B3BLE=E5=9B=A0?= =?utf8?q?=E6=B6=88=E6=81=AFflag=E4=B8=8D=E5=9B=9E=E6=B6=88=E6=81=AF?= =?utf8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/bleservice/bleEvent.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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 775257982..075b798bc 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -4723,7 +4723,7 @@ uint32_t EACH_DATA_LEN=0;//每种数据类型的的长度 void Read_JSON_file_buf_send_bin_Data(uint8_t day, uint8_t num,uint16_t id,char *data_item) { - sendbigDataBufState = true;//分包同步数据不允许打断 + char *buf=NULL; const char *path=NULL; uint8_t timeBit = 4;//默认是4个字节的时间戳 @@ -4756,7 +4756,7 @@ void Read_JSON_file_buf_send_bin_Data(uint8_t day, uint8_t num,uint16_t id,char printf("打开文件失败 %s \r\n",path); if(path) { - free(path); + ym_free(path); path = NULL; } @@ -4775,12 +4775,10 @@ void Read_JSON_file_buf_send_bin_Data(uint8_t day, uint8_t num,uint16_t id,char fclose(fp); if(path) { - free(path); + ym_free(path); path = NULL; } cJSON *heart_data=cJSON_Parse(buf); - ym_free(buf); - printf("读文件\r\n"); if(heart_data==NULL) { @@ -4851,6 +4849,9 @@ void Read_JSON_file_buf_send_bin_Data(uint8_t day, uint8_t num,uint16_t id,char ym_free(send_buf); send_buf = NULL; } + + sendbigDataBufState=false; + cJSON_Delete(heart_data); } @@ -4927,6 +4928,7 @@ void readDevDataBle(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u memcpy(sendBuf+3,&totaldata_pack,4);//总的数据包 memcpy(sendBuf+7,&totaldata_packlen,4);//总的数据包长度 memcpy(sendBuf+11,&pack_count,4);//分包索引号 + memcpy(sendBuf+15,&pack_datalen,2);//分包数据长度 if(Check_CRC(data,len,crcvalue)) @@ -4934,6 +4936,8 @@ 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) { case 0x40://同步心率历史数据 @@ -5032,6 +5036,7 @@ void readDevDataBle(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,u default: break; } + sendbigDataBufState = false;//分包同步数据不允许打断 //sendReadData(); }else{ sendBuf[18] = 0; @@ -6475,7 +6480,7 @@ void bleDataRecv(uint8_t *totalData, uint16_t event_size,uint16_t handle) } if(sendbigDataBufState == true)//正在发送大数据不接收任何app指令下发的数据 { - printf("sendbigDataBufState :(%d) ",sendbigDataBufState); + printf("sendbigDataBufState :(%d)",sendbigDataBufState); return; } printf("bleDataRecv handle:%d\r\n",handle); @@ -6514,7 +6519,7 @@ void bleDataRecv(uint8_t *totalData, uint16_t event_size,uint16_t handle) void free_ble_data(void)//以防断开蓝牙没有释放数据类型 { - return; + totalpack = 0; muiltFlag = 0; packdataLen = 0; @@ -6522,6 +6527,7 @@ void free_ble_data(void)//以防断开蓝牙没有释放数据类型 ANCSBigBufFlag = 0; recvBigDataBufState = false; sendbigDataBufState = false; + return; } -- 2.17.1