Merge #740 into sdk602patch0626 from refs/changes/740/head 739/target/2 742/target/1 743/target/1
author程羽飞 <2393524978@qq.com>
Tue, 20 Aug 2024 10:06:09 +0000 (10:06 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Tue, 20 Aug 2024 10:06:09 +0000 (10:06 +0000)
更新睡眠监测模式判别接口;优化睡眠监测模式下相关功能

* refs/changes/740/head: (1 commits squashed)

  - 更新睡眠监测模式判别接口;优化睡眠监测模式下相关功能

Signed-off-by: dingtalk_kaxuzp <2393524978@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/740
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp
code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessModel.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbModel.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/sleep/include/SleepModel.h
code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp

index f198658..6cf0c9e 100644 (file)
@@ -692,7 +692,7 @@ void AlarmClockModel::PopInterCancelMusic()
 
 void AlarmClockModel::PopInterPlayMusic()
 {
-    if(true == ConfigModel::GetInstance()->GetDnotdisturb() && (0 == uapi_dev_runtime_get_sleep_status()))
+    if(true == ConfigModel::GetInstance()->GetDnotdisturb() && (0 == uapi_dev_runtime_get_sleep_monitoring_status()))
     {
         return;
     }
index cf51e53..8eaf609 100644 (file)
@@ -393,8 +393,6 @@ extern "C"
                     SendMsgToUIService(UI_UPDATE_SLEEP_DATA, 0, nullptr, 0);\r
                 }\r
                                 \r
-                OHOS::SleepModel::GetInstance().ExitSleepModeAction();\r
-\r
                 //判断是否还在睡眠\r
                 if (uapi_dev_runtime_get_sleep_status() == 0)\r
                 {\r
@@ -404,6 +402,8 @@ extern "C"
                     OHOS::SleepModel::GetInstance().ReInitData(); // 更新睡眠数据\r
                     SendMsgToUIService(UI_UPDATE_SLEEP_DATA, 0, nullptr, 0);\r
                     do_cywee_service_check_msg(CYWEE_SERVICE_CMD_NAP_SEDENTARY_MODE, NULL);//算法底层切换小睡监测模式\r
+\r
+                    OHOS::SleepModel::GetInstance().ExitSleepModeAction();\r
                 }\r
             }\r
             // 进入睡眠检测模式并退出小睡检测模式\r
index af0d8f5..89278f4 100644 (file)
@@ -174,7 +174,7 @@ namespace OHOS
                 HealthService::GetInstance()->SetHealthCurrent(highHealthState);
                 viewId = VIEW_CHECK_INVALID;
             }
-            if(true == uapi_dev_runtime_get_sleep_status())
+            if(uapi_dev_runtime_get_sleep_monitoring_status())
             {
                 if(VIEW_DNOTDISTURB == viewId)
                     return false; 
index bb13251..e8c8be6 100644 (file)
@@ -11,6 +11,7 @@
 #include "wearable_log.h"
 #include "ConfigModel.h"
 #include "ConfigModelC.h"
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
 
 namespace OHOS
 {
@@ -35,6 +36,10 @@ namespace OHOS
             return false;
         }
         bool t_value = mmi_flip_wrist_switch_get();
+        if(uapi_dev_runtime_get_sleep_monitoring_status())
+        {
+            t_value = false;
+        }
         displayBrightnessPresent->SetRaiseToBrightnessState(t_value);
         return true;
     }
index 5883ef9..4ab35f4 100644 (file)
@@ -170,7 +170,7 @@ namespace OHOS
         }\r
         if (strcmp(view.GetViewId(), BRINGHTNESSCONTROLBUTTON_VIEW) == 0)\r
         {\r
-            if(true == uapi_dev_runtime_get_sleep_status())\r
+            if(uapi_dev_runtime_get_sleep_monitoring_status())\r
             {\r
                 return false;\r
             }\r
index 619fce2..dd1b552 100644 (file)
@@ -351,10 +351,6 @@ namespace OHOS
             return false;\r
         }\r
         RaiseToBrightnessCheckBoxButton->SetOnChangeListener(presenter_);\r
-        if(true == uapi_dev_runtime_get_sleep_status())\r
-        {\r
-            RaiseToBrightnessCheckBoxButton->SetTouchable(false);\r
-        }\r
         return true;\r
     }\r
 \r
@@ -405,6 +401,16 @@ namespace OHOS
         DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessImage);\r
         DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessLabel);\r
         DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessCheckBoxButton);\r
+\r
+        if(uapi_dev_runtime_get_sleep_monitoring_status())\r
+        {\r
+            RaiseToBrightnessCheckBoxButton->SetTouchable(false);\r
+        }\r
+        else\r
+        {\r
+            RaiseToBrightnessCheckBoxButton->SetTouchable(true);\r
+        }\r
+\r
         RootView::GetInstance()->Add(DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]);\r
         Draw();\r
     }\r
index 38e8a38..c2a7ad0 100644 (file)
@@ -15,6 +15,8 @@
 #include "main/include/MainViewSample.h"
 #include "MainModel.h"
 #include "ConfigModel.h"
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
+
 namespace OHOS
 {
 
@@ -37,6 +39,11 @@ namespace OHOS
 
     bool DnotDisturbModel::GetDoNotDisturbModeEnabled() const
     {
+        if(uapi_dev_runtime_get_sleep_monitoring_status())
+        {
+            return true;
+        }
+
         return ConfigModel::GetInstance()->GetDnotdisturb();
     }
 
index d6290dd..e102461 100644 (file)
@@ -32,6 +32,7 @@
 #include "weather/include/WeatherModel.h"
 #include "heart_blood/health_service/health_service.h"
 #include "MainModel.h"
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
 
 #if USE_OFFLINE_DIAL
 #include "DialViewGroup.h"
@@ -123,6 +124,14 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "health model nullptr");
             return false;
         }
+        if(uapi_dev_runtime_get_sleep_monitoring_status())
+        {
+            if(VIEW_DNOTDISTURB == g_jumpView[curViewId])
+            {
+                return true;
+            }
+        }
+
         if (curViewId == DROPDOWN_CLICK_DONOTDISTURB)
         {
 #if 0
index d8a32e9..44554c4 100644 (file)
@@ -141,13 +141,6 @@ namespace OHOS
         int goal_total_time = 0;
 
         SLEEPSTATE sleepstate_ = SLEEPSTATE::WAKE;
-
-        typedef struct
-        {
-            bool DnotdisturbFlag;
-            bool FlipWristFlag;
-        }DeviceStateBeforeSleep;
-        DeviceStateBeforeSleep DeviceStateBeforeSleep_ = {0}; 
     };
 }
 
index 3cdc902..c8d9912 100644 (file)
@@ -42,6 +42,7 @@
 #include "ui_service.h"
 #include "ConfigModelC.h"
 #include "power_display_service.h"
+#include "MainModel.h"
 
 extern "C" errcode_t uapi_get_TIME_STR(uint32_t time, char *p_time, char date_separator, char time_separator, date_format_t format);
 extern "C" int get_sleep_time_from_config_model(void);
@@ -751,17 +752,15 @@ namespace OHOS
     void SleepModel::EnterSleepModeAction(void)
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:EnterSleepModeAction]", __LINE__);
-        // switch on
-        // mmi_sleep_mode_flag_set(true);
 
-        // switch on donotdisturb
-        DeviceStateBeforeSleep_.DnotdisturbFlag = OHOS::ConfigModel::GetInstance()->GetDnotdisturb();
-        OHOS::ConfigModel::GetInstance()->SetDnotdisturb(true); // 开启勿扰
+        // update donotdisturb
         SendMsgToUIService(UI_UPDATE_DNOTDISTURB_MODE, 0, nullptr, 0);
 
-        // switch off flip wrist
-        DeviceStateBeforeSleep_.FlipWristFlag = mmi_flip_wrist_switch_get();
-        mmi_flip_wrist_switch_set(false); // switch off
+        /*更新主界面配置*/
+        MainModel::GetInstance().setDialState(DialState::SLEEP, true);
+
+        // disable flip wrist
+        uapi_take_to_wake(0);
 
         // turn down brightness
         const power_display_svr_api_t *display_api = power_display_svr_get_api();
@@ -770,18 +769,19 @@ namespace OHOS
 
     void SleepModel::ExitSleepModeAction(void)
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:ExitSleepModeAction]", __LINE__);
-        // switch off
-        // mmi_sleep_mode_flag_set(false);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:ExitSleepModeAction", __LINE__);
 
-        // reset donotdisturb
-        bool DnotdisturbFlag = DeviceStateBeforeSleep_.DnotdisturbFlag;
-        OHOS::ConfigModel::GetInstance()->SetDnotdisturb(DnotdisturbFlag);
+        // update donotdisturb
         SendMsgToUIService(UI_UPDATE_DNOTDISTURB_MODE, 0, nullptr, 0);
 
-        // reset flip wrist
-        bool FlipWristFlag = DeviceStateBeforeSleep_.FlipWristFlag;
-        mmi_flip_wrist_switch_set(FlipWristFlag);
+        /*更新主界面配置*/
+        MainModel::GetInstance().setDialState(DialState::SLEEP, false);
+
+        // enable flip wrist
+        if(true == mmi_flip_wrist_switch_get())
+        {
+            uapi_take_to_wake(1);
+        }
 
         // reset brightness
         const power_display_svr_api_t *display_api = power_display_svr_get_api();
index de63b5c..1f6459f 100644 (file)
@@ -1796,7 +1796,7 @@ int get_ScreenDuration(void) //获取亮屏时长
 }
 void Set_RaiseToWake(bool value) //抬婉亮屏开关 
 {
-    if(true == uapi_dev_runtime_get_sleep_status())
+    if(uapi_dev_runtime_get_sleep_monitoring_status())
     {
         return;
     }