下拉视图优化修改 ,设置Model添加设备的连接状态更新操作
authorluozheng <1732036298@qq.com>
Mon, 17 Jun 2024 10:42:34 +0000 (18:42 +0800)
committerluozheng <1732036298@qq.com>
Mon, 17 Jun 2024 10:42:34 +0000 (18:42 +0800)
12 files changed:
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp
code/sdk/application/wearable/fd230app/nativeui/main/include/ConnectedStatusView.h
code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h
code/sdk/application/wearable/fd230app/nativeui/main/src/ConnectedStatusView.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp
code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingModel.h
code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp
code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h
code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp
code/sdk/drivers/peripheral/utils/custom_runtime.c

index ca22b8d..e2c508c 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-04-25 11:51:04\r
  * @LastEditors: luozheng 1732036298@qq.com\r
- * @LastEditTime: 2024-05-10 14:33:18\r
+ * @LastEditTime: 2024-06-17 18:08:27\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothView.h\r
  */\r
 #ifndef CLASSIC_BLUETOOTH_VIEW_H\r
@@ -66,7 +66,7 @@ namespace OHOS
         UILabelExt *BlueToothEarPhoneLabel = nullptr;       // 蓝牙耳机\r
         UILabelExt *TradionalBlueToothLabel = nullptr;      // 传统蓝牙\r
         UILabelExt *BluetoothServiceOptionsLabel = nullptr; // 蓝牙服务选项\r
-        UILabel *AttentionLabel = nullptr;\r
+        UILabelExt *AttentionLabel = nullptr;\r
         UIToggleButton *TradionalBlueToothToggleButton = nullptr;\r
         bool initViewStatus{false};\r
     };\r
index 16398d6..2f8ae48 100644 (file)
@@ -2,7 +2,7 @@
 #include "classicbluetooth/include/ClassicBlueToothPresenter.h"\r
 #include "ConfigModel.h"\r
 #include "UiConfig.h"\r
-#include "uicomponents/UIComponents.h"\r
+#include "language/font/ui_resource_string.h"\r
 namespace OHOS\r
 {\r
     static ClassicBlueToothView *g_pClassicBlueToothView{nullptr};\r
@@ -109,8 +109,8 @@ namespace OHOS
         LabelConfig labelconfig = {\r
             .left = 93,\r
             .top = 52,\r
-            .width = 280,\r
-            .height = 40,\r
+            .width = 300,\r
+            .height = 35,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
             //.text = "蓝牙",\r
@@ -129,7 +129,7 @@ namespace OHOS
             .left = 90,\r
             .top = 153,\r
             .width = 180,\r
-            .height = 40,\r
+            .height = 35,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
             //.text = "蓝牙耳机",\r
@@ -163,7 +163,7 @@ namespace OHOS
             return false;\r
         }\r
         /* -------------------------------------------------------------------------- */\r
-        AttentionLabel = new UILabel();\r
+        AttentionLabel = new UILabelExt();\r
         if (AttentionLabel == nullptr)\r
         {\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::AttentionLabel is nullptr!");\r
@@ -173,7 +173,8 @@ namespace OHOS
         AttentionLabel->SetStyle(STYLE_TEXT_FONT, 20);   // 字体大小\r
         AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 30); // 字体行高\r
         //.text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)",\r
-        SetLabelId(AttentionLabel, STR_AUTO_OFF_BLUETOOTH_NOTE);\r
+        //SetLabelId(AttentionLabel, STR_AUTO_OFF_BLUETOOTH_NOTE);\r
+        AttentionLabel->SetTextId(STR_AUTO_OFF_BLUETOOTH_NOTE);\r
         AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
         AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); // 断行模式。\r
         AttentionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
index c292808..cb0b68c 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-26 17:58:00
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-08 17:54:05
+ * @LastEditTime: 2024-06-17 16:33:42
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/ConnectedStatusView.h
  */
 #ifndef CONNECTED_STATUS_VIEW_H
@@ -32,6 +32,9 @@ namespace OHOS
         static ConnectedStatusView *GetInstance(void);
         UIViewGroup *ConnectedStatusViewInit(void);
         UIButton *GetCloseButton();
+        void UpdatePhoneConnectedStatus(int status);
+        void UpdateEarPhoneConnectedStatus(int status);
+        void UpdateBlueToothConnectedStatus(int status);
 
         struct LabelConfig
         {
@@ -41,7 +44,7 @@ namespace OHOS
             int height;
             int fontSize;
             int lineHeight;
-            //const char *text;
+            // const char *text;
             uint16_t textId;
         };
 
@@ -56,11 +59,28 @@ namespace OHOS
             bool isConnected;
         } StatusImageParams;
 
+        typedef struct
+        {
+            UIImageView *statusImage;
+            UILabelExt *statusLabel;
+            int status;
+            uint32_t connectedImage;
+            uint32_t disconnectedImage;
+            uint16_t connectedText;
+            uint16_t disconnectedText;
+            OHOS::ColorType connectedColor;
+            OHOS::ColorType disconnectedColor;
+        } ConnectionStatusParams;
+
     private:
         UILabelExt *InitLabel(const LabelConfig &config);
-        UILabelExt *InitConnectedStatusLabel(const LabelConfig &config);
-
-        UIImageView *InitStatusImage(StatusImageParams params);
+        UIImageView *InitStatusImage(const StatusImageParams& params);
+        void updateConnectionStatus(const ConnectionStatusParams &params);
+        bool initGroupView(void);
+        bool initTitle(void);
+        bool initBackground();
+        bool initConnectedStatus(void);
+        bool initCloseButton(void);
         void ClearAll(void);
         UIViewGroup *group{nullptr};
         UILabelExt *Title{nullptr};
@@ -69,11 +89,10 @@ namespace OHOS
         UIImageView *PhoneConnectedStatusImage{nullptr};     // 显示手机连接状态
         UIImageView *EarPhoneConnectedStatusImage{nullptr};  // 显示耳机连接状态
         UIImageView *BluetoothConnectedStatusImage{nullptr}; // 显示蓝牙连接状态
+        UILabelExt *ConnectedStatusLabel[MAX_CONNECTEDSTATUS_ID]{nullptr};
 
         UILabelExt *PhoneAndEarAndBluetooth[MAX_CONNECTEDSTATUS_ID]{nullptr};
 
-        UILabelExt *ConnectedStatusLabel[MAX_CONNECTEDSTATUS_ID]{nullptr};
-
         UIButton *CloseButton{nullptr}; // 关闭按钮
         UILabel *CloseLabel{nullptr};   // 关闭标签
     };
index 30b4c85..f7ebe22 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-04-17 15:26:49
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-08 16:01:10
+ * @LastEditTime: 2024-06-17 18:36:36
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h
  */
 /*
@@ -52,38 +52,49 @@ namespace OHOS
         PullUpDownView();
         ~PullUpDownView() override;
         static PullUpDownView *GetInstance(void);
-        bool InitView();
         void PreLoad(void) override;
+        void UpdatePhoneStatus(int status);
+        void UpdateEarPhoneStatus(int status);
         void UpdateBlueToothStatus(int status);
         void UpdateDnotDisturbStatus(int status);
-        bool InitBaseData(); // 初始化基础数据组件
+        void UpdateSignalStrengthStatusAndBatteryPosition();
+        bool ChangeDropDownView(int16_t thisView);        // 切换到"下拉控制中心"视图
+        bool ChangeConnectedStatusView(int16_t thisView); // 切换到"连接状态"视图
+        bool ClickFunc(int16_t interface);
+        void ChangeView(int16_t hideView, int16_t showView);
+        ConnectedStatusView *GetConnectedStatusView(void);
 
         UILabel *GetTimeLabel();
         UILabel *GetDateLabel();
         UILabel *GetWeekLabel();
         UIBoxProgress *GetProgress();
 
-        void ClearAll();
+        bool GetPhoneConnectedStatus(void);
+        bool GetEarPhoneConnectedStatus(void);
+        bool GetBlueToothConnectedStatus(void);
+
+    private:
+        bool PullUpDownViewInit();
+        bool InitBaseData(); // 初始化基础数据组件
+        void InitViewImgBackGround(void);
+        void InitViewImg(void);
+        void InitConnectedStatusImage(void);
         bool InitSingalComponentsView();
+        void ClearAllConnectedStatusComponentsView();
         void ClearAllSingalComponentsView();
+        void ClearAll();
+
         int GetSignalStrength(void);
         int CalculateSignalBars(int signalStrength);
-        void UpdateSignalDisplay(int signalBars);
+        void UpdateSignalBarDisplay(int signalBars, bool state);
         void UpdateBatteryPosition(int signalBars);
-        void UpdateSignalStrengthStatusAndBatteryPosition();
-
-        void ClearAllConnectedStatusComponentsView();
-        bool GetPhoneConnectedStatus(void);
-        bool GetEarPhoneConnectedStatus(void);
-        bool GetBluetoothConnectedStatus(void);
+        void updateSignalDisplay();
+        void UpdateCat1NoSignalisplay(bool state);
+        void UpdateCat14GDisplay(bool state);
 
-        bool ChangeDropDownView(int16_t thisView);        // 切换到"下拉控制中心"视图
-        bool ChangeConnectedStatusView(int16_t thisView); // 切换到"连接状态"视图
-        bool ClickFunc(int16_t interface);
-        void ChangeView(int16_t hideView, int16_t showView);
-        ConnectedStatusView *GetConnectedStatusView(void);
     private:
         ConnectedStatusView *connectedStatusView{nullptr};
+
     private:
         UIViewGroup *group[MAX_DROPDOWNVIEWID]{nullptr};
         UIImageView *dropSetting{nullptr};                   // 设置
@@ -109,9 +120,6 @@ namespace OHOS
         AnimatorCallback *progresscallback_ = nullptr;
         Animator *progressanimator_ = nullptr;
 
-        void InitViewImgBackGround(void);
-        void InitViewImg(void);
-        void InitTimeDateWeekLabelAndConnectedStatusImage(void);
         bool viewiInitStatus{false};
     };
 }
index 23558a3..2956ed6 100644 (file)
@@ -7,16 +7,23 @@
 #include "main/include/MainPresenterSample.h"
 namespace OHOS
 {
+    static OHOS::ColorType connectedColor[MAX_CONNECTEDSTATUS_ID] = {
+        Color::GetColorFromRGBA(0xff, 0x8f, 0x00, 0xff),
+        Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff),
+        Color::GetColorFromRGBA(0x01, 0x76, 0xff, 0xff),
+    };
+    static OHOS::ColorType disconnectedColor = Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff);
+
     static ConnectedStatusView *g_pConnectedStatusView = nullptr;
     ConnectedStatusView::ConnectedStatusView()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::ConnectedStatusView");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::ConnectedStatusView");
         g_pConnectedStatusView = this;
     }
 
     ConnectedStatusView::~ConnectedStatusView()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::~ConnectedStatusView");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::~ConnectedStatusView");
         ClearAll();
         g_pConnectedStatusView = nullptr;
     }
@@ -28,6 +35,7 @@ namespace OHOS
 
     void ConnectedStatusView::ClearAll(void)
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::ClearAll");
         if (group != nullptr)
         {
             group->RemoveAll();
@@ -69,48 +77,26 @@ namespace OHOS
 
     UILabelExt *ConnectedStatusView::InitLabel(const LabelConfig &config)
     {
-        UILabelExt *titleLabel = new UILabelExt();
-        if (titleLabel == nullptr)
+        UILabelExt *Label = new UILabelExt();
+        if (Label == nullptr)
         {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail!!");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Label new fail!!");
             return nullptr;
         }
 
-        titleLabel->SetPosition(config.x, config.y, config.width, config.height);
-        titleLabel->SetStyle(STYLE_TEXT_FONT, config.fontSize);
-        titleLabel->SetStyle(STYLE_LINE_HEIGHT, config.lineHeight);
-        //titleLabel->SetText(config.text);
-        titleLabel->SetTextId(config.textId);
-        titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
-        titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-        // titleLabel->SetRollSpeed(40);系统默认为35
-        titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, config.fontSize);
-
-        return titleLabel;
-    }
+        Label->SetPosition(config.x, config.y, config.width, config.height);
+        Label->SetStyle(STYLE_TEXT_FONT, config.fontSize);
+        Label->SetStyle(STYLE_LINE_HEIGHT, config.lineHeight);
+        Label->SetTextId(config.textId);
+        Label->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+        Label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        // Label->SetRollSpeed(40);系统默认为35
+        Label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, config.fontSize);
 
-    UILabelExt *ConnectedStatusView::InitConnectedStatusLabel(const LabelConfig &config)
-    {
-        UILabelExt *titleLabel = new UILabelExt();
-        if (titleLabel == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail!!");
-            return nullptr;
-        }
-
-        titleLabel->SetPosition(config.x, config.y, config.width, config.height);
-        titleLabel->SetStyle(STYLE_TEXT_FONT, config.fontSize);
-        titleLabel->SetStyle(STYLE_LINE_HEIGHT, config.lineHeight);
-        //titleLabel->SetText(config.text);
-        titleLabel->SetTextId(config.textId);
-        titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
-        titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-        titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, config.fontSize);
-
-        return titleLabel;
+        return Label;
     }
 
-    UIImageView *ConnectedStatusView::InitStatusImage(StatusImageParams params)
+    UIImageView *ConnectedStatusView::InitStatusImage(const StatusImageParams &params)
     {
         UIImageView *statusImage = new UIImageView();
         if (statusImage == nullptr)
@@ -135,197 +121,268 @@ namespace OHOS
         return statusImage;
     }
 
-    UIViewGroup *ConnectedStatusView::ConnectedStatusViewInit(void)
+    void ConnectedStatusView::updateConnectionStatus(const ConnectionStatusParams &params)
     {
+        if (params.statusImage == nullptr || params.statusLabel == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdateConnectionStatus fail!!");
+            return;
+        }
+
+        ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, params.statusImage, (params.status ? params.connectedImage : params.disconnectedImage));
+        params.statusLabel->SetTextId(params.status ? params.connectedText : params.disconnectedText);
+        params.statusLabel->SetTextColor(params.status ? params.connectedColor : params.disconnectedColor);
+
+        params.statusImage->Invalidate();
+        params.statusLabel->Invalidate();
+    }
+
+    bool ConnectedStatusView::initGroupView(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::initGroupView");
+        group = new UIViewGroup();
         if (group == nullptr)
         {
-            group = new UIViewGroup();
-            if (group == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail!!");
-                return nullptr;
-            }
-            group->SetPosition(0, 0, 466, 466);
-            group->SetViewIndex(1);
-            group->SetTouchable(true);
-            group->SetDraggable(true);
-            group->SetIntercept(true);
-            /* -------------------------------------------------------------------------- */
-            //LabelConfig titleConfig = {93, 53, 280, 35, 30, 35, "连接状态"};
-            LabelConfig titleConfig = {93, 53, 280, 35, 30, 35, STR_CONNECTION_STATUS};
-            Title = InitLabel(titleConfig);
-            /* -------------------------------------------------------------------------- */
-            int background_position_x = 33;
-            for (int i = 0; i < 3; i++)
-            {
-                background[i] = new UIImageView();
-                if (background[i] == nullptr)
-                {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "background[%d] new fail!!", i);
-                    return nullptr;
-                }
-                background[i]->SetPosition(background_position_x + i * 140, 113, 120, 200);
-                background[i]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
-                background[i]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-                background[i]->SetStyle(STYLE_BORDER_RADIUS, 40);
-            }
-            /* -------------------------------------------------------------------------- */
-            PullUpDownView *pullUpDownView = PullUpDownView::GetInstance();
-            if (pullUpDownView == nullptr)
-            {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetInstance() fail");
-                return nullptr;
-            }
-            StatusImageParams params = {
-                .x = 63,
-                .y = 135,
-                .width = 60,
-                .height = 60,
-                .connectedImage = DROPDOWN_PHONECONNECTED,
-                .disconnectedImage = DROPDOWN_PHONEDISCONNECTED,
-                .isConnected = pullUpDownView->GetPhoneConnectedStatus(),
-            };
-            PhoneConnectedStatusImage = InitStatusImage(params);
-            /* -------------------------------------------------------------------------- */
-            params = {
-                .x = 203,
-                .y = 135,
-                .width = 60,
-                .height = 60,
-                .connectedImage = DROPDOWN_EARPHONESCONNECTED,
-                .disconnectedImage = DROPDOWN_EARPHONESDISCONNECTED,
-                .isConnected = pullUpDownView->GetEarPhoneConnectedStatus(),
-            };
-            EarPhoneConnectedStatusImage = InitStatusImage(params);
-            /* -------------------------------------------------------------------------- */
-            params = {
-                .x = 343,
-                .y = 135,
-                .width = 60,
-                .height = 60,
-                .connectedImage = DROPDOWN_BLUETOOTHCONNECTED,
-                .disconnectedImage = DROPDOWN_BLUETOOTHDISCONNECTED,
-                .isConnected = pullUpDownView->GetBluetoothConnectedStatus(),
-            };
-            BluetoothConnectedStatusImage = InitStatusImage(params);
-            /* -------------------------------------------------------------------------- */
-            // const char *connectedText[MAX_CONNECTEDSTATUS_ID] = {
-            //     "已连接",
-            //     "已连接",
-            //     "已连接",
-            // }; // 初始化连接状态文字数组
-            // const char *disconnectedText[MAX_CONNECTEDSTATUS_ID] = {
-            //     "未连接",
-            //     "未连接",
-            //     "未连接",
-            // }; // 初始化未连接状态文字数组
-            // const char *deviceName[MAX_CONNECTEDSTATUS_ID] = {
-            //     "手机",
-            //     "耳机",
-            //     "蓝牙",
-            // }; // 初始化设备名称数组
-            /* -------------------------------------------------------------------------- */
-            uint16_t connectedText[MAX_CONNECTEDSTATUS_ID] = {
-                STR_CONNECTED,
-                STR_CONNECTED,
-                STR_CONNECTED,
-            }; // 初始化连接状态文字数组
-            uint16_t disconnectedText[MAX_CONNECTEDSTATUS_ID] = {
-                STR_DISCONNECTED,
-                STR_DISCONNECTED,
-                STR_DISCONNECTED,
-            }; // 初始化未连接状态文字数组
-            uint16_t deviceName[MAX_CONNECTEDSTATUS_ID] = {
-                STR_PHONE,
-                STR_HEADSET,
-                STR_BLUETOOTH,
-            }; // 初始化设备名称数组
-            /* -------------------------------------------------------------------------- */
-            OHOS::ColorType connectedColor[MAX_CONNECTEDSTATUS_ID] = {
-                Color::GetColorFromRGBA(0xff, 0x8f, 0x00, 0xff),
-                Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff),
-                Color::GetColorFromRGBA(0x01, 0x76, 0xff, 0xff),
-            };                                                                                   // 初始化连接状态颜色数组
-            OHOS::ColorType disconnectedColor = Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff); // 初始化未连接状态颜色
-            int PhoneAndEarAndBluetooth_position_x = 53;
-            int ConnectedStatusLabel_position_x = 59;
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail!!");
+            return false;
+        }
+        group->SetPosition(0, 0, 466, 466);
+        group->SetViewIndex(1);
+        group->SetTouchable(true);
+        group->SetDraggable(true);
+        group->SetIntercept(true);
 
-            for (int i = 0; i < MAX_CONNECTEDSTATUS_ID; i++)
-            {
-                titleConfig = {PhoneAndEarAndBluetooth_position_x + i * 140, 220, 80, 35, 30, 35, deviceName[i]};
-                PhoneAndEarAndBluetooth[i] = InitLabel(titleConfig);
-                /* -------------------------------------------------------------------------- */
-                ConnectedStatusLabel[i] = new UILabelExt();
-                if (ConnectedStatusLabel[i] == nullptr)
-                {
-                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectedStatusLabel[%d] new fail!!", i);
-                    return nullptr;
-                }
-                ConnectedStatusLabel[i]->SetPosition(ConnectedStatusLabel_position_x + i * 140, 258, 70, 27);
-                ConnectedStatusLabel[i]->SetStyle(STYLE_TEXT_FONT, 23);
-                ConnectedStatusLabel[i]->SetStyle(STYLE_LINE_HEIGHT, 27);
-                ConnectedStatusLabel[i]->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
-                ConnectedStatusLabel[i]->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-                ConnectedStatusLabel[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 23);
-
-                if (i == PHONECONNECTEDSTATUS_ID && pullUpDownView->GetPhoneConnectedStatus())
-                {
-                    ConnectedStatusLabel[i]->SetTextId(connectedText[i]);
-                    ConnectedStatusLabel[i]->SetTextColor(connectedColor[i]);
-                }
-                else if (i == EARPHONECONNECTESTATUS_ID && pullUpDownView->GetEarPhoneConnectedStatus())
-                {
-                    ConnectedStatusLabel[i]->SetTextId(connectedText[i]);
-                    ConnectedStatusLabel[i]->SetTextColor(connectedColor[i]);
-                }
-                else if (i == BLUETOOTHCONNECTEDSTATUS && pullUpDownView->GetBluetoothConnectedStatus())
-                {
-                    ConnectedStatusLabel[i]->SetTextId(connectedText[i]);
-                    ConnectedStatusLabel[i]->SetTextColor(connectedColor[i]);
-                }
-                else
-                {
-                    ConnectedStatusLabel[i]->SetTextId(disconnectedText[i]);
-                    ConnectedStatusLabel[i]->SetTextColor(disconnectedColor);
-                }
-            }
+        return true;
+    }
+
+    bool ConnectedStatusView::initTitle(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::initTitle");
+        LabelConfig titleConfig = {93, 53, 280, 35, 30, 35, STR_CONNECTION_STATUS}; // 连接状态
+        Title = InitLabel(titleConfig);
+        if (Title == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Title new fail!!");
+            return false;
+        }
+        group->Add(Title);
+
+        return true;
+    }
 
-            /* -------------------------------------------------------------------------- */
-            CloseButton = new UIButton();
-            if (CloseButton == nullptr)
+    bool ConnectedStatusView::initBackground(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::initBackground");
+        int background_position_x = 33;
+        for (int i = 0; i < MAX_CONNECTEDSTATUS_ID; i++)
+        {
+            background[i] = new UIImageView();
+            if (background[i] == nullptr)
             {
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CloseButton new fail!");
-                return nullptr;
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "background[%d] new fail!!", i);
+                return false;
             }
-            CloseButton->SetPosition(118, 340, 230, 80);
-            CloseButton->SetViewId(CONNECTEDSTATUSVIEWCLOSEBUTTON);
-            CloseButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
-            UIView::OnClickListener *listener = static_cast<UIView::OnClickListener *>(MainPresenterSample::GetInstance());
-            CloseButton->SetOnClickListener(listener);
-            /* -------------------------------------------------------------------------- */
-            //titleConfig = {143, 363, 180, 35, 26, 35, "关闭"};
-            titleConfig = {143, 363, 180, 35, 26, 35, STR_CLOSE};
-            CloseLabel = InitLabel(titleConfig);
-
-            /* ----------------------------------- Add ---------------------------------- */
-            group->Add(Title);
-            for (int i = 0; i < MAX_CONNECTEDSTATUS_ID; i++)
+            background[i]->SetPosition(background_position_x + i * 140, 113, 120, 200);
+            background[i]->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+            background[i]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            background[i]->SetStyle(STYLE_BORDER_RADIUS, 40);
+            group->Add(background[i]);
+        }
+
+        return true;
+    }
+
+    bool ConnectedStatusView::initConnectedStatus(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::initConnectedStatus");
+        PullUpDownView *pullUpDownView = PullUpDownView::GetInstance();
+        if (pullUpDownView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetInstance() fail");
+            return false;
+        }
+
+        StatusImageParams params = {
+            .x = 63,
+            .y = 135,
+            .width = 60,
+            .height = 60,
+            .connectedImage = DROPDOWN_PHONECONNECTED,
+            .disconnectedImage = DROPDOWN_PHONEDISCONNECTED,
+            .isConnected = pullUpDownView->GetPhoneConnectedStatus(),
+        };
+        PhoneConnectedStatusImage = InitStatusImage(params);
+        group->Add(PhoneConnectedStatusImage);
+
+        params = {
+            .x = 203,
+            .y = 135,
+            .width = 60,
+            .height = 60,
+            .connectedImage = DROPDOWN_EARPHONESCONNECTED,
+            .disconnectedImage = DROPDOWN_EARPHONESDISCONNECTED,
+            .isConnected = pullUpDownView->GetEarPhoneConnectedStatus(),
+        };
+        EarPhoneConnectedStatusImage = InitStatusImage(params);
+        group->Add(EarPhoneConnectedStatusImage);
+
+        params = {
+            .x = 343,
+            .y = 135,
+            .width = 60,
+            .height = 60,
+            .connectedImage = DROPDOWN_BLUETOOTHCONNECTED,
+            .disconnectedImage = DROPDOWN_BLUETOOTHDISCONNECTED,
+            .isConnected = pullUpDownView->GetBlueToothConnectedStatus(),
+        };
+        BluetoothConnectedStatusImage = InitStatusImage(params);
+        group->Add(BluetoothConnectedStatusImage);
+
+        uint16_t deviceName[MAX_CONNECTEDSTATUS_ID] = {
+            STR_PHONE,     // 手机
+            STR_HEADSET,   // 耳机
+            STR_BLUETOOTH, // 蓝牙
+        }; // 初始化设备名称数组
+
+        int PhoneAndEarAndBluetooth_position_x = 53;
+        int ConnectedStatusLabel_position_x = 59;
+
+        for (int i = 0; i < MAX_CONNECTEDSTATUS_ID; i++)
+        {
+            LabelConfig titleConfig = {PhoneAndEarAndBluetooth_position_x + i * 140, 220, 80, 35, 30, 35, deviceName[i]};
+            PhoneAndEarAndBluetooth[i] = InitLabel(titleConfig);
+            group->Add(PhoneAndEarAndBluetooth[i]);
+
+            ConnectedStatusLabel[i] = new UILabelExt();
+            if (ConnectedStatusLabel[i] == nullptr)
             {
-                group->Add(background[i]);
-                group->Add(PhoneAndEarAndBluetooth[i]);
-                group->Add(ConnectedStatusLabel[i]);
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectedStatusLabel[%d] new fail!!", i);
+                return false;
             }
-            group->Add(PhoneConnectedStatusImage);
-            group->Add(EarPhoneConnectedStatusImage);
-            group->Add(BluetoothConnectedStatusImage);
+            ConnectedStatusLabel[i]->SetPosition(ConnectedStatusLabel_position_x + i * 140, 258, 70, 27);
+            ConnectedStatusLabel[i]->SetStyle(STYLE_TEXT_FONT, 23);
+            ConnectedStatusLabel[i]->SetStyle(STYLE_LINE_HEIGHT, 27);
+            ConnectedStatusLabel[i]->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+            ConnectedStatusLabel[i]->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            ConnectedStatusLabel[i]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 23);
+            group->Add(ConnectedStatusLabel[i]);
+        }
+        UpdatePhoneConnectedStatus(pullUpDownView->GetPhoneConnectedStatus());
+        UpdateEarPhoneConnectedStatus(pullUpDownView->GetEarPhoneConnectedStatus());
+        UpdateBlueToothConnectedStatus(pullUpDownView->GetBlueToothConnectedStatus());
+        
+        return true;
+    }
+
+    bool ConnectedStatusView::initCloseButton(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::initCloseButton");
+        CloseButton = new UIButton();
+        if (CloseButton == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CloseButton new fail!");
+            return false;
+        }
+        CloseButton->SetPosition(118, 340, 230, 80);
+        CloseButton->SetViewId(CONNECTEDSTATUSVIEWCLOSEBUTTON);
+        CloseButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        CloseButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+        UIView::OnClickListener *listener = static_cast<UIView::OnClickListener *>(MainPresenterSample::GetInstance());
+        if (listener == nullptr)
+        {
+            return false;
+        }
+        CloseButton->SetOnClickListener(listener);
+        LabelConfig titleConfig = {143, 363, 180, 35, 26, 35, STR_CLOSE}; // 关闭
+        CloseLabel = InitLabel(titleConfig);
+        if (CloseLabel == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CloseLabel new fail!!");
+            return false;
+        }
+        group->Add(CloseButton);
+        group->Add(CloseLabel);
+
+        return true;
+    }
+
+    UIViewGroup *ConnectedStatusView::ConnectedStatusViewInit()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::ConnectedStatusViewInit");
+        if (group != nullptr)
+        {
+            return group;
+        }
 
-            group->Add(CloseButton);
-            group->Add(CloseLabel);
+        if (!initGroupView() || !initTitle() || !initBackground() || !initConnectedStatus() || !initCloseButton())
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::ConnectedStatusViewInit fail!!");
+            return nullptr;
         }
 
         return group;
     }
 
+    // 更新手机连接状态
+    void ConnectedStatusView::UpdatePhoneConnectedStatus(int status)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::UpdatePhoneConnectedStatus");
+
+        ConnectionStatusParams params = {
+            .statusImage = PhoneConnectedStatusImage,
+            .statusLabel = ConnectedStatusLabel[PHONECONNECTEDSTATUS_ID],
+            .status = status,
+            .connectedImage = DROPDOWN_PHONECONNECTED,
+            .disconnectedImage = DROPDOWN_PHONEDISCONNECTED,
+            .connectedText = STR_CONNECTED,
+            .disconnectedText = STR_DISCONNECTED,
+            .connectedColor = connectedColor[PHONECONNECTEDSTATUS_ID],
+            .disconnectedColor = disconnectedColor,
+        };
+
+        updateConnectionStatus(params);
+    }
+
+    // 更新蓝牙耳机连接状态
+    void ConnectedStatusView::UpdateEarPhoneConnectedStatus(int status)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::UpdateEarPhoneConnectedStatus");
+
+        ConnectionStatusParams params = {
+            .statusImage = EarPhoneConnectedStatusImage,
+            .statusLabel = ConnectedStatusLabel[EARPHONECONNECTESTATUS_ID],
+            .status = status,
+            .connectedImage = DROPDOWN_EARPHONESCONNECTED,
+            .disconnectedImage = DROPDOWN_EARPHONESDISCONNECTED,
+            .connectedText = STR_CONNECTED,
+            .disconnectedText = STR_DISCONNECTED,
+            .connectedColor = connectedColor[EARPHONECONNECTESTATUS_ID],
+            .disconnectedColor = disconnectedColor,
+        };
+
+        updateConnectionStatus(params);
+    }
+
+    // 更新蓝牙连接状态
+    void ConnectedStatusView::UpdateBlueToothConnectedStatus(int status)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectedStatusView::UpdateBlueToothConnectedStatus");
+
+        ConnectionStatusParams params = {
+            .statusImage = BluetoothConnectedStatusImage,
+            .statusLabel = ConnectedStatusLabel[BLUETOOTHCONNECTEDSTATUS],
+            .status = status,
+            .connectedImage = DROPDOWN_BLUETOOTHCONNECTED,
+            .disconnectedImage = DROPDOWN_BLUETOOTHDISCONNECTED,
+            .connectedText = STR_CONNECTED,
+            .disconnectedText = STR_DISCONNECTED,
+            .connectedColor = connectedColor[BLUETOOTHCONNECTEDSTATUS],
+            .disconnectedColor = disconnectedColor,
+        };
+
+        updateConnectionStatus(params);
+    }
+
     UIButton *ConnectedStatusView::GetCloseButton()
     {
         return CloseButton;
index 04b8aa8..79c898e 100644 (file)
@@ -144,11 +144,13 @@ namespace OHOS
         if (curViewId == CONNECTEDSTATUSBACKGROUNDBUTTON)
         {
             PullUpDownView::GetInstance()->ChangeView(DROPDOWNVIEW, CONNECTEDSTATUSVIEW);
+            PullUpDown_StopTimer(); //切换到连接状态视图时停止定时器
             return true;
         }
         else if (curViewId == CONNECTEDSTATUSVIEWCLOSEBUTTON)
         {
             PullUpDownView::GetInstance()->ChangeView(CONNECTEDSTATUSVIEW, DROPDOWNVIEW);
+            PullUpDown_StartTimer(1000);//切回下拉控制中心视图开启定时器
             return true;
         }
         // if(&view == PullUpDownView::GetInstance()->GetConnectedStatusView()->GetCloseButton())
@@ -578,6 +580,7 @@ namespace OHOS
      */
     void MainPresenterSample::PullUpDown_StopTimer(void)
     {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainPresenterSample::PullUpDown_StopTimer");
         // 检查定时器是否存在
         if (g_timer != NULL)
         {
index 9766f4e..05fd5e8 100644 (file)
@@ -9,9 +9,9 @@
 #include "wearable_log.h"
 #include "UiConfig.h"
 #include "common/screen.h"
-#include "MainPresenterSample.h"
-#include "ScreenModels.h"
-#include "SettingModel.h"
+#include "main/include/MainPresenterSample.h"
+#include "screensetting/include/ScreenModels.h"
+#include "settings/include/SettingModel.h"
 #include "ui_resource_image.h"
 #include "dnotdisturb/include/DnotDisturbModel.h"
 #include "custom_utils.h"
@@ -98,13 +98,13 @@ namespace OHOS
     static PullUpDownView *g_pPullUpDownView = nullptr;
     PullUpDownView::PullUpDownView()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::PullUpDownView");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::PullUpDownView");
         g_pPullUpDownView = this;
     }
 
     PullUpDownView::~PullUpDownView()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::~PullUpDownView");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::~PullUpDownView");
         ClearAll();
         g_pPullUpDownView = nullptr;
     }
@@ -114,6 +114,61 @@ namespace OHOS
         return g_pPullUpDownView;
     }
 
+    // 清除信号强度相关组件
+    void PullUpDownView::ClearAllSingalComponentsView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::ClearAllSingalComponentsView");
+        if (NoSignal != nullptr)
+        {
+            delete NoSignal;
+            NoSignal = nullptr;
+        }
+
+        for (int i = 0; i < 4; i++)
+        {
+            if (showSignalStrength[i] != nullptr)
+            {
+                delete showSignalStrength[i];
+                showSignalStrength[i] = nullptr;
+            }
+        }
+
+        if (Singal_4 != nullptr)
+        {
+            delete Singal_4;
+            Singal_4 = nullptr;
+        }
+    }
+
+    // 清除所有与连接状态相关的视图组件
+    void PullUpDownView::ClearAllConnectedStatusComponentsView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::ClearAllConnectedStatusComponentsView");
+        if (connectedStatusBackgroundButton != nullptr)
+        {
+            delete connectedStatusBackgroundButton;
+            connectedStatusBackgroundButton = nullptr;
+        }
+
+        if (showPhoneConnectedStatus != nullptr)
+        {
+            delete showPhoneConnectedStatus;
+            showPhoneConnectedStatus = nullptr;
+        }
+
+        if (showEarPhoneConnectedStatus != nullptr)
+        {
+            delete showEarPhoneConnectedStatus;
+            showEarPhoneConnectedStatus = nullptr;
+        }
+
+        if (showBluetoothConnectedStatus != nullptr)
+        {
+            delete showBluetoothConnectedStatus;
+            showBluetoothConnectedStatus = nullptr;
+        }
+    }
+
     void PullUpDownView::ClearAll()
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::ClearAll");
@@ -359,43 +414,49 @@ namespace OHOS
     bool PullUpDownView::GetPhoneConnectedStatus(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetPhoneConnectedStatus");
-        uint8_t ret = uapi_dev_runtime_get_ble_connect_stat();
-        WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "ble phone connect stat = %d", ret);
-        if (ret == 1)
-            return true;
-        else
-            return false;
+        // uint8_t ret = uapi_dev_runtime_get_ble_connect_stat();
+        // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "ble phone connect stat = %d", ret);
+        // if (ret == 1)
+        //     return true;
+        // else
+        //     return false;
+
+        return SettingModel::GetInstance().GetPhoneConnectStatus();
     }
 
     // 获取蓝牙耳机连接状态
     bool PullUpDownView::GetEarPhoneConnectedStatus(void)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetEarPhoneConnectedStatus");
-        uint8_t ret = uapi_dev_runtime_get_earphone_connect_stat();
-        WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "earphone connect stat = %d", ret);
-        if (ret == 1)
-            return true;
-        else
-            return false;
+        // uint8_t ret = uapi_dev_runtime_get_earphone_connect_stat();
+        // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "earphone connect stat = %d", ret);
+        // if (ret == 1)
+        //     return true;
+        // else
+        //     return false;
+        
+        return SettingModel::GetInstance().GetEarPhoneConnectStatus();
     }
 
     // 获取蓝牙连接状态
-    bool PullUpDownView::GetBluetoothConnectedStatus(void)
+    bool PullUpDownView::GetBlueToothConnectedStatus(void)
     {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetBluetoothConnectedStatus");
-        uint8_t ret = uapi_dev_runtime_get_br_connect_stat();
-        WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "br connect stat = %d [0 no connect, 1 a2dp, 2 hfp, 3 both]", ret);
-        if (ret != 0)
-            return true;
-        else
-            return false;
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetBlueToothConnectedStatus");
+        // uint8_t ret = uapi_dev_runtime_get_br_connect_stat();
+        // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "br connect stat = %d [0 no connect, 1 a2dp, 2 hfp, 3 both]", ret);
+        // if (ret != 0)
+        //     return true;
+        // else
+        //     return false;
+        
+        return SettingModel::GetInstance().GetBlueToothConnectStatus();
     }
 
-    /// @brief 连接状态
+    /// @brief 初始化与连接状态相关组件
     /// @param  void
-    void PullUpDownView::InitTimeDateWeekLabelAndConnectedStatusImage(void)
+    void PullUpDownView::InitConnectedStatusImage(void)
     {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::InitTimeDateWeekLabelAndConnectedStatusImage");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::InitConnectedStatusImage");
         connectedStatusBackgroundButton = new UIButton();
         if (connectedStatusBackgroundButton == nullptr)
         {
@@ -406,10 +467,10 @@ namespace OHOS
         connectedStatusBackgroundButton->SetViewId(CONNECTEDSTATUSBACKGROUNDBUTTON);
         connectedStatusBackgroundButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
         connectedStatusBackgroundButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
-        // connectedStatusBackgroundButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
-        // connectedStatusBackgroundButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
-        // connectedStatusBackgroundButton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);
-        // connectedStatusBackgroundButton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);
+        connectedStatusBackgroundButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+        connectedStatusBackgroundButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+        connectedStatusBackgroundButton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);
+        connectedStatusBackgroundButton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);
         UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::MainPresenterSample::GetInstance();
         connectedStatusBackgroundButton->SetOnClickListener(clickListener);
         group[DROPDOWNVIEW]->Add(connectedStatusBackgroundButton);
@@ -464,7 +525,7 @@ namespace OHOS
         showBluetoothConnectedStatus->SetAutoEnable(false);
         showBluetoothConnectedStatus->SetResizeMode(UIImageView::CENTER);
         showBluetoothConnectedStatus->SetStyle(STYLE_BORDER_RADIUS, 30);
-        if (GetBluetoothConnectedStatus()) // 获取蓝牙连接状态
+        if (GetBlueToothConnectedStatus()) // 获取蓝牙连接状态
         {
             ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, DROPDOWN_BLUETOOTHCONNECTED);
         }
@@ -478,35 +539,6 @@ namespace OHOS
         group[DROPDOWNVIEW]->Add(showBluetoothConnectedStatus);
     }
 
-    // 清除所有与连接状态相关的视图组件
-    void PullUpDownView::ClearAllConnectedStatusComponentsView()
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::ClearAllConnectedStatusComponentsView");
-        if (connectedStatusBackgroundButton != nullptr)
-        {
-            delete connectedStatusBackgroundButton;
-            connectedStatusBackgroundButton = nullptr;
-        }
-
-        if (showPhoneConnectedStatus != nullptr)
-        {
-            delete showPhoneConnectedStatus;
-            showPhoneConnectedStatus = nullptr;
-        }
-
-        if (showEarPhoneConnectedStatus != nullptr)
-        {
-            delete showEarPhoneConnectedStatus;
-            showEarPhoneConnectedStatus = nullptr;
-        }
-
-        if (showBluetoothConnectedStatus != nullptr)
-        {
-            delete showBluetoothConnectedStatus;
-            showBluetoothConnectedStatus = nullptr;
-        }
-    }
-
     /***
      * @brief 初始化时间,日期,星期,电池,信号强度
      */
@@ -676,15 +708,14 @@ namespace OHOS
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::GetSignalStrength");
         int SignalStrength = uapi_dev_runtime_get_cat1_signal(); // 信号强度
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SignalStrength = %d", SignalStrength);
-
-        return SignalStrength;
+        return CalculateSignalBars(SignalStrength);
     }
 
+    // 计算信号格
     int PullUpDownView::CalculateSignalBars(int signalStrength)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::CalculateSignalBars");
-        if (signalStrength < 0 || signalStrength > 32)
+        if (signalStrength < 0 || signalStrength > 32 || signalStrength == 0)
             return 99; // 无信号 or Invalid signal strength
 
         // if (signalStrength == 32)
@@ -693,24 +724,143 @@ namespace OHOS
         return (signalStrength / 8) + 1;
     }
 
-    void PullUpDownView::UpdateSignalDisplay(int signalBars)
+#if 0
+    // 函数用于更新信号显示的UI
+    void PullUpDownView::updateSignalDisplay()
     {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateSignalDisplay");
-        bool noSignal = (signalBars == 99);
+        int sim = uapi_dev_runtime_get_cat1_simstat();
+        int cat1_powerOn = uapi_dev_runtime_get_cat1_powerstat();
+        int signal = uapi_dev_runtime_get_cat1_signal();
+        int network_on = uapi_dev_runtime_get_cat1_networkstat();
+        int cat1_network_type = uapi_dev_runtime_get_cat1_networtype();
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sim = %d", sim);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_powerOn = %d", cat1_powerOn);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "signal = %d", signal);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "network_on = %d", network_on);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_network_type = %d", cat1_network_type);
+
+        const int SIGNAL_NO_SIGNAL = 99;
+        const int NETWORK_TYPE_NO_NETWORK = 0;
+        const int NETWORK_TYPE_4G = 4;
+
+        if (sim == 0 || cat1_powerOn == 0)
+        {
+            // 无信号,无4G图标
+            UpdateCat1NoSignalisplay(true);
+            UpdateCat14GDisplay(false);
+            UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+        }
+        else if (cat1_powerOn == 1 && sim == 1)
+        {
+            if (signal == SIGNAL_NO_SIGNAL)
+            {
+                // 无信号UI显示
+                UpdateCat1NoSignalisplay(true);
+                UpdateCat14GDisplay(false);
+                UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+            }
+            else
+            {
+                // 信号强度显示
+                UpdateCat1NoSignalisplay(false);
+                UpdateCat14GDisplay(true);
+                UpdateSignalBarDisplay(CalculateSignalBars(signal), true);
+            }
+            if (network_on == 0)
+            {
+                // 无信号,无4G图标 显示
+                UpdateCat1NoSignalisplay(true);
+                UpdateCat14GDisplay(false);
+                UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+            }
+            else
+            {
+                if (cat1_network_type == NETWORK_TYPE_NO_NETWORK)
+                {
+                    // 无信号,无4G图标 显示
+                    UpdateCat1NoSignalisplay(true);
+                    UpdateCat14GDisplay(false);
+                    UpdateSignalBarDisplay(CalculateSignalBars(signal), false);
+                }
+                else if (cat1_network_type == NETWORK_TYPE_4G)
+                {
+                    // 有4G图标,正常显示信号
+                    UpdateCat1NoSignalisplay(false);
+                    UpdateCat14GDisplay(true);
+                    UpdateSignalBarDisplay(CalculateSignalBars(signal), true);
+                }
+                else
+                {
+                    // 无4G图标,正常显示信号
+                    UpdateCat1NoSignalisplay(false);
+                    UpdateCat14GDisplay(false);
+                    UpdateSignalBarDisplay(CalculateSignalBars(signal), true);
+                }
+            }
+        }
+    }
+#else
+    // 函数用于更新信号显示的UI
+    void PullUpDownView::updateSignalDisplay()
+    {
+        int sim = uapi_dev_runtime_get_cat1_simstat();
+        int cat1_powerOn = uapi_dev_runtime_get_cat1_powerstat();
+        int signal = uapi_dev_runtime_get_cat1_signal();
+        int network_on = uapi_dev_runtime_get_cat1_networkstat();
+        int cat1_network_type = uapi_dev_runtime_get_cat1_networtype();
+
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sim = %d", sim);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_powerOn = %d", cat1_powerOn);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "signal = %d", signal);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "network_on = %d", network_on);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cat1_network_type = %d", cat1_network_type);
+
+        const int SIGNAL_NO_SIGNAL = 99;
+        const int NETWORK_TYPE_NO_NETWORK = 0;
+        const int NETWORK_TYPE_4G = 4;
+
+        bool showNoSignalUI = (sim == 0 || cat1_powerOn == 0 || signal == SIGNAL_NO_SIGNAL);
+        bool showNoNetworkUI = (network_on == 0 || cat1_network_type == NETWORK_TYPE_NO_NETWORK);
+
+        bool show4GIcon = (cat1_network_type == NETWORK_TYPE_4G);
+
+        UpdateCat1NoSignalisplay(showNoSignalUI);
+        UpdateCat14GDisplay(show4GIcon);
+        UpdateSignalBarDisplay(CalculateSignalBars(signal), !(showNoSignalUI || showNoNetworkUI));
+    }
+#endif
+
+    // 更新信号强度显示
+    void PullUpDownView::UpdateSignalBarDisplay(int signalBars, bool state)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateSignalBarDisplay");
         for (int i = 0; i < 4; i++)
         {
             showSignalStrength[i]->SetStyle(STYLE_BACKGROUND_COLOR, (i < signalBars) ? COLOR_SIGNAL_ON : COLOR_SIGNAL_OFF);
             showSignalStrength[i]->Invalidate();
-            showSignalStrength[i]->SetVisible(!noSignal);
+            showSignalStrength[i]->SetVisible(state);
         }
-        if (noSignal == true)
-            Singal_4->SetVisible(false);
-        else
-            Singal_4->SetVisible(true);
+    }
+
+    // 更新无信号图标显示
+    void PullUpDownView::UpdateCat1NoSignalisplay(bool state)
+    {
+        if (NoSignal != nullptr)
+        {
+            NoSignal->SetVisible(state);
+        }
+    }
 
-        NoSignal->SetVisible(noSignal);
+    // 更新4G图标显示
+    void PullUpDownView::UpdateCat14GDisplay(bool state)
+    {
+        if (Singal_4 != nullptr)
+        {
+            Singal_4->SetVisible(state);
+        }
     }
 
+    // 更新电池位置
     void PullUpDownView::UpdateBatteryPosition(int signalBars)
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateBatteryPosition");
@@ -731,39 +881,12 @@ namespace OHOS
     // 更新信号强度和电池位置
     void PullUpDownView::UpdateSignalStrengthStatusAndBatteryPosition()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateSignalStrengthStatusAndBatteryPosition");
-        int signalBars = CalculateSignalBars(GetSignalStrength());
-        UpdateSignalDisplay(signalBars);
-        UpdateBatteryPosition(signalBars);
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateSignalStrengthStatusAndBatteryPosition");
+        updateSignalDisplay();
+        UpdateBatteryPosition(GetSignalStrength());
     }
 
-    // 清除信号强度相关组件
-    void PullUpDownView::ClearAllSingalComponentsView()
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::ClearAllSingalComponentsView");
-        if (NoSignal != nullptr)
-        {
-            delete NoSignal;
-            NoSignal = nullptr;
-        }
-
-        for (int i = 0; i < 4; i++)
-        {
-            if (showSignalStrength[i] != nullptr)
-            {
-                delete showSignalStrength[i];
-                showSignalStrength[i] = nullptr;
-            }
-        }
-
-        if (Singal_4 != nullptr)
-        {
-            delete Singal_4;
-            Singal_4 = nullptr;
-        }
-    }
-
-    bool PullUpDownView::InitView()
+    bool PullUpDownView::PullUpDownViewInit()
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::InitView");
 
@@ -778,7 +901,7 @@ namespace OHOS
         group[DROPDOWNVIEW]->SetViewIndex(0);
         group[DROPDOWNVIEW]->SetFullScreenBlur(true);
         InitViewImg();
-        InitTimeDateWeekLabelAndConnectedStatusImage();
+        InitConnectedStatusImage();
 
         if (InitBaseData())
         {
@@ -800,28 +923,62 @@ namespace OHOS
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::PreLoad");
         if (!viewiInitStatus)
         {
-            InitView();
+            PullUpDownViewInit();
             viewiInitStatus = true;
         }
     }
 
-    void PullUpDownView::UpdateBlueToothStatus(int status)
+    // 更新手机连接状态
+    void PullUpDownView::UpdatePhoneStatus(int status)
     {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateBlueToothStatus");
-        if (showBluetoothConnectedStatus == nullptr)
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdatePhoneStatus");
+        if (showPhoneConnectedStatus == nullptr)
         {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showBluetoothConnectedStatus nullptr");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showPhoneConnectedStatus nullptr");
             return;
         }
-        if (status == 1)
+        ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showPhoneConnectedStatus, (status ? DROPDOWN_PHONECONNECTED : DROPDOWN_PHONEDISCONNECTED));
+        showPhoneConnectedStatus->Invalidate();
+
+        if (GetConnectedStatusView() != nullptr)
+            GetConnectedStatusView()->UpdatePhoneConnectedStatus(status);
+
+        return;
+    }
+
+    // 更新蓝牙耳机连接状态
+    void PullUpDownView::UpdateEarPhoneStatus(int status)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateEarPhoneStatus");
+        if (showEarPhoneConnectedStatus == nullptr)
         {
-            ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, DROPDOWN_BLUETOOTHCONNECTED);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showEarPhoneConnectedStatus nullptr");
+            return;
         }
-        else
+        ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showEarPhoneConnectedStatus, (status ? DROPDOWN_EARPHONESCONNECTED : DROPDOWN_EARPHONESDISCONNECTED));
+        showPhoneConnectedStatus->Invalidate();
+
+        if (GetConnectedStatusView() != nullptr)
+            GetConnectedStatusView()->UpdateEarPhoneConnectedStatus(status);
+
+        return;
+    }
+
+    // 更新蓝牙连接状态
+    void PullUpDownView::UpdateBlueToothStatus(int status)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::UpdateBlueToothStatus");
+        if (showBluetoothConnectedStatus == nullptr)
         {
-            ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, DROPDOWN_BLUETOOTHDISCONNECTED);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showBluetoothConnectedStatus nullptr");
+            return;
         }
-        showBluetoothConnectedStatus->Invalidate();
+        ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, (status ? DROPDOWN_BLUETOOTHCONNECTED : DROPDOWN_BLUETOOTHDISCONNECTED));
+        showPhoneConnectedStatus->Invalidate();
+
+        if (GetConnectedStatusView() != nullptr)
+            GetConnectedStatusView()->UpdateBlueToothConnectedStatus(status);
+
         return;
     }
 
@@ -872,7 +1029,7 @@ namespace OHOS
     {
         return progress;
     }
-    /* -------------------------------------------------------------------------- */
+    /* ------------------------------ 下拉界面切换到连接状态视图 ----------------------------- */
     // 切换到"下拉控制中心"视图
     bool PullUpDownView::ChangeDropDownView(int16_t thisView)
     {
@@ -949,4 +1106,5 @@ namespace OHOS
     {
         return connectedStatusView;
     }
+    /* -------------------------------------------------------------------------- */
 }
index 3c8c478..d7d7d36 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-03-30 09:14:38
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-23 10:49:06
+ * @LastEditTime: 2024-06-17 18:34:09
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingModel.h
  */
 
@@ -27,7 +27,11 @@ namespace OHOS
         void InitSettingItem();
         const SettingItem *GetSettinglistItems() const;
         uint8_t GetSettingListNum() const;
+        bool GetPhoneConnectStatus(void);
+        bool GetEarPhoneConnectStatus(void);
         bool GetBlueToothConnectStatus(void);
+        void UpdatePhoneConnectStatus(bool status);
+        void UpdateEarPhoneConnectStatus(bool status);
         void UpdateBlueToothConnectStatus(bool status);
 
     private:
@@ -37,6 +41,8 @@ namespace OHOS
         virtual ~SettingModel();
         SettingItem settings[SETTING_ITEM_COUNT] = {VIEW_INVALID, nullptr, STR_EXERCISE_GENERAL, false};
         int usedLen;
+        bool phoneConnectStatus{false};
+        bool earphoneConnectStatus{false};
         bool btConnectStatus{false};
     };
 }
index 84542fa..abce341 100644 (file)
@@ -2,11 +2,11 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-02-18 09:09:13
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-14 18:43:36
+ * @LastEditTime: 2024-06-17 18:34:15
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp
  */
-#include "SettingModel.h"
-#include "PullUpDownView.h"
+#include "settings/include/SettingModel.h"
+#include "main/include/PullUpDownView.h"
 #include "language/font/ui_resource_string.h"
 namespace OHOS
 {
@@ -44,11 +44,45 @@ namespace OHOS
         return usedLen;
     }
 
+    // 获取手机连接状态
+    bool SettingModel::GetPhoneConnectStatus(void)
+    {
+        return phoneConnectStatus;
+    }
+    
+    // 获取蓝牙耳机连接状态
+    bool SettingModel::GetEarPhoneConnectStatus(void)
+    {
+        return earphoneConnectStatus;
+    }
+
+    // 获取蓝牙连接状态
     bool SettingModel::GetBlueToothConnectStatus(void)
     {
         return btConnectStatus;
     }
 
+    // 更新手机连接状态
+    void SettingModel::UpdatePhoneConnectStatus(bool status)
+    {
+        phoneConnectStatus = status;
+        if (PullUpDownView::GetInstance() != nullptr)
+        {
+            PullUpDownView::GetInstance()->UpdatePhoneStatus(status);
+        }
+    }
+
+    // 更新耳机连接状态
+    void SettingModel::UpdateEarPhoneConnectStatus(bool status)
+    {
+        earphoneConnectStatus = status;
+        if (PullUpDownView::GetInstance() != nullptr)
+        {
+            PullUpDownView::GetInstance()->UpdateEarPhoneStatus(status);
+        }
+    }
+
+    // 更新蓝牙连接状态
     void SettingModel::UpdateBlueToothConnectStatus(bool status)
     {
         btConnectStatus = status;
index 823ad18..002a7f6 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-12 11:44:04
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-17 17:43:25
+ * @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/uiservice/include/ui_service.h
+ */
 /*
  * Copyright (c) 2021-2021 CompanyNameMagicTag.
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,8 +49,12 @@ struct UiService {
 typedef enum {
     JS_INSTALL_SUCESS_TO_UI,
     JS_UNINSTALL_SUCESS_TO_UI,
-    BT_CONNECTED_TO_UI,
-    BT_DISCONNECTED_TO_UI,
+    PHONE_CONNECTED_TO_UI,      //手机连接成功
+    PHONE_DISCONNECTED_TO_UI,   //手机断开连接
+    EARPHONE_CONNECTED_TO_UI,   //耳机连接成功
+    EARPHONE_DISCONNECTED_TO_UI,//耳机断开连接
+    BT_CONNECTED_TO_UI,         //蓝牙连接成功
+    BT_DISCONNECTED_TO_UI,      //蓝牙断开连接
     SCREEN_TURN_ON_TO_UI,
     SCREEN_TURN_OFF_TO_UI,
     SCREEN_OFF_ENABLE_TO_UI,
index ed8408e..6320d04 100644 (file)
  * limitations under the License.
  */
 
-#include "ui_service.h"
+#include "uiservice/include/ui_service.h"
 #include "wearable_log.h"
 #include "samgr_lite.h"
-#include "SettingModel.h"
+#include "settings/include/SettingModel.h"
 #include "UiServersMsg.h"
 #include "ohos_init.h"
 #include "memory_adapter.h"
@@ -145,6 +145,22 @@ void ServiceMsgProcess(Request *request)
             GraphicService::GetInstance()->PostGraphicEvent(
                 std::bind(&OHOS::ApplistModel::ApplistUpdate, &OHOS::ApplistModel::GetInstance()));
             break;
+        case PHONE_CONNECTED_TO_UI:
+            GraphicService::GetInstance()->PostGraphicEvent(
+                std::bind(&OHOS::SettingModel::UpdatePhoneConnectStatus, &OHOS::SettingModel::GetInstance(), true));
+            break;
+        case PHONE_DISCONNECTED_TO_UI:
+            GraphicService::GetInstance()->PostGraphicEvent(
+                std::bind(&OHOS::SettingModel::UpdatePhoneConnectStatus, &OHOS::SettingModel::GetInstance(), false));
+            break;
+        case EARPHONE_CONNECTED_TO_UI:
+            GraphicService::GetInstance()->PostGraphicEvent(
+                std::bind(&OHOS::SettingModel::UpdateEarPhoneConnectStatus, &OHOS::SettingModel::GetInstance(), true));
+            break;
+        case EARPHONE_DISCONNECTED_TO_UI:
+            GraphicService::GetInstance()->PostGraphicEvent(
+                std::bind(&OHOS::SettingModel::UpdateEarPhoneConnectStatus, &OHOS::SettingModel::GetInstance(), false));
+            break;
         case BT_CONNECTED_TO_UI:
             GraphicService::GetInstance()->PostGraphicEvent(
                 std::bind(&OHOS::SettingModel::UpdateBlueToothConnectStatus, &OHOS::SettingModel::GetInstance(), true));
index 9ce1fe9..9cce81b 100644 (file)
@@ -92,6 +92,7 @@ void uapi_dev_runtime_set_cat1_networkstat(uint8_t network_on)
 {
     g_runtime.cat1_runtime.network_on=network_on;
 }
+//获取网络开启状态
 uint8_t uapi_dev_runtime_get_cat1_networkstat(void)
 {
     return g_runtime.cat1_runtime.network_on;
@@ -102,6 +103,7 @@ void uapi_dev_runtime_set_cat1_signal(int signal)
 {
     g_runtime.cat1_runtime.signal=signal;
 }
+//获取cat1信号强度
 int uapi_dev_runtime_get_cat1_signal(void)
 {
     return g_runtime.cat1_runtime.signal;
@@ -111,6 +113,7 @@ void uapi_dev_runtime_set_cat1_simstat(int simstat)
 {
     g_runtime.cat1_runtime.sim=simstat;
 }
+//获取cat1的sim卡状态
 int uapi_dev_runtime_get_cat1_simstat(void)
 {
     return g_runtime.cat1_runtime.sim;
@@ -120,6 +123,7 @@ void uapi_dev_runtime_set_cat1_networktype(uint8_t networtype)
 {
     g_runtime.cat1_runtime.cat1_network_type=networtype;
 }
+//获取网络类型
 uint8_t uapi_dev_runtime_get_cat1_networtype(void)
 {
     return g_runtime.cat1_runtime.cat1_network_type;