睡眠:增加sleep数据接口 1369/1 1369/head
authorCaisking <3449750381@qq.com>
Fri, 8 Nov 2024 03:26:17 +0000 (11:26 +0800)
committerCaisking <3449750381@qq.com>
Fri, 8 Nov 2024 03:26:17 +0000 (11:26 +0800)
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModelC.h
code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp

index 3260efd..ce63ade 100644 (file)
@@ -433,7 +433,9 @@ namespace OHOS
             Updategoal();
             break;
 
-            
+        case SLEEP:
+            UpdateSleep();
+            break;
 
         }
     }
index a6e6786..78dd4da 100644 (file)
@@ -20,6 +20,8 @@ extern "C"
     void custom_read_sleep_data(void);
     void custom_read_nap_data(void);
     void custom_sleep_model_updata(void);
+    void update_sleep_data(uint32_t sleep_timestamp,uint32_t wake_timestamp,uint32_t totaltime);
+    void update_nap_data(uint32_t sleep_timestamp,uint32_t wake_timestamp,uint32_t totaltime);
 #ifdef __cplusplus
 #if __cplusplus
 }
index 1259119..00215d8 100644 (file)
@@ -784,6 +784,20 @@ namespace OHOS
     {
       OHOS::SleepModel::GetInstance().ReInitData();
     }
+    // 更新睡眠数据
+    void update_sleep_data(uint32_t sleep_timestamp, uint32_t wake_timestamp,
+                           uint32_t totaltime) {
+      sleep_data.fall_asleep_timestamp = sleep_timestamp;
+      sleep_data.wake_up_timestamp = wake_timestamp;
+      sleep_data.total_time = totaltime;
+    }
+    // 更新小睡数据
+    void updata_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;  
+      nap_data.total_time = totaltime;  
+    }
 
 #ifdef __cplusplus
 #if __cplusplus