From c4bb0ecdd27c74518467ec11d7cb1cea6ed510f0 Mon Sep 17 00:00:00 2001 From: cheng Date: Mon, 19 Aug 2024 20:14:18 +0800 Subject: [PATCH] =?utf8?q?=E7=BB=9F=E4=B8=80=E9=83=A8=E5=88=86=E6=8E=A5?= =?utf8?q?=E5=8F=A3=EF=BC=9B=E7=BF=BB=E8=85=95=E4=BA=AE=E7=81=AD=E5=B1=8F?= =?utf8?q?=E8=AE=BE=E7=BD=AE=E5=BC=80=E5=85=B3=E6=97=B6=E5=90=8C=E6=AD=A5?= =?utf8?q?=E4=BD=BF=E8=83=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/applist/src/ApplistPresenter.cpp | 3 +- .../include/DisplayBrightnessPresenter.h | 2 +- .../src/DisplayBrightnessModel.cpp | 4 +- .../src/DisplayBrightnessPresent.cpp | 8 ++-- .../src/DisplayBrightnessView.cpp | 4 +- .../service/ble_service/blemoder/bletest.cpp | 19 +++++++--- .../peripheral/config/include/ConfigModel.h | 4 -- .../peripheral/config/include/ConfigModelC.h | 6 --- .../peripheral/config/src/ConfigModel.cpp | 37 ++----------------- 9 files changed, 30 insertions(+), 57 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp index 74a3c8116..af0d8f534 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp @@ -17,6 +17,7 @@ #include "heart_blood/health_service/health_service.h" #include "battery_hal.h" #include "ConfigModelC.h" +#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h" namespace OHOS { @@ -173,7 +174,7 @@ namespace OHOS HealthService::GetInstance()->SetHealthCurrent(highHealthState); viewId = VIEW_CHECK_INVALID; } - if(true == mmi_sleep_mode_flag_get()) + if(true == uapi_dev_runtime_get_sleep_status()) { if(VIEW_DNOTDISTURB == viewId) return false; diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h index 255e916cf..bf14d29b3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h @@ -16,7 +16,7 @@ namespace OHOS { static constexpr uint8_t WRIST_RAISE_TO_WAKE_ENABLED = 1; - static constexpr uint8_t WRIST_RAISE_TO_WAKE_DISENABLED = 2; + static constexpr uint8_t WRIST_RAISE_TO_WAKE_DISENABLED = 0; typedef enum { DISPLAYBRIGHTNESSVIEW = 0, // 屏幕与亮度视图(slice) diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessModel.cpp index 2add7fbc1..bb13251c3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessModel.cpp @@ -10,6 +10,7 @@ #include "brightnesslevel/include/BrightnessLevelView.h" #include "wearable_log.h" #include "ConfigModel.h" +#include "ConfigModelC.h" namespace OHOS { @@ -33,7 +34,8 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessViewAndSubViewComponentsStatusInit DisplayBrightnessPresenter GetInstance fail"); return false; } - displayBrightnessPresent->SetRaiseToBrightnessState(ConfigModel::GetInstance()->GetRaiseToWake()); // 抬腕按钮的状态 + bool t_value = mmi_flip_wrist_switch_get(); + displayBrightnessPresent->SetRaiseToBrightnessState(t_value); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp index 102fc092f..5883ef9e5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp @@ -23,6 +23,8 @@ #include "string" #include "ConfigModel.h" #include "ConfigModelC.h" +#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h" + namespace OHOS { // 当前Presenter属性实例化的内存指针 @@ -168,7 +170,7 @@ namespace OHOS } if (strcmp(view.GetViewId(), BRINGHTNESSCONTROLBUTTON_VIEW) == 0) { - if(true == mmi_sleep_mode_flag_get()) + if(true == uapi_dev_runtime_get_sleep_status()) { return false; } @@ -224,12 +226,12 @@ namespace OHOS case UICheckBox::SELECTED: WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Raise to Wake switched on!"); uapi_take_to_wake(WRIST_RAISE_TO_WAKE_ENABLED); - ConfigModel::GetInstance()->SetRaiseToWake(true); + mmi_flip_wrist_switch_set(true); break; case UICheckBox::UNSELECTED: WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Raise to Wake switched off!"); uapi_take_to_wake(WRIST_RAISE_TO_WAKE_DISENABLED); - ConfigModel::GetInstance()->SetRaiseToWake(false); + mmi_flip_wrist_switch_set(false); break; default: break; diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp index 9d42149d5..619fce2b8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp @@ -5,6 +5,8 @@ #include "ConfigModelC.h" #include "ui_resource_string.h" #include +#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h" + namespace OHOS { static DisplayBrightnessView *g_pDisplayBrightnessView{nullptr}; @@ -349,7 +351,7 @@ namespace OHOS return false; } RaiseToBrightnessCheckBoxButton->SetOnChangeListener(presenter_); - if(true == mmi_sleep_mode_flag_get()) + if(true == uapi_dev_runtime_get_sleep_status()) { RaiseToBrightnessCheckBoxButton->SetTouchable(false); } diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 132de8ff0..de63b5cde 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -26,6 +26,7 @@ // #include "TraingCardPresenter.h" #include "../../../../../../drivers/peripheral/vibrator/service/vibrator_service.h" #include "../../../../../../drivers/peripheral/config/include/ConfigModelC.h" +#include "../../../../../../drivers/peripheral/utils/custom_runtime.h" #ifdef FD230 #include "uiservice/include/ui_service.h" @@ -1795,13 +1796,21 @@ int get_ScreenDuration(void) //获取亮屏时长 } void Set_RaiseToWake(bool value) //抬婉亮屏开关 { - if(true == mmi_sleep_mode_flag_get()) + if(true == uapi_dev_runtime_get_sleep_status()) { return; } - OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); - p_ConfigModel->SetRaiseToWake(value); + mmi_flip_wrist_switch_set(value); + if(true == value) + { + uapi_take_to_wake(1); + } + else + { + uapi_take_to_wake(0); + } + #ifdef FD230 SendMsgToUIService(UI_UPDATE_RAISETOBRIGHTNESS,0,nullptr,0); #endif @@ -1810,9 +1819,7 @@ void Set_RaiseToWake(bool value) //抬婉亮屏开关 int Get_RaiseToWake(void) //获取抬婉亮屏开关 { - OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); - - return p_ConfigModel->GetRaiseToWake(); + return mmi_flip_wrist_switch_get(); } void Set_SystemVolume(int value) //设置系统音量 { diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h index 63ebea390..0d1374f02 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -104,7 +104,6 @@ namespace OHOS CONFIGMODEL_ITEM_SLEEP_BEDTIME,//就寝时间 CONFIGMODEL_ITEM_SLEEP_GET_UP,//起床时间 CONFIGMODEL_ITEM_SLEEP_REMIND,//提前20分钟提醒开关 - CONFIGMODEL_ITEM_SLEEP_MODE, //sleep mode //久坐提醒相关 CONFIGMODEL_ITEM_SEDENTARY_SWITCH,//久坐提醒开关 CONFIGMODEL_ITEM_SEDENTARY_INTERVAL,//久坐提醒时间间隔(单位小时) @@ -215,8 +214,6 @@ namespace OHOS void SetScreenDuration(unsigned int value); unsigned int GetScreenDuration(void); - void SetRaiseToWake(bool value); - bool GetRaiseToWake(void); /* ----------------------------- 声音与震动相关set与get ----------------------------- */ void SetSystemVolume(int value); @@ -361,7 +358,6 @@ namespace OHOS {ConfigDataType::DATATYPE_INT, "sleep_bedtime", "1310720" }, //CONFIGMODEL_ITEM_SLEEP_BEDTIME,就寝时间 1310720 : 20 << 16 ,前16位为小时,后16位为分钟 {ConfigDataType::DATATYPE_INT, "sleep_getup", "589824" }, // CONFIGMODEL_ITEM_SLEEP_GET_UP,起床时间,589824 : 9 << 16 ,前16位为小时,后16位为分钟 {ConfigDataType::DATATYPE_INT, "sleep_remide", "0" }, // CONFIGMODEL_ITEM_SLEEP_REMIND,//提前20分钟提醒开关 - {ConfigDataType::DATATYPE_BOOL, "sleep_mode", "false" }, //CONFIGMODEL_ITEM_SLEEP_MODE, //sleep mode {ConfigDataType::DATATYPE_INT, "sedentary_switch", "0" }, // CONFIGMODEL_ITEM_SEDENTARY_SWITCH,//久坐提醒开关 {ConfigDataType::DATATYPE_INT, "sedentary_interval", "1" }, // CONFIGMODEL_ITEM_SEDENTARY_INTERVAL,//久坐提醒时间间隔 {ConfigDataType::DATATYPE_INT, "sedentary_remindertime", "0" }, // CONFIGMODEL_ITEM_SEDENTARY_REMINDERTIME,//久坐提醒时间段 前16位是开始时间 前8 为小时 后8为分钟 后16位为结束时间规则同前 例: 1600 0B00 11点开始到 22点结束 diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModelC.h b/code/sdk/drivers/peripheral/config/include/ConfigModelC.h index 43951f82c..b0b962354 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModelC.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModelC.h @@ -98,12 +98,6 @@ void get_user_info_from_config_model(int user_info[5]); int get_sleep_time_from_config_model(void); int get_wake_up_time_from_config_model(void); -// sleep mode flag get -bool mmi_sleep_mode_flag_get(void); - -// sleep mode flag set -void mmi_sleep_mode_flag_set(bool value); - int get_sedentary_switch_from_config_model(void); int get_sedentary_time_from_config_model(void); int get_sedentary_interval_from_config_model(void); diff --git a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp index 50cafd988..16de7a0de 100644 --- a/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp +++ b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp @@ -772,22 +772,6 @@ namespace OHOS /* -------------------------------- set与get方法 ------------------------------- */ - - /* - * @brief 设置抬腕亮屏是否开启 - */ - void ConfigModel::SetRaiseToWake(bool value) - { - set_condigData_Bool(CONFIGMODEL_ITEM_RAISE_TO_WAKE,value); - } - - /* - * @brief 获取抬腕亮屏是否开启 - */ - bool ConfigModel::GetRaiseToWake(void) - { - return get_configData_bool(CONFIGMODEL_ITEM_RAISE_TO_WAKE); - } /* * @brief 设置亮屏时长单位ms @@ -1372,14 +1356,14 @@ void cm_initializeScreenDuration(void) void cm_initializeRaiseToWake(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cm_initializeRaiseToWake"); - bool isOpen = OHOS::ConfigModel::GetInstance()->GetRaiseToWake(); + bool isOpen = mmi_flip_wrist_switch_get(); if(isOpen == true) { - // uapi_take_to_wake(1); + uapi_take_to_wake(1); } else { - // uapi_take_to_wake(0); + uapi_take_to_wake(0); } } @@ -1500,21 +1484,6 @@ int get_wake_up_time_from_config_model(void) return wake_up_time; } -// sleep mode flag get -bool mmi_sleep_mode_flag_get(void) -{ - if(OHOS::ConfigModel::GetInstance()->get_configData_bool(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP_MODE)) - return true; - - return false; -} - -// sleep mode flag set -void mmi_sleep_mode_flag_set(bool value) -{ - OHOS::ConfigModel::GetInstance()->set_condigData_Bool(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP_MODE, value); -} - void set_config_heart(int heartRateDetectionFreq) { // 设置心率检测频率 -- 2.17.1