From 8803d889d768bf652d7c6055e971579f3593ed0a Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 22 Jun 2024 17:52:39 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E4=BA=A7=E6=B5=8B=E9=A9=AC?= =?utf8?q?=E8=BE=BE=E4=BD=BF=E7=94=A8=E6=8E=A5=E5=8F=A3=20=E4=BF=AE?= =?utf8?q?=E6=94=B9=E8=A1=A8=E7=9B=98=E5=8D=8F=E8=AE=AEBUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/producttest/src/testmotor.cpp | 26 ++++++++------ .../service/ble_service/blemoder/bletest.cpp | 4 +-- .../service/ble_service/blemoder/bletest.h | 2 +- .../service/ble_service/bleservice/bleEvent.c | 35 +++++++++++++++---- .../service/ble_service/bleservice/bleEvent.h | 2 ++ 5 files changed, 50 insertions(+), 19 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp index 043c2492c..3fbb94e7c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp @@ -6,6 +6,7 @@ #include "cmsis_os2.h" #include "dock/vibrator_manager.h" + #ifdef __cplusplus #if __cplusplus extern "C" @@ -14,6 +15,7 @@ extern "C" #endif #include "pm_veto.h" #include "pm.h" + #include "vibrator.h" #ifdef __cplusplus #if __cplusplus } @@ -120,17 +122,21 @@ namespace OHOS if(motorfalg!=true) { //开始 - VibratorFunc vibratorFunc = VibratorManager::GetInstance()->GetVibratorFunc(); - if (vibratorFunc != nullptr) - { - vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE); - //vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE); - //GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_THREE vibrator"); - // } else { - // vibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); - // //GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_TWO vibrator"); + // VibratorFunc vibratorFunc = VibratorManager::GetInstance()->GetVibratorFunc(); + // if (vibratorFunc != nullptr) + // { + // vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE); + // //vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE); + // //GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_THREE vibrator"); + // // } else { + // // vibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); + // // //GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_TWO vibrator"); + // // } // } - } + // mail.cycle_time_ms = 235; + // mail.duty = 10; + // mail.duration_time_ms = 100; + g_VibratorFunc(10,235,100); } } RootView::GetInstance()->Invalidate(); 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 c554baecf..49bba2f76 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -127,7 +127,7 @@ void ble_set_dial_by_id(uint16_t id) return OHOS::SetDialModel::GetInstance().UpdateDialSetting(id); } -uint8_t ble_get_dial_id(void) +uint16_t ble_get_dial_id(void) { return OHOS::SetDialModel::GetInstance().GetCurrentDialID(); } @@ -196,7 +196,7 @@ char * ble_sywee_history(uint8_t day,uint16_t *len ,uint8_t type) case 0x46://同步卡路里历史数据 sprintf_s(path_,64,"%s%s.bin",CWM_HISTORY_DATA_CALORIES_PATH,timeday); break; - case 0x47://同步距离历史数据 + case 0x47://同步距离历史数据 sprintf_s(path_,64,"%s%s.bin",CWM_HISTORY_DATA_DISTANCE_PATH,timeday); break; default: 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 7e62f5ac2..1a24d0da8 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -209,7 +209,7 @@ int Get_DmpChangeMode(void); //////////////////////表盘相关//////////////////////////// void ble_set_dial_by_id(uint16_t id); -uint8_t ble_get_dial_id(void); +uint16_t ble_get_dial_id(void); bool ble_is_dial_install_by_id(uint16_t id); 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 ae3665fdc..ee6d36827 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -2404,7 +2404,16 @@ static void switchDialCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total printf("switchDialCmd %d %s %d !!!!!!!!!!\r\n",daila_type,data,len); ble_set_dial_by_id(daila_type); - value[17] = 1;//校验成功 + + if(ble_get_dial_id()==daila_type) + { + value[17] = 1;//切换成功 + } + else + { + value[17] = 3;//切换成功 + } + value[18] = Calculate_CRC(value,18); sendBleData(value,19); }else @@ -2588,12 +2597,12 @@ static void findWatchCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totald //获取sd卡剩余空间 static void GetSDSpaceCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue) { - uint8_t value[27]; - memset(value,0,27); + uint8_t value[20]; + memset(value,0,20); value[0] = 0x72; value[1] = 0x01; value[2] = 0x05; - uint32_t tmp = 1; + uint32_t tmp = 2; uint16_t tmp_data = 1; memcpy(value+3,&tmp,4); memcpy(value+7,&tmp,4); @@ -2605,8 +2614,8 @@ static void GetSDSpaceCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total if(sdFlag == 1)// 1获取失败 2 获取成功 { value[17] = 1;//校验标志 - value[18] = Calculate_CRC(value,18); - sendBleData(value,27); + value[19] = Calculate_CRC(value,19); + sendBleData(value,20); }else{ value[17] = 2;//校验标志 value[18] = Calculate_CRC(value,18); @@ -5535,6 +5544,15 @@ static errcode_t install_dial(void) char *lzmaindex = strstr(lzmapkgname,".lzma"); if (lzmaindex != NULL) { + struct stat info; + if (stat(DIAL_DATA_DIR, &info) != 0) + { + if (mkdir(DIAL_DATA_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) + { + return ERRCODE_FAIL; // + } + } + char dial_basename[64]={0}; int dial_basenamelen = (lzmaindex - lzmapkgname); printf("dial_basenamelen %d\n",dial_basenamelen); @@ -5569,6 +5587,11 @@ static errcode_t install_dial(void) ble_set_dial_by_id(ble_dial_uid); + //安装完后删除表盘 + printf("remove %s\r\n",lzma_filepath); + if(0!=remove(lzma_filepath)) + return ERRCODE_FAIL; + if ( ret == ERRCODE_SUCC) return ERRCODE_SUCC; else 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 280ac824f..deb09ffef 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -13,6 +13,8 @@ extern "C" { #define ALARM_DATA_CONFIG_PATH "/user/userdata/alarm_test.json" #define ANCS_DATA_CONFIG_DIR "/user/userdata/message" +#define DIAL_DATA_DIR "/user/userdata/dial" + #define ANCS_DATA_CJSON_PATH "/user/userdata/message/ancs.json" //消息文件可以任意更改 #define READ_FLASH_DATA 0x01 //读flash数据 -- 2.17.1