From: hcj <1224667075@qq.com> Date: Tue, 5 Nov 2024 08:43:39 +0000 (+0800) Subject: 减少ble代码中的文件路径维护 X-Git-Tag: fd230_release_V1.3.102~126^2~6 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=f65f9ce6455e492a818c1f89af6e6c0d841addd6;p=mirrors%2FFD230.git 减少ble代码中的文件路径维护 --- diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt b/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt index 06fa4e476..d506cb8c9 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt +++ b/code/sdk/application/wearable/service/ble_service/blemoder/CMakeLists.txt @@ -49,6 +49,8 @@ ${ROOT_DIR}/application/wearable/fd230app/nativeui/alipay/include # ${ROOT_DIR}/middleware/services/media/foundation/player/interfaces/kits # ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits ${ROOT_DIR}/application/wearable/fd230app/nativeui/player/include +${ROOT_DIR}/application/wearable/fd230app/nativelauncher/include + ) set(SOURCES 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 67b085f2f..021761bcd 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -48,7 +48,7 @@ #include "BluetoothModel.h" #include "MusicPlayerModel.h" #include "goal_notification.h" - +#include "UiConfig.h" // #include "AlarmClockModel.h" //#include "AlarmClockModel.h" @@ -92,6 +92,32 @@ extern "C" { #include "AlipayC.h" #include "PlayersModelC.h" +//#define APP_DOWNLOAD_DIAL_PATH "/user/dial/offline_dial" /*表盘市场安装路径*/ +#define DIAL_DATA_DIR APP_DOWNLOAD_DIAL_PATH + +// #define DIAL_DATA_DIR "/user/dial/offline_dial" + + +char * get_dial_path(void) +{ + return DIAL_DATA_DIR; +} + +errcode_t get_dial_file_path(char* input_dialname ,uint32_t input_size, char* output_file_path , uint32_t max_output_size) +{ + if(input_dialname == NULL || output_file_path == NULL) + { + return ERRCODE_FAIL; + } + + int ret = sprintf_s(output_file_path,max_output_size,"%s/%s.bin",DIAL_DATA_DIR,input_dialname); + if (ret < 0) + return ERRCODE_FAIL; + + return ERRCODE_SUCC; +} + + uint8_t get_dial_num() { @@ -2101,10 +2127,10 @@ void set_goal_other_notification(uint8_t data) p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER,data); if(data==1) { - OHOS::set_Is_shouw_falg(1,OHOS::GOAL_CALOREIE); - OHOS::set_Is_shouw_falg(1,OHOS::GOAL_STAND); - OHOS::set_Is_shouw_falg(1,OHOS::GOAL_FAT); - OHOS::set_Is_shouw_falg(1,OHOS::GOAL_DISTANCE); + OHOS::set_Is_show_flag(1,OHOS::GOAL_CALOREIE); + OHOS::set_Is_show_flag(1,OHOS::GOAL_STAND); + OHOS::set_Is_show_flag(1,OHOS::GOAL_FAT); + OHOS::set_Is_show_flag(1,OHOS::GOAL_DISTANCE); } @@ -2119,7 +2145,7 @@ void set_goal_step_notification(uint8_t data) p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEP,data); if(data==1) { - OHOS::set_Is_shouw_falg(1,OHOS::GOAL_STEP); + OHOS::set_Is_show_flag(1,OHOS::GOAL_STEP); } SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0); 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 26d0c4ef5..95c071aaa 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -409,6 +409,11 @@ void test_paly(uint8_t falg); bool ble_is_Alipay_bind(void); +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); + #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 c3573a8c2..d0edf1230 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -45,6 +45,7 @@ extern "C" { #include "bleANCS.h" #include "Bluetooyhpabpserver.h" + #define DEBUG_TEST (0) #define CRC_CHECK_ERR 0 //crc校验失败 #define JSON_CHECK_OK 1 //json解析成功 @@ -223,19 +224,8 @@ static errcode_t get_custom_dial_file_path(uint16_t id,char *filename,uint32_t i return ERRCODE_SUCC; } -static errcode_t get_dial_file_path(char* input_dialname ,uint32_t input_size, char* output_file_path , uint32_t max_output_size) -{ - if(input_dialname == NULL || output_file_path == NULL) - { - return ERRCODE_FAIL; - } - int ret = sprintf_s(output_file_path,max_output_size,"/user/dial/offline_dial/%s.bin",input_dialname); - if (ret < 0) - return ERRCODE_FAIL; - return ERRCODE_SUCC; -} int char_to_dec(char ch) @@ -7387,9 +7377,9 @@ static errcode_t install_dial(void) if (lzmaindex != NULL) { struct stat info; - if (stat(DIAL_DATA_DIR, &info) != 0) + if (stat(get_dial_path(), &info) != 0) { - if (mkdir(DIAL_DATA_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) + if (mkdir(get_dial_path(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) { return ERRCODE_FAIL; // } @@ -7490,7 +7480,7 @@ bool Read_tar_file_buf_send_Data(uint16_t pack_size,uint8_t id) uint32_t pack_id=1; if(fp==NULL) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"fopen fail %s\r\n",file_name); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"fopen fail %s\r\n",file_name); free(data); return false; } @@ -7501,7 +7491,7 @@ bool Read_tar_file_buf_send_Data(uint16_t pack_size,uint8_t id) read_size=fread(data,1,pack_size,fp); if(read_size!=0) { - ble_data_type type_={0x05,id,read_size,pack,pack_id}; + ble_data_type type_={0x05,id,file_size,pack,pack_id}; send_big_data(type_,(char *)data,read_size); } diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index 9f607d4b3..800b1ca9c 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -10,11 +10,12 @@ extern "C" { #include "errcode.h" #include "bts_def.h" // #include "bletest.h" + #define PHONE_WATCH_CONFIG_PATH "/user/userdata/phone_watch.json" #define ALARM_DATA_CONFIG_PATH "/user/userdata/alarm_test.json" #define ANCS_DATA_CONFIG_DIR "/user/userdata/message" -#define DIAL_DATA_DIR "/user/dial/offline_dial" + #define ANCS_DATA_CJSON_PATH "/user/userdata/message/ancs.json" //消息文件可以任意更改