统一部分接口;翻腕亮灭屏设置开关时同步使能功能 731/1 731/head
authorcheng <chengyf@zhihuishixun.com>
Mon, 19 Aug 2024 12:14:18 +0000 (20:14 +0800)
committercheng <chengyf@zhihuishixun.com>
Mon, 19 Aug 2024 12:14:18 +0000 (20:14 +0800)
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h
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/service/ble_service/blemoder/bletest.cpp
code/sdk/drivers/peripheral/config/include/ConfigModel.h
code/sdk/drivers/peripheral/config/include/ConfigModelC.h
code/sdk/drivers/peripheral/config/src/ConfigModel.cpp

index 74a3c81..af0d8f5 100644 (file)
@@ -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; 
index 255e916..bf14d29 100644 (file)
@@ -16,7 +16,7 @@
 namespace OHOS\r
 {\r
     static constexpr uint8_t WRIST_RAISE_TO_WAKE_ENABLED = 1;\r
-    static constexpr uint8_t WRIST_RAISE_TO_WAKE_DISENABLED = 2;\r
+    static constexpr uint8_t WRIST_RAISE_TO_WAKE_DISENABLED = 0;\r
     typedef enum\r
     {\r
         DISPLAYBRIGHTNESSVIEW = 0, // 屏幕与亮度视图(slice)\r
index 2add7fb..bb13251 100644 (file)
@@ -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;
     }
 
index 102fc09..5883ef9 100644 (file)
@@ -23,6 +23,8 @@
 #include "string"\r
 #include "ConfigModel.h"\r
 #include "ConfigModelC.h"\r
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"\r
+\r
 namespace OHOS\r
 {\r
     // 当前Presenter属性实例化的内存指针\r
@@ -168,7 +170,7 @@ namespace OHOS
         }\r
         if (strcmp(view.GetViewId(), BRINGHTNESSCONTROLBUTTON_VIEW) == 0)\r
         {\r
-            if(true == mmi_sleep_mode_flag_get())\r
+            if(true == uapi_dev_runtime_get_sleep_status())\r
             {\r
                 return false;\r
             }\r
@@ -224,12 +226,12 @@ namespace OHOS
         case UICheckBox::SELECTED:\r
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Raise to Wake switched on!");\r
             uapi_take_to_wake(WRIST_RAISE_TO_WAKE_ENABLED);\r
-            ConfigModel::GetInstance()->SetRaiseToWake(true);\r
+            mmi_flip_wrist_switch_set(true);\r
             break;\r
         case UICheckBox::UNSELECTED:\r
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Raise to Wake switched off!");\r
             uapi_take_to_wake(WRIST_RAISE_TO_WAKE_DISENABLED);\r
-            ConfigModel::GetInstance()->SetRaiseToWake(false);\r
+            mmi_flip_wrist_switch_set(false);\r
             break;\r
         default:\r
             break;\r
index 9d42149..619fce2 100644 (file)
@@ -5,6 +5,8 @@
 #include "ConfigModelC.h"\r
 #include "ui_resource_string.h"\r
 #include <UiConfig.h>\r
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"\r
+\r
 namespace OHOS\r
 {\r
     static DisplayBrightnessView *g_pDisplayBrightnessView{nullptr};\r
@@ -349,7 +351,7 @@ namespace OHOS
             return false;\r
         }\r
         RaiseToBrightnessCheckBoxButton->SetOnChangeListener(presenter_);\r
-        if(true == mmi_sleep_mode_flag_get())\r
+        if(true == uapi_dev_runtime_get_sleep_status())\r
         {\r
             RaiseToBrightnessCheckBoxButton->SetTouchable(false);\r
         }\r
index 132de8f..de63b5c 100644 (file)
@@ -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) //设置系统音量
 {
index 63ebea3..0d1374f 100644 (file)
@@ -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点结束
index 43951f8..b0b9623 100644 (file)
@@ -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);
index 50cafd9..16de7a0 100644 (file)
@@ -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)
 {
      // 设置心率检测频率