增加睡眠model,需要提供对应接口 377/3
authorCaisking <3449750381@qq.com>
Wed, 26 Jun 2024 07:16:38 +0000 (15:16 +0800)
committerCaisking <3449750381@qq.com>
Wed, 26 Jun 2024 07:16:38 +0000 (15:16 +0800)
code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModel.h
code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp

index e69de29..ecab3d9 100644 (file)
@@ -0,0 +1,47 @@
+/***
+ * @Date: 2024-06-25 10:34:10
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-26 09:51:50
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModel.h
+ */
+
+#ifndef Sleep_MODEL_H
+#define Sleep_MODEL_H
+
+#include <cstdint>
+#include <map>
+#include "AppViewIDs.h"
+#include "UiConfig.h"
+#include "sleep/include/SleepView.h"
+#include "sleep/include/SleepControlPresenter.h"
+#include "string"
+namespace OHOS
+{
+    class SleepModel
+    {
+    public:
+        static SleepModel &GetInstance(void);
+        void GetSleepTime();       // 获取睡眠时间
+        std::string GetSleepStr(); // 解析睡眠时间
+        void GetRestTime();        // 获取入睡时间
+        std::string GetRestStr();  // 解析入睡时间
+        void GetWalkTime();        // 获取醒来时间
+        std::string GetWalkStr();  // 解析醒来时间
+        void GetGoalTime();        // 获取目标休息时间(xx-xx)
+        std::string GetGoalStr();  // 解析目标休息时间
+
+    private:
+        SleepModel();
+        SleepModel(const SleepModel &);
+        SleepModel &operator=(const SleepModel &);
+        virtual ~SleepModel();
+
+        std::string sleepStr;
+        std::string restStr;
+        std::string walkStr;
+        std::string goalsleepStr;
+        std::string goalwalkStr;
+    };
+}
+
+#endif // Sleep_MODEL_H
\ No newline at end of file
index e69de29..5687052 100644 (file)
@@ -0,0 +1,15 @@
+
+#include "sleep/include/SleepModel.h"
+#include "kv_store.h"
+#include "securec.h"
+
+namespace OHOS
+{
+    SleepModel::SleepModel() {}
+    SleepModel::~SleepModel() {}
+    SleepModel &SleepModel::GetInstance()
+    {
+        static SleepModel instance;
+        return instance;
+    }
+}
\ No newline at end of file