修改获取站立次数
authorhcj <1224667075@qq.com>
Wed, 16 Oct 2024 13:10:00 +0000 (21:10 +0800)
committerhcj <1224667075@qq.com>
Wed, 16 Oct 2024 13:10:00 +0000 (21:10 +0800)
code/sdk/application/wearable/fd230app/nativeui/goal/include/goalmodel.h
code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp

index 6719cc7..2c99a71 100644 (file)
@@ -67,6 +67,8 @@ namespace OHOS
         uint32_t calories=0;
         uint32_t stand=0;
 
+        uint32_t standdata_now=0;
+
         uint8_t step_goal_show=0;
         uint8_t other_goal_show=0;
 
index a4fc280..8f15840 100644 (file)
@@ -33,6 +33,8 @@ namespace OHOS
       fat=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION);
       calories=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES);
       stand=ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES);
+
+      standdata_now=get_now_stand_count();
    }
 
 
@@ -147,11 +149,11 @@ namespace OHOS
 
    bool GoalModel::is_goal_stand_done()
    {
-      int standdata_now = get_now_stand_count();
+      int standdata_now_ = standdata_now+get_stand_falg();
 
       int standdata_goal = stand;
 
-      if(standdata_now>=standdata_goal)
+      if(standdata_now_>=standdata_goal)
        return true;
       else
       return false;
@@ -194,7 +196,7 @@ namespace OHOS
    char standnewstr[20];
    char *GoalModel::getstandnew()
    {
-      int standdata = get_now_stand_count();
+      int standdata =  standdata_now+get_stand_falg();
 
       memset((void *)standnewstr, 0, 20);
       sprintf_s(standnewstr, 20, "%d", standdata);
index d7b623d..cdfac10 100644 (file)
@@ -73,6 +73,7 @@
 #include "main/include/PullUpDownView.h"
 #include "player/include/PlayersModelC.h"
 
+#include "ui_service.h"
 #define DIALDATASET 1
 //#include "Systemupgrade.h"
 namespace OHOS {
@@ -361,7 +362,14 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req)
    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时步数");
    step_history_save();
    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据");
+    if(get_stand_falg())
+   {
         stand_history_save();
+        SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
+   }
+    
+  
+    
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
    calories_history_save();
    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");