From d5e44193da2b6db0a886c418f920ce92193fd132 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Tue, 15 Jul 2025 11:29:26 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E7=B4=A7=E6=80=A5=E7=94=B5?= =?utf8?q?=E8=AF=9D=E4=B8=8D=E8=87=AA=E5=8A=A8=E6=8C=82=E6=96=AD=20?= =?utf8?q?=E5=8F=8AGPS=E5=8D=8F=E8=AE=AE=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/traing/include/TraingModel.h | 4 +- .../service/ble_service/blemoder/bletest.cpp | 61 ++++++++++++ .../service/ble_service/blemoder/bletest.h | 5 + .../service/ble_service/bleservice/bleEvent.c | 95 ++++++++++++++++++- .../src/notify/makephone_notification.cpp | 8 +- .../slip/cat1Service/cat1_server.cpp | 3 +- 6 files changed, 170 insertions(+), 6 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h index 38b2b10de..d34311b2d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h @@ -247,11 +247,11 @@ struct SportData { }; //经纬度结构体 -struct GPSData { +typedef struct GPSData { uint32_t timestamp; // 时间戳 double latitude; // 纬度 double longitude; // 经度 -}; +}GPSData_t; //画布点位结构体 class TraingModel { 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 573af0dc9..fdbfdcc7f 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -203,6 +203,66 @@ bool get_training_spead_path(char *path ,uint32_t time,uint32_t max_len) } +bool get_training_GPS_path(char *path ,uint32_t time,uint32_t max_len) +{ + std::string str = OHOS::TraingModel::GetInstance()->GetGPSDataPath(time); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"get_training_spead:%s\r\n",str.c_str()); + if(str.length()<=3) + { + return false; + } + memcpy_s(path,max_len,str.c_str(),str.length()); + return true; + +} + +// typedef struct GPSData { +// uint32_t timestamp; // 时间戳 +// double latitude; // 纬度 +// double longitude; // 经度 +// }GPSData_t; + +int read_GPS_DATA(char *path ,uint8_t *out_buf) +{ + FILE *fp= fopen(path,"rb+"); + uint32_t file_size=0; + + int len=0; + + OHOS::GPSData_t data={0}; + + while (1) + { + int read_size=fread(&data,1,sizeof(data),fp); + if(read_size!=sizeof(data) ) + { + len+=sizeof(data); + + int temp_data=data.timestamp; + memcpy_s(out_buf,4,&temp_data,sizeof(data.timestamp)); + + int temp_latitude=(int)(data.latitude *10000000); + memcpy_s(out_buf,4,&temp_data,sizeof(temp_latitude)); + + int temp_longitude=(int)(data.longitude*1000000); + memcpy_s(out_buf,4,&temp_data,sizeof(temp_latitude)); + + + } + else + { + break; + } + } + + fclose(fp); + + + return len; +} + + + bool get_training_heart_path(char *path ,uint32_t time,uint32_t max_len) { std::string str = OHOS::TraingModel::GetInstance()->GetHeartTablePath(time); @@ -216,6 +276,7 @@ bool get_training_heart_path(char *path ,uint32_t time,uint32_t max_len) } + void ble_sos_data_save(void) { OHOS::SOS_number_save(); diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h index cc3ee4f78..1cda30b9c 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -425,9 +425,14 @@ char * get_dial_path(void); errcode_t get_dial_file_path(char* input_dialname ,uint32_t input_size, char* output_file_path , uint32_t max_output_size); +bool get_training_GPS_path(char *path ,uint32_t time,uint32_t max_len); + + uint16_t get_str_nodisplay_number(char *str, uint32_t max_len); +int read_GPS_DATA(char *path ,uint8_t *out_buf); + #ifdef __cplusplus #if __cplusplus } 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 d56d6e275..aa8a46c42 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -3502,8 +3502,99 @@ void APP_send_sos_Cmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData void GetGPSCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData,uint8_t crcvalue) { - ble_data_type type_={0x02,0x4f,0,1,1}; - send_big_data(type_,NULL,0); + { + if(Check_CRC(data,len,crcvalue)) + { + if(len==4) + { + uint32_t timetamp=0; + memcpy_s((void*)&timetamp,4,data,4); + char path[128]={0}; + if(get_training_GPS_path(path,timetamp,128)) + { + FILE *fp= fopen(path,"rb+"); + uint32_t file_size=0; + if(fp==NULL) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"打开文件失败 %s \r\n",path); + ble_data_type type_={0x02,0x4f,0,1,1}; + send_big_data(type_,NULL,0); + return ; + } + fseek(fp, 0, SEEK_END); // 将文件指针移动到文件末尾 + file_size = ftell(fp); // 获取当前文件指针位置,即文件大小 + fseek(fp, 0, SEEK_SET); // 将文件指针移回文件开头 + fclose(fp); + + int num=(ble_nus_max_data_len-18); + if(num>482)num=482; + + char* buf = (char *)ym_malloc( file_size ); + if(buf==NULL){fclose(fp); return ;} + + int data_size= read_GPS_DATA(path,buf); + + uint32_t surplus_len=data_size; + uint32_t offset=0; + + uint32_t pack; + uint16_t pack_size=(ble_nus_max_data_len-18); + if(pack_size>482)pack_size=482; + + if(data_size%pack_size==0) + { + pack=data_size/pack_size; + } + else + { + pack=data_size/pack_size+1; + } + uint32_t pack_id=1; + while (surplus_len!=0) + { + if(surplus_len>=pack_size) + { + surplus_len=surplus_len-pack_size; + + ble_data_type type_={0x02,0x4f,data_size,pack,pack_id}; + send_big_data(type_,(char *)buf+offset,pack_size); + offset+=pack_size; + } + else + { + + ble_data_type type_={0x02,0x4f,data_size,pack,pack_id}; + send_big_data(type_,(char *)buf+offset,surplus_len); + break; + } + pack_id++; + } + + + free(buf); + + } + else + { + ble_data_type type_={0x02,0x4f,0,1,1}; + send_big_data(type_,NULL,0); + } + + } + else + { + ble_data_type type_={0x02,0x4f,0,1,1}; + send_big_data(type_,NULL,0); + } + } + else + { + ble_data_type type_={0x02,0x4f,0,1,1}; + send_big_data(type_,NULL,0); + } + + //send_big_data(1,NULL,0,0,1,1,,2); +} //send_big_data(1,NULL,0,0,1,1,0x4f,2); } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index dc25cb0b4..be1b0ba86 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -839,7 +839,13 @@ void CalldialTimerCallBackProc(int data) { if(dail_falg<=DIAL_TIME) dail_falg++; - if(dail_falg>=DIAL_TIME) + + if(dail_falg>=DIAL_TIME && + strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),"110")!=0 + && strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),"112")!=0 + && strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),"120")!=0 + && strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),"119")!=0 + && strcmp(CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),"122")!=0 ) { cat1_call_hungup_timer(); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 0c50a3eb1..6626cdb5b 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -903,7 +903,8 @@ void cat1_call_dial(char* phonenum) if (volte == true){ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"cat1_call_dial %s\n",phonenum); // #if PY_SRV_VER_CURRENT >=16 - if(g_py_ver>=16) + if(g_py_ver>=16 && strcmp(phonenum,"110")!=0 && strcmp(phonenum,"112")!=0 && strcmp(phonenum,"120")!=0 + && strcmp(phonenum,"119")!=0 && strcmp(phonenum,"122")!=0 ) { if(osTimerIsRunning(g_timer_time_Dial)==0 ) { -- 2.17.1