增加充电退出省电模式
authorCaisking <3449750381@qq.com>
Mon, 25 Mar 2024 07:37:24 +0000 (15:37 +0800)
committerCaisking <3449750381@qq.com>
Mon, 25 Mar 2024 07:37:24 +0000 (15:37 +0800)
code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h
code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveEleModel.h
code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveEleModel.cpp
code/sdk/application/wearable/fd230app/nativeui/system/include/SystemModel.h
code/sdk/application/wearable/fd230app/nativeui/system/src/SystemModel.cpp
code/sdk/application/wearable/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp

index 8136c75..aa35ea5 100644 (file)
@@ -27,6 +27,7 @@ namespace OHOS
 \r
         static SaveBatPresenter *GetInstance();\r
         virtual void Notify() override;\r
+        void ExitView(void);\r
 \r
     private:\r
         // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
index e69de29..1d056ce 100644 (file)
@@ -0,0 +1,24 @@
+
+#ifndef SaveEle_MODEL_H
+#define SaveEle_MODEL_H
+
+namespace OHOS
+{
+    class SaveEleModel
+    {
+    public:
+        static SaveEleModel *GetInstance(void);
+        int GetChargeStuaut();
+        void SetChargeStuaut(int chargestuaut);
+
+    private:
+        SaveEleModel() = default;
+        ~SaveEleModel() {}
+        SaveEleModel(const SaveEleModel &) = delete;
+        SaveEleModel &operator=(const SaveEleModel &) = delete;
+
+        int ChargeStuaut = 0; // 充电状态
+    };
+}
+
+#endif
\ No newline at end of file
index 2743586..a64e5d9 100644 (file)
@@ -18,7 +18,7 @@
 #include "NativeAbility.h"\r
 \r
 #include "saveele/include/SaveBatPresenter.h"\r
-\r
+#include "saveele/include/SaveEleModel.h"\r
 namespace OHOS\r
 {\r
 \r
@@ -76,11 +76,6 @@ namespace OHOS
 \r
     bool SaveBatPresenter::OnClick(UIView &view, const ClickEvent &event)\r
     {\r
-        // 执行点击事件的处理逻辑\r
-        // 根据控件id查找是哪个控件触发了点击回调\r
-        // if (strcmp(view.GetViewId(), 控件ID) == 0\r
-        // 返回 true 以消耗点击事件\r
-\r
         return true;\r
     }\r
     bool SaveBatPresenter::OnLongPress(UIView &view, const LongPressEvent &event)\r
@@ -94,8 +89,16 @@ namespace OHOS
         }\r
         return true;\r
     }\r
+    void SaveBatPresenter::ExitView(void)\r
+    {\r
+        if (SaveEleModel::GetInstance()->GetChargeStuaut())\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN);\r
+        }\r
+    }\r
     void SaveBatPresenter::Notify(void)\r
     {\r
         SaveBatView::GetInstance()->RefreshView();\r
+        ExitView();\r
     }\r
 }
\ No newline at end of file
index e69de29..8f7d9f6 100644 (file)
@@ -0,0 +1,19 @@
+#include "saveele/include/SaveEleModel.h"
+
+namespace OHOS
+{
+
+    SaveEleModel *SaveEleModel::GetInstance(void)
+    {
+        static SaveEleModel instance;
+        return &instance;
+    }
+    int SaveEleModel::GetChargeStuaut()
+    {
+        return ChargeStuaut;
+    }
+    void SaveEleModel::SetChargeStuaut(int chargestuaut)
+    {
+        ChargeStuaut = chargestuaut;
+    }
+}
\ No newline at end of file
index 4715f73..162aceb 100644 (file)
@@ -1,3 +1,11 @@
+/*** 
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-01-29 19:58:37
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-25 15:25:13
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/system/include/SystemModel.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
 #ifndef SYSTEM_MODEL_H
 #define SYSTEM_MODEL_H
 
index 8e77ce1..93d5876 100644 (file)
@@ -1,3 +1,11 @@
+/*** 
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-01-29 19:58:37
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-25 15:24:17
+ * @FilePath: /sdk/application/wearable/fd230app/nativeui/system/src/SystemModel.cpp
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
 #include "system/include/SystemModel.h"
 
 namespace OHOS
index 3e0f3bd..89ac13c 100755 (executable)
@@ -16,6 +16,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/main/include/dial
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/bloodoxygen/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heartrate/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/saveele/include/
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
@@ -114,6 +115,7 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/clock/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/activity/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/rtcservice/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/saveele/include/
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
     ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include
index bd758a7..711ea4b 100755 (executable)
@@ -21,6 +21,7 @@
 #include "DialModelSPO2.h"
 #include "BloodOxygenModel.h"
 #include "HeartModel.h"
+#include "SaveEleModel.h"
 #include "ppg_service.h"
 #include "CallerLogModel.h"
 #include "notification_manager.h"
@@ -200,6 +201,7 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req)
         display_api->turn_on_screen();
     }
     DialModelCharge::GetInstance()->UpdateChargeStuaut(1);
+    SaveEleModel::GetInstance()->SetChargeStuaut(1);
 
     testCHANINGView *t=testCHANINGView::GetInstance();
     if(t!=NULL)
@@ -215,6 +217,8 @@ void MsgCenterNotifyChargeUnPlugProc(const Topic topic, Request* req)
     unused(topic);
     WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyProc:: CHarger UnPlug !");
     DialModelCharge::GetInstance()->UpdateChargeStuaut(0);
+    SaveEleModel::GetInstance()->SetChargeStuaut(0);
+    
     testCHANINGView *t=testCHANINGView::GetInstance();
     if(t!=NULL)
     {
@@ -271,6 +275,7 @@ void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req)
 }
 #ifdef SUPPORT_SPO2_NOTIFICATION_TEST
 uint32_t md = PPG_SERVICE_CMD_TYPE_DO_PPG_TEST;
+//灰卡测试
 void MsgCenterNotifyCardhProc(const Topic topic, Request* req)
 {
     unused(topic);
@@ -296,7 +301,7 @@ void MsgCenterNotifyCardhProc(const Topic topic, Request* req)
     }
 
 }
-
+//漏光测试
 void MsgCenterNotifyleaklighthProc(const Topic topic, Request* req)
 {
     unused(topic);