Merge #364 into sdk602patch0521 from refs/changes/364/head 366/target/1
author胡传军 <1224667075@qq.com>
Sat, 22 Jun 2024 10:17:18 +0000 (10:17 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Sat, 22 Jun 2024 10:17:18 +0000 (10:17 +0000)
Code review from 胡传军

* refs/changes/364/head: (5 commits squashed)

  - 电话修改

  - Merge branch &#39;sdk602patch0521&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521

  - Merge branch &#39;sdk602patch0521&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521

  - Merge branch &#39;sdk602patch0521&#39; of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521

  - 修改产测马达使用接口 修改表盘协议BUG

Signed-off-by: aliyun8003852482 <1224667075@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/364
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.h
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h

index 043c249..3fbb94e 100644 (file)
@@ -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();
index c554bae..49bba2f 100644 (file)
@@ -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:
index 7e62f5a..1a24d0d 100644 (file)
@@ -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);
 
index ae3665f..ee6d368 100644 (file)
@@ -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);\r
 \r
         ble_set_dial_by_id(daila_type);\r
-        value[17] = 1;//校验成功\r
+\r
+        if(ble_get_dial_id()==daila_type)\r
+        {\r
+            value[17] = 1;//切换成功\r
+        }\r
+        else\r
+        {\r
+            value[17] = 3;//切换成功\r
+        }\r
+        \r
         value[18] = Calculate_CRC(value,18);\r
         sendBleData(value,19);\r
     }else\r
@@ -2588,12 +2597,12 @@ static void findWatchCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totald
 //获取sd卡剩余空间\r
 static void GetSDSpaceCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totaldata,uint8_t crcvalue)\r
 {\r
-    uint8_t value[27];\r
-    memset(value,0,27);\r
+    uint8_t value[20];\r
+    memset(value,0,20);\r
     value[0] = 0x72;\r
     value[1] = 0x01;\r
     value[2] = 0x05;\r
-    uint32_t tmp = 1;\r
+    uint32_t tmp = 2;\r
     uint16_t tmp_data = 1;\r
     memcpy(value+3,&tmp,4);\r
     memcpy(value+7,&tmp,4);\r
@@ -2605,8 +2614,8 @@ static void GetSDSpaceCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *total
         if(sdFlag == 1)// 1获取失败 2 获取成功 \r
         {\r
             value[17] = 1;//校验标志\r
-            value[18] = Calculate_CRC(value,18);\r
-            sendBleData(value,27);\r
+            value[19] = Calculate_CRC(value,19);\r
+            sendBleData(value,20);\r
         }else{\r
             value[17] = 2;//校验标志\r
             value[18] = Calculate_CRC(value,18); \r
@@ -5535,6 +5544,15 @@ static errcode_t install_dial(void)
     char *lzmaindex = strstr(lzmapkgname,".lzma");\r
     if (lzmaindex != NULL)\r
     {\r
+        struct stat info;\r
+        if (stat(DIAL_DATA_DIR, &info) != 0)\r
+        {\r
+            if (mkdir(DIAL_DATA_DIR, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0)\r
+            {\r
+                return ERRCODE_FAIL; // \r
+            }\r
+        }\r
+\r
         char dial_basename[64]={0};\r
         int dial_basenamelen =  (lzmaindex - lzmapkgname);\r
         printf("dial_basenamelen %d\n",dial_basenamelen);\r
@@ -5569,6 +5587,11 @@ static errcode_t install_dial(void)
 \r
         ble_set_dial_by_id(ble_dial_uid);\r
 \r
+        //安装完后删除表盘\r
+        printf("remove  %s\r\n",lzma_filepath);\r
+        if(0!=remove(lzma_filepath))\r
+        return ERRCODE_FAIL;\r
+\r
         if ( ret == ERRCODE_SUCC)\r
             return ERRCODE_SUCC;\r
         else\r
index 280ac82..deb09ff 100644 (file)
@@ -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数据