1.利用ConfigModel保存用户设置的VoLTE通话和运动识别开关状态。
authorluozheng <1732036298@qq.com>
Wed, 24 Apr 2024 06:23:36 +0000 (14:23 +0800)
committerluozheng <1732036298@qq.com>
Wed, 24 Apr 2024 06:23:36 +0000 (14:23 +0800)
2.解决运动识别视图右滑不退出问题。
3.删除系统视图中的4G能力开关并移动到网络与通话中。

13 files changed:
code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h
code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h
code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallView.cpp
code/sdk/application/wearable/fd230app/nativeui/system/include/SystemView.h
code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp
code/sdk/drivers/peripheral/utils/custom_utils.c
code/sdk/drivers/peripheral/utils/custom_utils.h

index 2f7777c..344f3ec 100644 (file)
@@ -67,6 +67,8 @@ namespace OHOS
             CONFIGMODEL_ITEM_TRANING_FREQ,//训练实时数据上传频率
             CONFIGMODEL_ITEM_SYSTEM_VOLUME,//系统音量
             CONFIGMODEL_ITEM_CALL_VOLUME,//通话音量
+            CONFIGMODEL_ITEM_VOLTE_CALL,//VoLTE通话
+            CONFIGMODEL_ITEM_MOTIONRECOGNITION,//运动识别
             CONFIGMODEL_ITEM_MAX,
         } ;
 
@@ -128,6 +130,9 @@ namespace OHOS
         void SetCat1_4Gability(bool state);
         bool GetCat1_4Gability();
 
+        void SetVoLTE_Call(bool state);
+        bool GetVoLTE_Call();
+
         void SetDnotdisturb(bool state);
         bool GetDnotdisturb(void);
 
@@ -153,6 +158,9 @@ namespace OHOS
 
         void SetSilentMode(bool state);
         bool GetSilentMode(void);
+        /* ---------------------------------- 运动识别相关set与get ---------------------------------- */
+        void SetMotionRecognition(bool state);
+        bool GetMotionRecognition(void);
         /* --------------------------------- 用户配置信息 --------------------------------- */
         void SetUserAge(int age);
         int GetUserAge();
@@ -193,6 +201,8 @@ namespace OHOS
             {ConfigDataType::DATATYPE_INT,     "traningfreq",              "10" },// CONFIGMODEL_ITEM_TRANING_FREQ //训练实时数据上传频率//单位秒
             {ConfigDataType::DATATYPE_INT,     "SystemVolume",               "100"  },// CONFIGMODEL_ITEM_SYSTEM_VOLUME //
             {ConfigDataType::DATATYPE_INT,     "CallVolume",                 "100"  },// CONFIGMODEL_ITEM_CALL_VOLUME //
+            {ConfigDataType::DATATYPE_BOOL,     "VoLTECall",                "false" },// CONFIGMODEL_ITEM_VOLTE_CALL
+            {ConfigDataType::DATATYPE_BOOL,     "MotionRecognition",        "false" },// CONFIGMODEL_ITEM_MOTIONRECOGNITION
         };
         ConfigModel();                                        // 私有构造函数,确保无法在外部实例化
         ConfigModel(const ConfigModel &) = delete;            // 禁止拷贝构造
index be5d797..4041c76 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-17 09:32:03
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 18:06:14
+ * @LastEditTime: 2024-04-24 11:44:39
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h
  */
 #ifndef _CONFIG_MODEL_C_H_
@@ -59,6 +59,20 @@ void initializeVibrationModel(void);
  * @brief 初始化静音模式 
  */
 void initializeSilentModel(void);
+
+/*
+ * @brief 初始化VOLTE通话开关 
+ */
+void initializeVoLTECall(void);
+/*
+ * @brief 初始化4G能力开关 
+ */
+void initialize4GCapability(void);
+
+/*
+ * @brief 初始化运动识别开关 
+ */
+void initializeMotionRecognition(void);
 #ifdef __cplusplus
 #if __cplusplus
 }
index ceab7a7..50e5342 100644 (file)
@@ -623,6 +623,25 @@ namespace OHOS
         return get_configData_bool(CONFIGMODEL_ITEM_CAT1_SERVICE_ON);
     }
 
+    /*
+     * @brief 设置VoLTE通话是否开启
+     * @param {bool} state
+     */
+    void ConfigModel::SetVoLTE_Call(bool state)
+    {
+        set_condigData_Bool(CONFIGMODEL_ITEM_VOLTE_CALL,state);
+    }
+
+    /*
+     * @brief  获取VoLTE通话是否开启
+     * @return {bool} true 开启 false 关闭
+     */
+    bool ConfigModel::GetVoLTE_Call()
+    {
+        return get_configData_bool(CONFIGMODEL_ITEM_VOLTE_CALL);
+    }
+
+
     /*设置勿扰模式是否开启*/
     void ConfigModel::SetDnotdisturb(bool state)
     {
@@ -670,6 +689,18 @@ namespace OHOS
     {
         return get_configData_int(CONFIGMODEL_ITEM_CALL_VOLUME);
     }
+
+    //设置运动识别是否开启
+    void ConfigModel::SetMotionRecognition(bool state)
+    {
+        set_condigData_Bool(CONFIGMODEL_ITEM_MOTIONRECOGNITION,state);
+    }
+    
+    //获取运动识别是否开启
+    bool ConfigModel::GetMotionRecognition(void)
+    {
+        return get_configData_bool(CONFIGMODEL_ITEM_MOTIONRECOGNITION);
+    }
 /* -------------------------------------------------------------------------- */
     /*设置用户年龄[后续使用结构体统一配置]*/
     void ConfigModel::SetUserAge(int age)
@@ -828,6 +859,24 @@ void initializeSilentModel(void)
     uapi_setSilentMode(isopen);
 }
 
+void initializeVoLTECall(void)
+{
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "initializeVoLTECall");
+
+}
+
+void initialize4GCapability(void)
+{
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "initialize4GCapability");
+    bool isopen = OHOS::ConfigModel::GetInstance()->GetCat1_4Gability();
+    uapi_set4GCapability(isopen);
+}
+
+void initializeMotionRecognition(void)
+{
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "initializeMotionRecognition");
+    bool isopen = OHOS::ConfigModel::GetInstance()->GetMotionRecognition();
+}
 #ifdef __cplusplus
 #if __cplusplus
 }
index a322c4a..bc677cb 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-28 14:17:43
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-23 18:12:26
+ * @LastEditTime: 2024-04-24 11:42:10
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/language/src/MotionRecognitionPresenter.cpp
  */
 #include "AppViewIDs.h"
@@ -11,6 +11,7 @@
 #include "motionrecognition/include/MotionRecognitionView.h"
 #include "common/key_code.h"
 #include <custom_utils.h>
+#include "config/include/ConfigModel.h"
 
 namespace OHOS
 {
@@ -71,10 +72,12 @@ namespace OHOS
                 if (toggleButton->GetState() == true)
                 {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is enable!");
+                    ConfigModel::GetInstance()->SetMotionRecognition(true);
                 }
                 else
                 {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognition is disable!");
+                    ConfigModel::GetInstance()->SetMotionRecognition(false);
                 }
             }
         }
index 3547c01..de95455 100644 (file)
@@ -2,12 +2,13 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 17:28:52
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-23 19:09:24
+ * @LastEditTime: 2024-04-24 11:26:57
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionView.cpp
  */
 #include "motionrecognition/include/MotionRecognitionPresenter.h"
 #include "motionrecognition/include/MotionRecognitionView.h"
 #include "wearable_log.h"
+#include "config/include/ConfigModel.h"
 namespace OHOS
 {
 
@@ -74,7 +75,15 @@ namespace OHOS
             scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
             scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
             scrollView->SetScrollBlankSize(50);
+            scrollView->SetHorizontalScrollState(false);
             scrollView->SetReboundSize(35);
+            UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(MotionRecognitionPresenter::GetInstance());
+            if (draglistener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::draglistener can not be nullptr!");
+                return;
+            }
+            scrollView->SetOnDragListener(draglistener);
             /* -------------------------------------------------------------------------- */
             if (Title == nullptr)
             {
@@ -118,6 +127,7 @@ namespace OHOS
                 return;
             }
             MotionRecognitionToggleButton->SetPosition(298, 145, 100, 50);
+            MotionRecognitionToggleButton->SetState(ConfigModel::GetInstance()->GetMotionRecognition());
             MotionRecognitionToggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
             const char *selectedImg = "/user/res/TOGGLEBUTTON_ON.bin";
             const char *unSelectedImg = "/user/res/TOGGLEBUTTON_OFF.bin";
diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h
new file mode 100644 (file)
index 0000000..b9778fe
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-04-24 10:25:39
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-04-24 10:46:13
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/include/NetworkAndCallC.h
+ */
+#ifndef NETWORKANDCALLC_H
+#define NETWORKANDCALLC_H
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif
+#endif
+#include <stdint.h>
+#include <stdbool.h>
+
+    void power_on_cat1(void);
+    void power_off_cat1(void);
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif
+#endif
+#endif
\ No newline at end of file
index c152acb..a34d663 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-23 09:59:32
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-23 17:00:37
+ * @LastEditTime: 2024-04-24 11:18:34
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp
  */
 #include "AppViewIDs.h"
@@ -14,7 +14,9 @@
 #include "map"
 #include "functional"
 #include "iostream"
-
+#include "config/include/ConfigModel.h"
+#include "networkandcall/include/NetworkAndCallC.h"
+#include "cat1_ctl.h"
 namespace OHOS
 {
 
@@ -66,11 +68,10 @@ namespace OHOS
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NetworkAndCallView::GetInstance fail!!");
             return false;
         }
-        
-        
+
         std::map<UIView *, std::string> buttonMap = {
+            {p_NetworkAndCallView->GetMobileDataToggleButton(), "4GCapability"},
             {p_NetworkAndCallView->GetVoLTEToggleButton(), "VoLTE"},
-            {p_NetworkAndCallView->GetMobileDataToggleButton(), "MobileData"},
             {p_NetworkAndCallView->GetMobileDataOptionsView()->GetSystemUpdateToggleButton(), "SystemUpdate"},
             {p_NetworkAndCallView->GetMobileDataOptionsView()->GetOnlineMusicToggleButton(), "OnlineMusic"}};
 
@@ -83,10 +84,29 @@ namespace OHOS
                 if (toggleButton->GetState() == true)
                 {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is enable!", it->second.c_str());
+                    if (it->second == "VoLTE")
+                    {
+                        ConfigModel::GetInstance()->SetVoLTE_Call(true);
+
+                    }
+                    else if (it->second == "4GCapability")
+                    {
+                        power_on_cat1();
+                        ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat());
+                    }
                 }
                 else
                 {
                     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s is disable!", it->second.c_str());
+                    if (it->second == "VoLTE")
+                    {
+                        ConfigModel::GetInstance()->SetVoLTE_Call(false);
+                    }
+                    else if (it->second == "4GCapability")
+                    {
+                        power_off_cat1();
+                        ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat());
+                    }
                 }
             }
             return true;
@@ -138,4 +158,30 @@ namespace OHOS
         }
         return true;
     }
-}
\ No newline at end of file
+}
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+    uint32_t uapi_cat1_power_on(uint32_t pwron);
+    uint32_t uapi_cat1_reset(uint32_t pwron);
+
+    void power_on_cat1(void)
+    {
+        uapi_cat1_power_on(1);
+        uapi_cat1_reset(0);
+    }
+
+    void power_off_cat1(void)
+    {
+        uapi_cat1_reset(1);
+        uapi_cat1_power_on(0);
+    }
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __cplusplus */
\ No newline at end of file
index a72c484..95bef18 100644 (file)
@@ -2,6 +2,8 @@
 #include "networkandcall/include/NetworkAndCallView.h"
 #include "wearable_log.h"
 #include "UiConfig.h"
+#include "config/include/ConfigModel.h"
+#include "cat1_ctl.h"
 namespace OHOS
 {
 
@@ -98,7 +100,7 @@ namespace OHOS
             Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             /* -------------------------------------------------------------------------- */
             int positionY_Img = 120;
-            const char *text[] = {"VoLTE 通话", "移动数据", "移动数据选项"};
+            const char *text[] = {"4G能力", "VoLTE 通话", "移动数据选项"};
             for (int i = 0; i < ITEM_NUM; i++)
             {
                 NetworkAndCallImage[i] = new UIImageView(); // Create a new UIImageView for each iteration
@@ -128,27 +130,29 @@ namespace OHOS
                 NetworkAndCallLabel[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
             }
             /* -------------------------------------------------------------------------- */
-            VoLTE_toggleButton = new UIToggleButton();
-            if (VoLTE_toggleButton == nullptr)
+            MobileData_toggleButton = new UIToggleButton();
+            if (MobileData_toggleButton == nullptr)
             {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!");
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::MobileData_toggleButton is nullptr!");
                 return;
             }
-            VoLTE_toggleButton->SetPosition(298, 145, 100, 50);
-            VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+            MobileData_toggleButton->SetPosition(298, 145, 100, 50);
+            MobileData_toggleButton->SetState(uapi_cat1_get_power_stat());
+            MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
             const char *selectedImg = "/user/res/TOGGLEBUTTON_ON.bin";
             const char *unSelectedImg = "/user/res/TOGGLEBUTTON_OFF.bin";
-            VoLTE_toggleButton->SetImages(selectedImg, unSelectedImg);
+            MobileData_toggleButton->SetImages(selectedImg, unSelectedImg);
             /* -------------------------------------------------------------------------- */
-            MobileData_toggleButton = new UIToggleButton();
-            if (MobileData_toggleButton == nullptr)
+            VoLTE_toggleButton = new UIToggleButton();
+            if (VoLTE_toggleButton == nullptr)
             {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::MobileData_toggleButton is nullptr!");
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LanguageSwitchView::VoLTE_toggleButton is nullptr!");
                 return;
             }
-            MobileData_toggleButton->SetPosition(298, 265, 100, 50);
-            MobileData_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
-            MobileData_toggleButton->SetImages(selectedImg, unSelectedImg);
+            VoLTE_toggleButton->SetPosition(298, 265, 100, 50);
+            VoLTE_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+            VoLTE_toggleButton->SetState(ConfigModel::GetInstance()->GetVoLTE_Call());
+            VoLTE_toggleButton->SetImages(selectedImg, unSelectedImg);
             /* ----------------------------- onclickListener ---------------------------- */
             UIView::OnClickListener *toggleButtonClick = static_cast<UIView::OnClickListener *>(NetworkAndCallPresenter::GetInstance());
             VoLTE_toggleButton->SetOnClickListener(toggleButtonClick);
index c129f25..7036fff 100644 (file)
@@ -91,10 +91,6 @@ namespace OHOS
         SystemupgradeView *p_SystemupgradeView{nullptr};\r
         UIScrollView *SystemScrollView[10]{nullptr};\r
         UILabelExt *SystemLabel{nullptr}; // 标题\r
-\r
-        UILabelExt *Cat1_4Gability_Label{nullptr};\r
-        UIImageView *Cat1_4Gability_ImageView{nullptr};\r
-        UIToggleButton *Cat1_4Gability_ToggleButton{nullptr};\r
         bool initViewStatus{false};\r
     };\r
 } // namespace OHOS\r
index 2162ffd..f32b0af 100644 (file)
@@ -85,41 +85,8 @@ namespace OHOS
         return true;\r
     }\r
 \r
-    extern "C"\r
-    {\r
-        uint32_t uapi_cat1_power_on(uint32_t pwron);\r
-        uint32_t uapi_cat1_reset(uint32_t pwron);\r
-\r
-        void power_on_cat1(void)\r
-        {\r
-            uapi_cat1_power_on(1);\r
-            uapi_cat1_reset(0);\r
-        }\r
-\r
-        void power_off_cat1(void)\r
-        {\r
-            uapi_cat1_reset(1);\r
-            uapi_cat1_power_on(0);\r
-        }\r
-    }\r
-    \r
     bool SystemPresenter::OnChange(UICheckBox::UICheckBoxState state)\r
     {\r
-        switch (state)\r
-        {\r
-        case UICheckBox::SELECTED:\r
-            power_on_cat1();\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4g Capability Is Enabled");\r
-            ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat());\r
-            break;\r
-        case UICheckBox::UNSELECTED:\r
-            power_off_cat1();\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4g Capability Is Disabled");\r
-            ConfigModel::GetInstance()->SetCat1_4Gability(uapi_cat1_get_power_stat());\r
-            break;\r
-        default:\r
-            break;\r
-        }\r
         return true;\r
     }\r
 \r
index c52e0c9..dd4a526 100644 (file)
@@ -85,24 +85,6 @@ namespace OHOS
                 SystemLabel = nullptr;\r
             }\r
 \r
-            if (Cat1_4Gability_Label != nullptr)\r
-            {\r
-                delete Cat1_4Gability_Label;\r
-                Cat1_4Gability_Label = nullptr;\r
-            }\r
-\r
-            if (Cat1_4Gability_ImageView != nullptr)\r
-            {\r
-                delete Cat1_4Gability_ImageView;\r
-                Cat1_4Gability_ImageView = nullptr;\r
-            }\r
-\r
-            if (Cat1_4Gability_ToggleButton != nullptr)\r
-            {\r
-                delete Cat1_4Gability_ToggleButton;\r
-                Cat1_4Gability_ToggleButton = nullptr;\r
-            }\r
-\r
             delete SystemScrollView[SYSTEMVIEW];\r
             SystemScrollView[SYSTEMVIEW] = nullptr;\r
         }\r
@@ -159,53 +141,6 @@ namespace OHOS
         return true;\r
     }\r
 \r
-    /*Cat14G能力开关视图初始化*/\r
-    bool SystemView::Cat1_4GabilityButtonViewInit()\r
-    {\r
-        Cat1_4Gability_Label = new UILabelExt();\r
-        if (Cat1_4Gability_Label == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " Cat1_4Gability_Label new  fail!!");\r
-            return false;\r
-        }\r
-        Cat1_4Gability_Label->SetPosition(83, 150, 200, 40);\r
-        Cat1_4Gability_Label->SetStyle(STYLE_TEXT_FONT, 30);\r
-        Cat1_4Gability_Label->SetStyle(STYLE_LINE_HEIGHT, 35);\r
-        Cat1_4Gability_Label->SetText("4G能力");\r
-        Cat1_4Gability_Label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        Cat1_4Gability_Label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        Cat1_4Gability_Label->SetRollSpeed(0);\r
-        Cat1_4Gability_Label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-        /* -------------------------------------------------------------------------- */\r
-        Cat1_4Gability_ImageView = new UIImageView();\r
-        if (Cat1_4Gability_ImageView == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " Cat1_4Gability_ImageView new  fail!!");\r
-            return false;\r
-        }\r
-        Cat1_4Gability_ImageView->SetPosition(43, 120, 380, 100);\r
-        Cat1_4Gability_ImageView->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-        Cat1_4Gability_ImageView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-        Cat1_4Gability_ImageView->SetStyle(STYLE_BORDER_RADIUS, 100);\r
-        /* -------------------------------------------------------------------------- */\r
-        Cat1_4Gability_ToggleButton = new UIToggleButton();\r
-        if (Cat1_4Gability_ToggleButton == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Cat1_4Gability_ToggleButton new fail!!");\r
-            return false;\r
-        }\r
-        Cat1_4Gability_ToggleButton->SetState(uapi_cat1_get_power_stat());\r
-        Cat1_4Gability_ToggleButton->SetPosition(298, 145, 100, 50);\r
-        Cat1_4Gability_ToggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-        Cat1_4Gability_ToggleButton->SetStyle(STYLE_BORDER_RADIUS, 50);\r
-        const char *toggleButtonselectedImg = "/user/res/TOGGLEBUTTON_ON.bin";\r
-        const char *toggleButtonunSelectedImg = "/user/res/TOGGLEBUTTON_OFF.bin";\r
-        Cat1_4Gability_ToggleButton->SetImages(toggleButtonselectedImg, toggleButtonunSelectedImg);\r
-        UICheckBox::OnChangeListener *listener = static_cast<UICheckBox::OnChangeListener *>(SystemPresenter::GetInstance());\r
-        Cat1_4Gability_ToggleButton->SetOnChangeListener(listener);\r
-        return true;\r
-    }\r
-\r
     UILabelButtonExt *SystemView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener)\r
     {\r
         UILabelButtonExt *button = new UILabelButtonExt();\r
@@ -436,8 +371,7 @@ namespace OHOS
     void SystemView::OnStart()\r
     {\r
         View<SystemPresenter>::OnStart();\r
-        initView_ext(43, 240, 380, 100, 120, "/user/res/SETTING_NEXT.bin");\r
-        Cat1_4GabilityButtonViewInit();\r
+        initView_ext(43, 120, 380, 100, 120, "/user/res/SETTING_NEXT.bin");\r
         RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SystemPresenter::GetInstance();\r
         RootView::GetInstance()->SetOnKeyActListener(keyactListener);\r
     }\r
@@ -452,10 +386,6 @@ namespace OHOS
         }\r
 \r
         SystemScrollView[SYSTEMVIEW]->Add(SystemLabel);\r
-        SystemScrollView[SYSTEMVIEW]->Add(Cat1_4Gability_ImageView);\r
-        SystemScrollView[SYSTEMVIEW]->Add(Cat1_4Gability_Label);\r
-        SystemScrollView[SYSTEMVIEW]->Add(Cat1_4Gability_ToggleButton);\r
-\r
         int len = sizeof(ViewMapper_t) / sizeof(SystemViewMapper_ext);\r
 \r
         for (int i = 0; i < len; i++)\r
index d430101..8d3409e 100644 (file)
@@ -24,6 +24,7 @@
 #include "power_display_service.h"
 // #include "config/include/ConfigModelC.h"
 #include "soundandvibration/include/SoundAndVibrationVolumeSettingC.h"
+#include "networkandcall/include/NetworkAndCallC.h"
 
 #define SUPPORT_NV
 
@@ -226,7 +227,10 @@ void startup_post_init_task(void)
     initializeVolume();
     initializeVibrationModel();
     initializeSilentModel();
-
+    // initializeVoLTECall();
+    //initialize4GCapability();
+    //initializeMotionRecognition();
+    
     LOS_Msleep(5000);
     addressbookToRead(NULL);
     if ( poweron_cat1_on_bootup_flag() )
@@ -649,6 +653,19 @@ void uapi_setSilentMode(bool isopen)
     SilentModelSet(isopen);
 }
 
+//设置4G能力开关是否开启
+void uapi_set4GCapability(bool isopen)
+{
+    if(isopen)
+    {
+        power_on_cat1();
+    }
+    else
+    {
+        power_off_cat1();
+    }
+}
+
 #include "bts_le_gap.h"
 
 
index 1801a30..0164a29 100644 (file)
@@ -63,6 +63,7 @@ void uapi_systemVolumeSet(int16_t sounding);
 void uapi_callVolumeSet(int16_t sounding);
 void uapi_vibrationModeSet(int value);
 void uapi_setSilentMode(bool isopen);
+void uapi_set4GCapability(bool isopen);
 
 errcode_t uapi_get_btaddr(uint8_t *buf_btaddr, uint32_t *len_btaddr);
 errcode_t uapi_get_btname(uint8_t *buf_btname, uint32_t *len_btname);