修改目标达成窗口
authorhcj <1224667075@qq.com>
Thu, 24 Oct 2024 06:36:44 +0000 (14:36 +0800)
committerhcj <1224667075@qq.com>
Thu, 24 Oct 2024 06:36:44 +0000 (14:36 +0800)
code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c
code/sdk/application/wearable/service/msg_center/src/notify/goal_notification.cpp

index 8f15840..ad5a450 100644 (file)
@@ -11,7 +11,7 @@
 #include "ActivityModel.h"
 #include "ConfigModel.h"
 #include "cywee_hal.h"
-
+#include "goal_notification.h"
 namespace OHOS
 {
  
@@ -25,6 +25,12 @@ namespace OHOS
 
    void GoalModel::GoalModelInitdata()
    {
+      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME),OHOS::GOAL_CALOREIE);
+      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES_TIME),OHOS::GOAL_STAND);
+      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION_TIME),OHOS::GOAL_FAT);
+      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE_TIME),OHOS::GOAL_DISTANCE);
+      OHOS::set_Is_shouw_falg(ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT_TIME),OHOS::GOAL_STEP);
+
       step_goal_show=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEP);
       other_goal_show=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_OTHER);
 
index 653ca3b..321ffbf 100644 (file)
@@ -1355,7 +1355,7 @@ void ble_set_sleep_remind(msg_get_sleep_param_info_t data)
     OHOS::ConfigModel *p_ConfigModel  =   OHOS::ConfigModel::GetInstance();
       WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"开关:%d\r\n",data.schedule);
     p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP,data.schedule);
-    if(data.schedule)
+    //if(data.schedule)
     {
           WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"开始时间:%d\r\n",data.bedtime_hour);
           WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP,"开始时间:%d\r\n",data.bedtime_min);
@@ -1969,7 +1969,6 @@ void set_goal_stepcount(uint32_t step)
     OHOS::ConfigModel *p_ConfigModel  =   OHOS::ConfigModel::GetInstance();
     
     p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT,step);
-     SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
     return ;
 }
 void set_goal_caloriescount(uint32_t kcal)
@@ -1978,7 +1977,7 @@ void set_goal_caloriescount(uint32_t kcal)
     
     p_ConfigModel->set_condigData_Int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES,kcal);
 
-    SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
+   
     return ;
 }
 void set_notify_switch(bool on)
@@ -2082,6 +2081,9 @@ void set_goal_other_notification(uint8_t data)
         OHOS::set_Is_shouw_falg(1,OHOS::GOAL_DISTANCE);
 
     }
+
+    SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
+
     return;
 }
 
@@ -2093,6 +2095,8 @@ void set_goal_step_notification(uint8_t data)
     {
         OHOS::set_Is_shouw_falg(1,OHOS::GOAL_STEP);
     }
+
+    SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
     return;
 }
 
index 7330aad..2d58e3e 100644 (file)
@@ -2049,11 +2049,15 @@ void SetsleepSetParamCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalD
        {\r
         msg_get_sleep_param_info_t sleep_info;\r
         sleep_info.schedule = data[0];\r
-        sleep_info.bedtime_hour= data[1];\r
-        sleep_info.bedtime_min= data[2];\r
-        sleep_info.waketime_hour= data[3];\r
-        sleep_info.waketime_min= data[4];\r
-        sleep_info.bedtime_alarm= data[5];\r
+        if(len>=6)\r
+        {\r
+            sleep_info.bedtime_hour= data[1];\r
+            sleep_info.bedtime_min= data[2];\r
+            sleep_info.waketime_hour= data[3];\r
+            sleep_info.waketime_min= data[4];\r
+            sleep_info.bedtime_alarm= data[5];\r
+        }\r
+      \r
         ble_set_sleep_remind(sleep_info);\r
 \r
         sendBuf[17] = 1;\r
index 8e1960a..880c9bc 100644 (file)
@@ -34,7 +34,7 @@ namespace OHOS
     static   UILabelExt *labelpre = nullptr;
     static   UILabelButtonExt *buttonok_ = nullptr;
     static   UIImageAnimatorView *imageAnimator{nullptr};
-    static const ImageInfo **winimageInfos;
+    static const ImageInfo **winimageInfos{nullptr};
     static ImageAnimatorInfo *winimageAnimatorInfo{nullptr};
     static std::string winbasePath = "/user/res/Training/training_GIF/win/";
 
@@ -100,10 +100,65 @@ namespace OHOS
 
     static uint8_t GOAL_STEP_falg=1;
 
+    // static uint8_t set_last_show_time(uint8_t type)
+    // {
+
+    //     switch (type) {
+    //         case GOAL_CALOREIE:
+    //             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES);
+    //             break;
+    //         case GOAL_FAT:
+    //             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION);
+    //             break;
+    //         case GOAL_STAND:
+    //             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES);
+    //             break;
+    //         case GOAL_DISTANCE:
+    //             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE);
+    //             break;
+    //         case GOAL_STEP:
+    //             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);;
+    //             break;
+    //     default:
+    //         break;
+    //     }
+    // }
+
+
+    // static uint8_t get_last_show_time(uint8_t type)
+    // {
+    //     uint32_t tagType =flag_goal;
+    //     switch (tagType) {
+    //         case GOAL_CALOREIE:
+    //             tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES);
+    //             tagString=std::to_string(tag)+"kcal";
+    //             break;
+    //         case GOAL_FAT:
+    //             tag =  ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION);
+    //             tagString=std::to_string(tag)+"min";
+    //             break;
+    //         case GOAL_STAND:
+    //             tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES);
+    //             tagString=std::to_string(tag)+"times";
+    //             break;
+    //         case GOAL_DISTANCE:
+    //             tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE);
+    //             tagString=std::to_string(tag)+"km";
+    //             break;
+    //         case GOAL_STEP:
+    //             tag = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);;
+    //             tagString=std::to_string(tag)+"steps";
+    //             break;
+    //     default:
+    //         break;
+    //     }
+    // }
+
     uint8_t get_Is_shouw_falg(uint8_t type)
     {
         switch (type) {
         case GOAL_CALOREIE:
+            
             return GOAL_CALOREIE_falg;
 
         case GOAL_FAT:
@@ -123,58 +178,34 @@ namespace OHOS
         }
     }
 
-   // static void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator,
-    //                          ImageAnimatorInfo *&imageAnimatorInfo,
-    //                          const ImageInfo **imageInfo, int numFrames,
-    //                          int left, int top, int width, int height,
-    //                          const char *viewId, int time) {
-    //     if (imageAnimator == nullptr) {
-    //         imageAnimator = new UIImageAnimatorView();
-    //     }
-    //     imageAnimator->SetPosition(left, top);
-    //     imageAnimator->Resize(width, height);
-    //     imageAnimator->SetViewId(viewId);
-    //     // imageAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
-    //     imageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-
-    //    // imageAnimatorInfo = new ImageAnimatorInfo[numFrames];
-    //     for (int i = 0; i < numFrames; i++) {
-    //         imageAnimatorInfo[i].imageInfo = imageInfo[i];
-    //         imageAnimatorInfo[i].pos.x = left;
-    //         imageAnimatorInfo[i].pos.y = top;
-    //         imageAnimatorInfo[i].width = width;
-    //         imageAnimatorInfo[i].height = height;
-    //         imageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO;
-    //     }
-
-    //     imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames,
-    //                                         time); // 200 is the default delay time
-    //     imageAnimator->SetTimeOfPause(time);
-    //     imageAnimator->SetRepeat(true);
-    //     }
-
 
     uint8_t set_Is_shouw_falg(uint8_t flag,uint8_t type)
     {
         switch (type) {
         case GOAL_CALOREIE:
+
             GOAL_CALOREIE_falg=flag;
+            ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES_TIME,flag);
             break;
 
         case GOAL_FAT:
             GOAL_FAT_falg=flag;
+             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION_TIME,flag);
             break;
 
         case GOAL_STAND:
             GOAL_STAND_falg=flag;
+             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES_TIME,flag);
             break;
    
         case GOAL_DISTANCE:
             GOAL_DISTANCE_falg=flag;
+             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE_TIME,flag);
             break;
      
         case GOAL_STEP:
             GOAL_STEP_falg=flag;
+             ConfigModel::GetInstance()->set_condigData_Int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT_TIME,flag);
             break;
      
         default: