优化心率卡片刷新睡眠数据 1370/1 1370/head 1371/target/1 1372/target/1 1373/target/1
authorpenglei <1624952103@qq.com>
Fri, 8 Nov 2024 04:27:24 +0000 (12:27 +0800)
committerpenglei <1624952103@qq.com>
Fri, 8 Nov 2024 04:27:24 +0000 (12:27 +0800)
code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp
code/sdk/drivers/peripheral/cywee/src/main_dml.c

index 00215d8..4936f4d 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: penglei 1624952103@qq.com
  * @Date: SLEPPNOTIFY24-06-26 19:36:48
  * @LastEditors: penglei 1624952103@qq.com
- * @LastEditTime: 2024-11-06 18:28:20
+ * @LastEditTime: 2024-11-08 12:26:04
  * @FilePath:
  * /FD230/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp
  * @Description:
@@ -137,7 +137,7 @@ namespace OHOS
     FILE *fp = fopen(file_path, "rb");
     if (fp == NULL)
     {
-      WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "read_sleep_data fopen fail");
+      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "read_sleep_data fopen fail %s \n",file_path);
       // osal_mutex_unlock(&sleep_mutex);
       return false;
     }
@@ -307,8 +307,13 @@ namespace OHOS
 
   // 开机读取
   void SleepModel::read_sleep_file_data() {
-    custom_read_sleep_data();
-    custom_read_nap_data();
+    // custom_read_sleep_data();
+    do_custom_fileoperate_service_check_msg(  
+            CUSTOM_FILEOPERATE_MSG_TYPE_SLEEPDATA_READ, nullptr, 0);  
+    do_custom_fileoperate_service_check_msg(  
+            CUSTOM_FILEOPERATE_MSG_TYPE_NAPDATA_READ, nullptr, 0);
+    // custom_read_nap_data();
+
   }
   // 保存睡眠数据
  void SleepModel::msg_save_sleep_data() {
@@ -792,7 +797,7 @@ namespace OHOS
       sleep_data.total_time = totaltime;
     }
     // 更新小睡数据
-    void updata_nap_data(uint32_t sleep_timestamp, uint32_t wake_timestamp,
+    void update_nap_data(uint32_t sleep_timestamp, uint32_t wake_timestamp,
                          uint32_t totaltime) {
       nap_data.fall_asleep_timestamp = sleep_timestamp;  
       nap_data.wake_up_timestamp = wake_timestamp;  
index eecb294..9626563 100644 (file)
@@ -18,6 +18,7 @@
 #include "time.h"
 #include "ConfigModelC.h"
 #include "battery_hal.h"
+#include "sleep/include/SleepModelC.h"
 
 #define AP_ENABLE_DML_SDO_LISTEN
 
@@ -212,6 +213,8 @@ void cywee_save_nap_data(cywee_inactivity_accumulate_time_t c_inactivity_accumul
     // CWM_OS_dbgPrintf("save_nap_sleep_data succ \n");
 
     fclose(fp);
+
+    update_nap_data(fall_asleep_timestamp,wake_up_timestamp,total_time);
 }
 
 void cywee_set_sleep_time_data(cywee_inactivity_accumulate_time_t *sleep_data)
@@ -300,6 +303,7 @@ void cywee_save_sleep_time_data(cywee_inactivity_accumulate_time_t sleep_time)
     // CWM_OS_dbgPrintf("total_time[%d], total_deep_sleep_time[%d], total_mild_sleep_time[%d], total_rem_sleep_time[%d], total_wake_time[%d] \n",
     // total_time,total_deep_sleep_time,total_mild_sleep_time,total_rem_sleep_time,total_wake_time);
 
+    update_sleep_data(fall_asleep_timestamp,wake_up_timestamp,total_time);
 
 }