nextday进行睡眠数据,心率数据,血氧数据管理更新
authorCaisking <3449750381@qq.com>
Thu, 5 Sep 2024 07:18:59 +0000 (15:18 +0800)
committerCaisking <3449750381@qq.com>
Thu, 5 Sep 2024 07:18:59 +0000 (15:18 +0800)
code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp

index 1db41a7..83d589d 100644 (file)
@@ -351,6 +351,7 @@ namespace OHOS
 
     void SleepModel::UpdateSleepView()
     {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "睡眠数据更新");
         SleepControlView *p_SleepControlView = SleepControlView::GetInstance();
         if (p_SleepControlView != nullptr)
         {
index e259cdb..f8ea3db 100644 (file)
@@ -493,27 +493,35 @@ static uint8_t fall_asleep_state_num = 0;
 #endif
 
 /*NextDay*/
-void MsgCenterNotifyNextDayProc(const Topic topic, Request* req)
+void MsgCenterNotifyNextDayProc(const Topic topic, Request *req)
 {
     unused(topic);
-    unused(req);   
-
+    unused(req);
     AlarmClockModel::GetInstance()->NextDayNotify();
-#ifdef FD230
     day_timestamp = 0;
-
-    if(!ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP))
+#ifdef FD230
+    printf("******nextday is begin******\r\n");
+    /* ----------------------------------- 睡眠相关 ----------------------------------- */
+    if (!ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP))
     {
-        //未设置睡眠监控 nextday进行清除睡眠数据。
+        // 未设置睡眠监控 nextday进行清除睡眠数据。
         SleepModel::GetInstance().DeleteSleepData();
+        // 通知UI更新
+        GraphicService::GetInstance()->PostGraphicEvent(
+            std::bind(&OHOS::SleepModel::UpdateSleepView, &OHOS::SleepModel::GetInstance()));
     }
-
-    //  清空当日的心率曲线数据
-    HealthService::GetInstance()->ClearHourlyHeartRates();
-    HealthService::GetInstance()->SaveDailyHeartRate();
-
-    //午夜清除运动数据
-    do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA,NULL);
+    /* ---------------------------------- 健康数据相关 ---------------------------------- */
+    // 清空当日的心率血氧数据
+    HealthService::GetInstance()->CleanHealthData();
+    // 通知UI更新
+    GraphicService::GetInstance()->PostGraphicEvent(
+        std::bind(&OHOS::HeartModel::CleanAllData, OHOS::HeartModel::GetInstance()));
+    GraphicService::GetInstance()->PostGraphicEvent(
+        std::bind(&OHOS::BloodOxygenModel::CleanAllData, OHOS::BloodOxygenModel::GetInstance()));
+    /* --------------------------------- 每日目标相关 --------------------------------- */
+    // 午夜清除运动数据
+    do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA, NULL);
+    printf("******nextday is end******\r\n");
 #endif
 }