GOAL合并
authorhcj <1224667075@qq.com>
Tue, 30 Sep 2025 10:08:53 +0000 (18:08 +0800)
committerhcj <1224667075@qq.com>
Tue, 30 Sep 2025 10:08:53 +0000 (18:08 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/goal/src/goalmodel.cpp
code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/fd230/service/msg_center/src/notify/goal_notification.cpp
code/sdk/application/wearable/n9/nativeapp/nativeui/goal/src/goalmodel.cpp

index d0dffed..df272d9 100644 (file)
 #include "cywee_service.h"\r
 #endif\r
 \r
+#ifdef SUPPORT_CYWEE_SERVICE\r
+#include "cywee_data.h"\r
+#include "cywee_hal.h"\r
+#endif\r
+\r
+\r
+\r
 #ifdef SUPPORT_PPG_SERVICE\r
 #include "ppg_service.h"\r
 #endif\r
@@ -48,6 +55,9 @@
 extern "C"\r
 {\r
 #endif\r
+    #ifdef SUPPORT_CYWEE_SERVICE\r
+     void stepdataTime(void);\r
+    #endif\r
 \r
     static AlarmCtrl g_alarmCtrA;\r
     static AlarmCtrl g_alarmCtrB;\r
@@ -435,6 +445,9 @@ extern "C"
         HandleAlarmOnTime(&curTime);\r
         HandleSleepReminder(&curTime);\r
         HandleMusicUpdate();\r
+        #ifdef SUPPORT_CYWEE_SERVICE\r
+        stepdataTime();\r
+        #endif\r
 \r
         // 以下弹窗被控制\r
         if (HandleCanShowDialog())\r
@@ -492,6 +505,22 @@ extern "C"
                 std::bind(AlarmTimerEventPublish, TOPIC_EVENT_ON_TIME, unuse));\r
         }\r
     }\r
+#ifdef SUPPORT_CYWEE_SERVICE\r
+\r
+    static uint32_t last_step = 0;\r
+\r
+    void stepdataTime(void)\r
+    {   \r
+        AlarmClockEventData unuse;\r
+        uint32_t new_data = cywee_get_sport_data(STEP);\r
+        if(last_step!=new_data)\r
+        {\r
+             GraphicService::GetInstance()->PostGraphicEvent(\r
+            std::bind(AlarmTimerEventPublish, TOPIC_EVENT_STEPDATA_UPDATE, unuse));\r
+            last_step=new_data;\r
+        }\r
+    }\r
+#endif\r
 \r
     // 睡眠提醒\r
     void HandleSleepReminder(const struct tm *curTime)\r
index 931040d..d8fdfab 100644 (file)
@@ -529,7 +529,6 @@ namespace OHOS
       }
       free(date);
       return toal_data;
-      // return 0;
    }
 
 
@@ -547,7 +546,6 @@ namespace OHOS
       if(value>0)
       toal_date+=value;
       return toal_date;
-      return 0;
    }
 
    float GoalModel::show_data_calories_refresh(void)
@@ -564,7 +562,6 @@ namespace OHOS
       toal_date+=_f_value;
    
       return toal_date;
-      return 0;
    }
 
    float GoalModel::show_data_distance_refresh(void)
@@ -581,8 +578,6 @@ namespace OHOS
       toal_date+=_f_value;
    
       return toal_date;
-
-      // return 0;
    }
 
    uint32_t GoalModel::show_data_fat_refresh(void)
@@ -599,8 +594,6 @@ namespace OHOS
       toal_date+=_16_value;
    
       return toal_date;
-
-      // return 0;
    }
 
 
index 6b27f73..39208a4 100644 (file)
@@ -45,7 +45,9 @@
 #ifdef SUPPORT_CAT1_HFP_AG_SERV
 #include "phoneservice/include/PhoneAGService.h"
 #endif
-
+#include "goal/include/goalmodel.h"
+#include "goal/include/goalview.h"
+#include "goal/include/goalother.h"
 #include "ConfigModel.h"
 #include "PlayersModelC.h"
 #include "PlayersModel.h"
 
 #ifdef SUPPORT_CYWEE_SERVICE
 #include "cywee_hal.h"
+#include "cywee_data.h"
 #endif
 
 #include "cat1_pub_api.h"
+#include "uiservice/include/ui_service.h"
 
+#include "goal_notification.h"
 namespace OHOS {
 
 #ifdef __cplusplus
@@ -116,11 +121,12 @@ const PriorityMapper PRI_MAPPER[] = {
     {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO},
     {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE,PRIORITY_TWO},
     {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,PRIORITY_TWO},
-    {TOPIC_EVENT_STEPDATA_UPDATE,PRIORITY_TWO},
     {TOPIC_EVENT_INACTIVITY_UPDATE,PRIORITY_TWO},
     {TOPIC_EVENT_INACTIVITY_ACCUMULATE_TIME_UPDATE,PRIORITY_TWO},
     {TOPIC_EVENT_GOAL_SHOW_VIEW,PRIORITY_TWO},
 #endif
+    {TOPIC_EVENT_STEPDATA_UPDATE,PRIORITY_TWO},
+
 
     {TOPIC_EVENT_BLE_TRAINING,PRIORITY_TWO},
     {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE},
@@ -417,24 +423,28 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req)
     unused(req);
     AlarmClockEventData* time=(AlarmClockEventData*)req->data;
     #ifdef SUPPORT_CYWEE_SERVICE
-#if 0
+
     cywee_save_data(); //暂时没有这个函数
+
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时步数");
-    step_history_save(time->value);
+    cywee_step_history_save(time->value);
+
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时站立数据");
-    if(get_stand_falg())
-        stand_history_save(time->value);
+    if(cywee_get_stand_flag())
+    cywee_stand_history_save(time->value);
+
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时卡路里数据");
-    calories_history_save(time->value);
+    cywee_calories_history_save(time->value);
+
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
-    distances_history_save(time->value);
+    cywee_distances_history_save(time->value);
+
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "保存每小时燃脂数据");
-    fat_history_save(time->value);
+    cywee_fat_history_save(time->value);
     // 保存完增加一次读取数据
     SendMsgToUIService(UI_UPDATE_GOAL, 0, nullptr, 0);
 #endif
-    #endif
-}
+    }
 //设备绑定通知
 void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req)
 {
@@ -999,9 +1009,6 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
 }
 #endif
 
-
-
-#if 0
     //每日活动
     void MsgCenterNotifygoalnotificationviewProc(const Topic topic, Request* req)
     {
@@ -1009,24 +1016,18 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
         if (CheckPriority(topic)) {
 
             uint8_t* data=(uint8_t*)req->data;
-        #if 0
+        
             if(get_Is_show_flag(data[0]))
             {   
                 set_goal_flag_view(data[0]);
                 set_Is_show_flag(0,data[0]);
 
-                const power_display_svr_api_t *display_api = power_display_svr_get_api();
-
-                if (display_api->get_screen_state() != SCREEN_ON)
-                {
-                    display_api->turn_on_screen();
-                }
-
+                uapi_set_screen_on_api();
+                
                 NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
                 NotificationManager::GetInstance()->ShowNotify(ShowGoalNotify, static_cast<uint16_t>(topic), true);
             }
-        #endif
-        
+                
         }
     
     }
@@ -1037,27 +1038,16 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
         if (req->msgId == TOPIC_EVENT_STEPDATA_UPDATE)
         {
             
-    #ifdef SUPPORT_CYWEE_SERVICE
+            #ifdef SUPPORT_CYWEE_SERVICE
             if (req->data == nullptr) {
                 return;
             }
             // 计步数据累加
-            uint32_t counter = 0; 
-            // OHOS::ActivityModel::GetInstance()->GetStepCounter();
-            counter = *(uint32_t *)req->data;
-            set_step_data(counter);
-            counter=OHOS::GoalModel::GetInstance().show_data_step_refresh();
-            uint32_t calories= OHOS::GoalModel::GetInstance().show_data_calories_refresh();
-            float  distance= OHOS::GoalModel::GetInstance().show_data_distance_refresh();
-            // OHOS::DialModelSteps::GetInstance() ->UpdateSteps(counter);//更新表盘步数
-            // OHOS::DialModelStepgoal::GetInstance() ->UpdateStepgoal(counter);//更新表盘目标
-            // OHOS::DialModelDistance::GetInstance() ->UpdateDistance(distance);//更新表盘距离
-            // OHOS::DialModelCalorie::GetInstance() ->UpdateCalorie(calories);//更新表盘卡路里
-            // OHOS::DialModelKcalgoalStr::GetInstance() ->UpdateKcalgoalStr(calories);//更新卡路里目标值
-            // OHOS::DialModelKcalgoalValue::GetInstance() ->UpdateKcalgoalValue(calories);//更新卡路里int目标值
-            // OHOS::DialModelStepgoalStr::GetInstance() ->UpdateStepgoalStr(counter);//更新步数目标值
-            // OHOS::DialModelStepgoalValue::GetInstance() ->UpdateStepgoalValue(counter);//更新步数int目标值
-
+            
+            OHOS::GoalModel::GetInstance().show_data_step_refresh();
+            OHOS::GoalModel::GetInstance().show_data_calories_refresh();
+            OHOS::GoalModel::GetInstance().show_data_distance_refresh();
+            
             if(OHOS::GoalView::GetInstance())
             {
                 GraphicService::GetInstance()->PostGraphicEvent(
@@ -1139,6 +1129,7 @@ void MsgCenterNotifyCat1FailEProc(const Topic topic, Request* req)
 
 
     }
+#if 0
     //每日训练数据刷新
     void MsgCenterNotifyActivityProc(const Topic topic, Request* req)
     {
@@ -1513,6 +1504,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_ALARM_RING,         MsgCenterNotifyAlarmProc},
     {TOPIC_EVENT_ON_TIME,            MsgCenterNotifyONtimeProc},//增加整点保存数据
     {TOPIC_EVENT_NEXTDAY_UPDATE,     MsgCenterNotifyNextDayProc},
+    {TOPIC_EVENT_STEPDATA_UPDATE,    MsgCenterNotifystepProc},
 
     {TOPIC_EVENT_HFP_INCOMMING,      MsgCenterNotifyHfpIncomingProc},
     {TOPIC_EVENT_HFP_PHONE_ACTIVE,   MsgCenterNotifyHfpPhoneProc},
index 487ec4c..160752b 100644 (file)
@@ -124,59 +124,6 @@ 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_show_flag(uint8_t type)
     {
         switch (type)
index 931040d..b4a09ea 100644 (file)
@@ -547,7 +547,6 @@ namespace OHOS
       if(value>0)
       toal_date+=value;
       return toal_date;
-      return 0;
    }
 
    float GoalModel::show_data_calories_refresh(void)
@@ -564,7 +563,6 @@ namespace OHOS
       toal_date+=_f_value;
    
       return toal_date;
-      return 0;
    }
 
    float GoalModel::show_data_distance_refresh(void)
@@ -581,8 +579,6 @@ namespace OHOS
       toal_date+=_f_value;
    
       return toal_date;
-
-      // return 0;
    }
 
    uint32_t GoalModel::show_data_fat_refresh(void)