From 2a2063a93b357f4676e358a1f06ad9125303baaa Mon Sep 17 00:00:00 2001 From: hcj_ <1224667075@qq.com> Date: Thu, 30 May 2024 13:17:13 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E6=AD=A5=E6=95=B0=E5=90=8C?= =?utf8?q?=E6=AD=A5=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../service/ble_service/blemoder/bletest.cpp | 18 +++++++++++++++--- .../service/ble_service/blemoder/bletest.h | 2 +- .../service/ble_service/bleservice/bleEvent.c | 7 ++++--- .../peripheral/cywee/src/board_yh601s.c | 14 ++++++++++++-- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index aa82c750e..865c83eef 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -58,9 +58,9 @@ extern "C" { #include "bletest.h" -#define CWM_HISTORY_DATA_PATH "/system/" +#define CWM_HISTORY_DATA_PATH "/user/userdata/step_" -char * ble_step_history(uint8_t day) +char * ble_step_history(uint8_t day,uint16_t *len) { char path_[64]={0}; char timeday[12] = {0}; @@ -70,6 +70,7 @@ char * ble_step_history(uint8_t day) FILE * fp = fopen(path_,"rb+"); if(fp==NULL) { + printf("fopen fail\r\n"); return NULL; } uint32_t size; @@ -79,11 +80,22 @@ char * ble_step_history(uint8_t day) size = ftell(fp); // 获取当前文件指针位置,即文件大小 fseek(fp, 0, SEEK_SET); // 将文件指针移回文件开头 } + printf("size %d \r\n",size); char * buf=(char *)malloc(size); + if(buf==NULL) + { + printf("malloc fail\r\n"); + return buf; + } uint32_t ret= fread(buf,1,size,fp); - printf("fread %d \r\n",ret); + printf("fread %d \r\n",ret); + for(int i=0;i