From 719e7b829856ef26b4c80a32d986b2377c0ffed2 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Tue, 20 Aug 2024 15:19:37 +0800 Subject: [PATCH] =?utf8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81?= =?utf8?q?=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/sleep/src/SleepModel.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp index 1de307fcf..3cdc90268 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepModel.cpp @@ -707,28 +707,19 @@ namespace OHOS void SleepModel::Sleep_StartTimer(uint32_t interval) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepModel::Sleep_StartTimer"); - /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回 ------------------------- */ if (g_timer != NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownModel::CountDown_StartTimer Timer already exists!!"); return; } - - /* --------------------------------- 2.创建定时器 -------------------------------- */ g_timer = osTimerNew((osTimerFunc_t)Sleep_TimerCallback, osTimerOnce, NULL, NULL); - // 检查定时器创建是否成功 if (g_timer == NULL) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownModel::CountDown_StartTimer Timer create failed!!"); return; } - - /* ----------------------------- 3.将毫秒转换为系统时钟节拍数 ---------------------------- */ int tick = osMs2Tick(interval); - - /* --------------------------------- 4.启动定时器 -------------------------------- */ osStatus_t ret = osTimerStart(g_timer, tick); - /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为 NULL -------------------- */ if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CountDown_StartTimer] osTimerDelete failed, ret = %lx!!", ret); @@ -756,13 +747,13 @@ namespace OHOS g_timer = NULL; } } - + /* -------------------------------------------------------------------------- */ void SleepModel::EnterSleepModeAction(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:EnterSleepModeAction]", __LINE__); // switch on - mmi_sleep_mode_flag_set(true); - + // mmi_sleep_mode_flag_set(true); + // switch on donotdisturb DeviceStateBeforeSleep_.DnotdisturbFlag = OHOS::ConfigModel::GetInstance()->GetDnotdisturb(); OHOS::ConfigModel::GetInstance()->SetDnotdisturb(true); // 开启勿扰 @@ -775,14 +766,13 @@ namespace OHOS // turn down brightness const power_display_svr_api_t *display_api = power_display_svr_get_api(); display_api->set_brightness(51); - } void SleepModel::ExitSleepModeAction(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]:ExitSleepModeAction]", __LINE__); // switch off - mmi_sleep_mode_flag_set(false); + // mmi_sleep_mode_flag_set(false); // reset donotdisturb bool DnotdisturbFlag = DeviceStateBeforeSleep_.DnotdisturbFlag; @@ -796,6 +786,5 @@ namespace OHOS // reset brightness const power_display_svr_api_t *display_api = power_display_svr_get_api(); display_api->set_brightness(OHOS::ConfigModel::GetInstance()->GetBrightness()); - } } \ No newline at end of file -- 2.17.1