优化PPP test UI显示
authorpenglei <1624952103@qq.com>
Wed, 15 Oct 2025 06:05:22 +0000 (14:05 +0800)
committerpenglei <1624952103@qq.com>
Wed, 15 Oct 2025 06:05:22 +0000 (14:05 +0800)
code/sdk/zhihui/leiniao/factory_test/PPPTestView.cpp

index a1396ef..8c32288 100644 (file)
+#include "PPPTestView.h"
+#include "PPPTestModel.h"
+#include "PPPTestPresenter.h"
 #include "components/ui_scroll_view.h"
 #include "components/root_view.h"
 #include "components/ui_label.h"
+#include "components/ui_view_group.h"
 #include "common/screen.h"
 #include "UiConfig.h"
 #include "gfx_utils/style.h"
 #include "graphic_config.h"
-#include "cmsis_os2.h"
-
-// C标准库
+#include "ui_resource_image.h"
+#include "../../utils/custom_utils.h"
+#include "../../utils/custom_runtime.h"
 #include <stdio.h>
 #include <string.h>
-#include <stdlib.h>
-
-// 预声明必要的类型以避免循环依赖
-typedef int ppp_error_t;
-
-// PPP错误码常量
-#define PPP_ERR_OK                0
-#define PPP_ERR_TIMEOUT           1
-#define PPP_ERR_AT_FAILED         2
-#define PPP_ERR_DIAL_FAILED       3
-#define PPP_ERR_NO_CARRIER        4
-#define PPP_ERR_BUSY              5
-#define PPP_ERR_NO_DIALTONE       6
-#define PPP_ERR_INVALID_PARAM     7
-#define PPP_ERR_MEMORY            8
-#define PPP_ERR_UART              9
-#define PPP_ERR_INVALID_STATE     10
-#define PPP_ERR_UNKNOWN           11
+#include <time.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// 仅包含必要的头文件
-#include "errcode.h"
-#include "service/graphic_service_wrapper.h"
-
-// 确保有这些常量定义(如果errcode.h没有定义的话)
-#ifndef ERRCODE_SUCC
-#define ERRCODE_SUCC  0
-#endif
-#ifndef ERRCODE_FAIL  
-#define ERRCODE_FAIL  1
-#endif
-
-// 前向声明结构体
-struct ppp_network_signal_info_s;
-typedef struct ppp_network_signal_info_s ppp_network_signal_info_t;
-
-// 声明需要使用的函数
-int ppp_env_init(void);
-errcode_t ppp_api_update_all_runtime_status(void);
-ppp_error_t ppp_at_get_network_signal_info(ppp_network_signal_info_t *info);
-errcode_t ppp_get_network_signal_info(void);
-
-// CAT1 API 声明
-uint8_t cat1_api_runtime_get_cat1_powerstat(void);
-uint8_t cat1_api_runtime_get_cat1_networkstat(void);
-int cat1_api_runtime_get_cat1_signal(void);
-int cat1_api_runtime_get_cat1_simstat(void);
-uint8_t cat1_api_runtime_get_cat1_networktype(void);
-char* cat1_api_runtime_get_cat1_operator(void);
-char* cat1_api_runtime_get_cat1_imei(void);
-char* cat1_api_runtime_get_cat1_iccid(void);
-char* cat1_api_runtime_get_cat1_modemver(void);
-
-// 屏幕控制 API 声明
-void uapi_set_screen_on_api(void);
-void ScreenAlwaysOnCtr(int enable);
+namespace OHOS
+{
+    static const uint32_t BACK_GROUND_COLOR = 0xff000000; // 黑色背景
+    static const uint32_t TEXT_COLOR = 0xffffffff;        // 白色文字
+    static const uint32_t TITLE_COLOR = 0xff00ff00;       // 绿色标题
+    static PPPTestView *g_pPPPTestView = nullptr;
 
-#ifdef __cplusplus
-}
-#endif
-
-// 定义信号信息结构体(避免包含完整头文件)
-struct ppp_network_signal_info_s {
-    int16_t rxlev;
-    int16_t ber;
-    int16_t rscp;
-    int16_t ecno;
-    int16_t rsrq;
-    int16_t rsrp;
-    bool valid;
-};
-
-// 全局变量
-static OHOS::UIScrollView* g_ppp_test_view = nullptr;
-static OHOS::UIView* g_ppp_saved_view = nullptr;
-static OHOS::UILabel* g_ppp_status_labels[12] = {nullptr}; // 增加到12个标签:标题+11个状态(VER占两行)
-static OHOS::UILabel* g_ppp_title_label = nullptr;
-
-// PPP初始化状态
-static bool g_ppp_init_completed = false;
-static bool g_ppp_init_in_progress = false;
-static int g_ppp_init_retry_count = 0;
-static const int MAX_PPP_INIT_RETRIES = 5;
-
-// 定时器相关
-static osTimerId_t g_ppp_init_timer = NULL;
-static osTimerId_t g_ppp_refresh_timer = NULL;
-static const uint32_t PPP_INIT_TIMEOUT_MS = 5000; // 5秒超时
-static const uint32_t PPP_REFRESH_INTERVAL_MS = 5000; // 5秒刷新间隔(减少定时器冲突)
-
-// 标签配置结构体 - 参考testCAT1的设计
-typedef struct {
+    // 标签配置结构体
+    struct PPPLabelConfig_t {
     int left;
     int top;
     int width;
     int height;
-    uint16_t fontSize;
-    uint16_t lineHeight;
+        uint32_t textColor;
+        uint8_t fontSize;
     const char* text;
-    OHOS::UILabel::LineBreakMode lineBreakMode;
-} PPPLabelConfig_t;
+    };
 
-// 创建标签的辅助函数 - 优化为圆形LCD布局
-static OHOS::UILabel* create_ppp_label(const PPPLabelConfig_t& config) {
-    OHOS::UILabel* label = new OHOS::UILabel();
-    if (label == nullptr) {
-        return nullptr;
+    PPPTestView::PPPTestView() 
+    {
+        g_pPPPTestView = this;
+        testView_ = nullptr;
+        savedCurrentView_ = nullptr;
+        titleLabel_ = nullptr;
+        viewInitStatus_ = false;
+        isTestActive_ = false;
+        currentStatus_ = PPPTestStatus::Idle;
+        
+        // 初始化状态标签数组
+        for (int i = 0; i < MAX_STATUS_LABELS; i++) {
+            statusLabels_[i] = nullptr;
+        }
     }
-    
-    label->SetPosition(config.left, config.top, config.width, config.height);
-    label->SetText(config.text);
-    label->SetFont(OHOS::DEFAULT_VECTOR_FONT_FILENAME, config.fontSize);
-    label->SetStyle(OHOS::STYLE_TEXT_COLOR, OHOS::Color::White().full);
-    label->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0);
-    label->SetStyle(OHOS::STYLE_TEXT_FONT, config.fontSize);
-    label->SetStyle(OHOS::STYLE_LINE_HEIGHT, config.lineHeight);
-    label->SetAlign(OHOS::TEXT_ALIGNMENT_LEFT);
-    label->SetLineBreakMode(config.lineBreakMode);
-    
-    
-    return label;
-}
 
-// 更新PPP运行状态显示 - 统一格式结构
-static void update_ppp_runtime_status_display() {
-    if (!g_ppp_init_completed) {
-        return;
+    PPPTestView::~PPPTestView()
+    {
+        DeInit();
+        g_pPPPTestView = nullptr;
     }
-    
-    printf("=== 更新PPP运行状态显示 ===\n");
-    
-    // 更新所有运行时状态
-    #if SUPPORT_PPP_SERVICE 
-    errcode_t ret = ppp_api_update_all_runtime_status();
-    #else
-    errcode_t ret = ERRCODE_SUCC;
-    #endif
-    if (ret != ERRCODE_SUCC) {
-        printf("更新PPP运行状态失败: %d\n", ret);
+
+    PPPTestView *PPPTestView::GetInstance() 
+    { 
+        return g_pPPPTestView; 
+    }
+
+    void PPPTestView::OnStart()
+    {
+        printf("PPPTestView::OnStart\n");
+        InitView();
+    }
+
+    void PPPTestView::InitView()
+    {
+        if (viewInitStatus_) {
+            printf("PPPTestView already initialized\n");
         return;
     }
     
-    // 使用malloc动态分配,避免栈溢出
-    char* buffer = (char*)malloc(200);
-    if (buffer == NULL) {
-        printf("ERROR: Failed to allocate buffer for PPP status display\n");
+        printf("Initializing PPPTestView\n");
+
+        // 创建主滚动视图
+        if (scrollview_ == nullptr) {
+            scrollview_ = new UIScrollView();
+            if (scrollview_ == nullptr) {
+                printf("ERROR: Failed to create main scroll view\n");
                 return;
             }
 
-    int label_index = 1; // 跳过标题,从索引1开始
-    
-    // 1. SIM卡插入状态
-    if (g_ppp_status_labels[label_index] != nullptr) {
-        int sim_stat = cat1_api_runtime_get_cat1_simstat();
-        const char* sim_desc;
-        switch(sim_stat) {
-            case 0: sim_desc = "未插入"; break;
-            case 1: sim_desc = "已插入"; break;
-            case 2: sim_desc = "被锁定"; break;
-            case 3: sim_desc = "已损坏"; break;
-            default: sim_desc = "状态未知"; break;
-        }
-        snprintf(buffer, 200, "SIM状态: %s", sim_desc);
-        g_ppp_status_labels[label_index]->SetText(buffer);
-        g_ppp_status_labels[label_index]->SetVisible(true);
-        g_ppp_status_labels[label_index]->Invalidate();
-        printf("设置SIM状态标签[%d]: %s\n", label_index, buffer);
-        label_index++;
-    }
-    
-    // 2. IMEI信息
-    if (g_ppp_status_labels[label_index] != nullptr) {
-        char* imei = cat1_api_runtime_get_cat1_imei();
-        snprintf(buffer, 200, "IMEI: %s", 
-                (imei && strlen(imei) > 0) ? imei : "未知");
-        g_ppp_status_labels[label_index]->SetText(buffer);
-        g_ppp_status_labels[label_index]->SetVisible(true);
-        g_ppp_status_labels[label_index]->Invalidate();
-        printf("设置IMEI标签[%d]: %s\n", label_index, buffer);
-        label_index++;
+            scrollview_->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            scrollview_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            scrollview_->SetStyle(STYLE_BACKGROUND_COLOR, BACK_GROUND_COLOR);
+            scrollview_->SetTouchable(true);
+            scrollview_->SetDraggable(true);
+            scrollview_->SetVisible(true);
+
+            // 不需要事件监听器
+        }
+
+        viewInitStatus_ = true;
+        printf("PPPTestView initialized successfully\n");
     }
-    
-    // 3. ICCID信息
-    if (g_ppp_status_labels[label_index] != nullptr) {
-        char* iccid = cat1_api_runtime_get_cat1_iccid();
-        snprintf(buffer, 200, "ICCID: %s", 
-                (iccid && strlen(iccid) > 0) ? iccid : "未知");
-        g_ppp_status_labels[label_index]->SetText(buffer);
-        g_ppp_status_labels[label_index]->SetVisible(true);
-        g_ppp_status_labels[label_index]->Invalidate();
-        printf("设置ICCID标签[%d]: %s\n", label_index, buffer);
-        label_index++;
-    }
-    
-    // 4. 版本信息 (临时屏蔽)
-    /*
-    if (g_ppp_status_labels[label_index] != nullptr) {
-        char* version = cat1_api_runtime_get_cat1_modemver();
-        if (version && strlen(version) > 0) {
-            // 使用换行符在一个标签中显示VER和版本号
-            snprintf(buffer, sizeof(buffer), "VER:\n%s", version);
-        } else {
-            snprintf(buffer, sizeof(buffer), "VER:\n未知");
+
+    void PPPTestView::DeInit()
+    {
+        if (!viewInitStatus_) {
+            return;
+        }
+
+        printf("Deinitializing PPPTestView\n");
+
+        // 停止测试(如果正在运行)
+        if (isTestActive_) {
+            StopPPPTest();
+        }
+
+        // 清理主视图
+        if (scrollview_ != nullptr) {
+            RootView* rootView = RootView::GetInstance();
+            if (rootView && scrollview_->GetParent() == rootView) {
+                rootView->Remove(scrollview_);
+            }
+            delete scrollview_;
+            scrollview_ = nullptr;
         }
-        g_ppp_status_labels[label_index]->SetText(buffer);
-        label_index++;
+
+        viewInitStatus_ = false;
     }
-    */
-    
-    // 4. 信号强度信息
-    if (g_ppp_status_labels[label_index] != nullptr) {
-        int signal = cat1_api_runtime_get_cat1_signal();
-        const char* signal_desc;
-        if (signal == 99) {
-            signal_desc = "无信号";
-            snprintf(buffer, 200, "信号强度: %s", signal_desc);
-        } else {
-            // 根据信号强度分级
-            if (signal >= 20) signal_desc = "极强";
-            else if (signal >= 15) signal_desc = "强";
-            else if (signal >= 10) signal_desc = "中等";
-            else if (signal >= 5) signal_desc = "弱";
-            else signal_desc = "极弱";
+
+    void PPPTestView::PreLoad()
+    {
+        printf("PPPTestView::PreLoad\n");
+        InitView();
+    }
+
+    void PPPTestView::StartPPPTest()
+    {
+        if (isTestActive_) {
+            printf("PPP test already active\n");
+            return;
+        }
+
+        printf("Starting PPP test view\n");
+        
+        RootView* rootView = RootView::GetInstance();
+        if (rootView == nullptr) {
+            printf("ERROR: RootView not initialized\n");
+            return;
+        }
+        
+        // 保存当前显示的view
+        savedCurrentView_ = rootView->GetChildrenHead();
+        if (savedCurrentView_ != nullptr && savedCurrentView_ != scrollview_) {
+            rootView->Remove(savedCurrentView_);
+            printf("Saved and removed current view for later restore\n");
+        }
+        
+        // 创建PPP测试视图
+        if (testView_ == nullptr) {
+            testView_ = new UIScrollView();
+            if (testView_ == nullptr) {
+                printf("ERROR: Failed to create PPP test view\n");
+                return;
+            }
+        }
+        
+        SetupScrollView();
+        CreateLabels();
+        
+        // 添加到根视图
+        rootView->Add(testView_);
+        rootView->Invalidate();
+
+        isTestActive_ = true;
+        printf("PPP test started\n");
+    }
+
+    void PPPTestView::StopPPPTest()
+    {
+        if (!isTestActive_) {
+            printf("PPP test not active\n");
+            return;
+        }
+
+        printf("Stopping PPP test view\n");
+        
+        RootView* rootView = RootView::GetInstance();
+        if (rootView != nullptr) {
+            // 删除PPP测试view
+            if (testView_ != nullptr) {
+                rootView->Remove(testView_);
+                DestroyLabels();
+                delete testView_;
+                testView_ = nullptr;
+                printf("PPP test view removed\n");
+            }
             
-            snprintf(buffer, 200, "信号强度: %d (%s)", signal, signal_desc);
+            // 恢复原来的view
+            if (savedCurrentView_ != nullptr) {
+                printf("Attempting to restore view at address: %p\n", savedCurrentView_);
+                
+                if (savedCurrentView_->GetParent() == nullptr) {
+                    rootView->Add(savedCurrentView_);
+                    rootView->Invalidate();
+                    printf("Original view restored successfully\n");
+                } else {
+                    printf("Warning: Original view still has parent, cannot restore\n");
+                }
+                savedCurrentView_ = nullptr;
+            } else {
+                printf("No original view to restore\n");
+            }
         }
-        g_ppp_status_labels[label_index]->SetText(buffer);
-        g_ppp_status_labels[label_index]->SetVisible(true);
-        g_ppp_status_labels[label_index]->Invalidate();
-        printf("设置信号强度标签[%d]: %s\n", label_index, buffer);
-        label_index++;
+
+        isTestActive_ = false;
+        currentStatus_ = PPPTestStatus::Idle;
     }
-    
-    // 5. 网络状态信息
-    if (g_ppp_status_labels[label_index] != nullptr && label_index < 4) {
-        uint8_t network_stat = cat1_api_runtime_get_cat1_networkstat();
-        const char* network_desc;
-        switch(network_stat) {
-            case 0: network_desc = "未注册"; break;
-            case 1: network_desc = "已注册(本地网络)"; break;
-            case 2: network_desc = "搜索中"; break;
-            case 3: network_desc = "注册被拒绝"; break;
-            case 5: network_desc = "已注册(漫游)"; break;
-            default: network_desc = "未知状态"; break;
-        }
-        snprintf(buffer, 200, "网络状态: %s", network_desc);
-        g_ppp_status_labels[label_index]->SetText(buffer);
-        g_ppp_status_labels[label_index]->SetVisible(true);
-        g_ppp_status_labels[label_index]->Invalidate();
-        printf("设置网络状态标签[%d]: %s\n", label_index, buffer);
-        label_index++;
-    }
-    
-    // 清空基本状态部分后面的剩余标签(为信号质量部分预留空间)
-    for (int i = label_index; i < 5; i++) {
-        if (g_ppp_status_labels[i] != nullptr) {
-            g_ppp_status_labels[i]->SetText("");
-            g_ppp_status_labels[i]->SetVisible(true); // 保持可见,待信号质量更新
+
+    void PPPTestView::RefreshPPPData()
+    {
+        if (!isTestActive_) {
+            printf("PPP test not active, cannot refresh\n");
+            return;
         }
+
+        printf("Refreshing PPP test data display\n");
+        UpdateDisplay();
     }
-    
-    // 确保信号质量标签也是可见和可用的
-    for (int i = 5; i < 12; i++) {
-        if (g_ppp_status_labels[i] != nullptr) {
-            g_ppp_status_labels[i]->SetVisible(true); // 确保信号质量标签可见
+
+    void PPPTestView::SetupScrollView()
+    {
+        if (testView_ == nullptr) return;
+        
+        // 设置PPP测试视图 - 适配360x360圆形LCD
+        testView_->SetPosition(0, 0, 360, 360);
+        testView_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        testView_->SetStyle(STYLE_BACKGROUND_COLOR, BACK_GROUND_COLOR);
+        testView_->SetStyle(STYLE_BORDER_RADIUS, 0);
+        testView_->SetTouchable(true);
+        testView_->SetDraggable(true);
+        testView_->SetVisible(true);
+        testView_->SetYScrollBarVisible(true);
+        testView_->SetScrollBlankSize(30);
+        
+        // 不需要事件监听器
+    }
+
+    void PPPTestView::CreateLabels()
+    {
+        if (testView_ == nullptr) return;
+        
+        // 创建标题标签
+        PPPLabelConfig_t titleConfig = {
+            .left = 114,
+            .top = 10,
+            .width = 132,
+            .height = 28,
+            .textColor = TITLE_COLOR,
+            .fontSize = 20,
+            .text = "PPP测试"
+        };
+        
+        titleLabel_ = new UILabel();
+        if (titleLabel_) {
+            titleLabel_->SetPosition(titleConfig.left, titleConfig.top, 
+                                   titleConfig.width, titleConfig.height);
+            titleLabel_->SetText(titleConfig.text);
+            titleLabel_->SetFont("SourceHanSansSC-Regular.otf", titleConfig.fontSize);
+            titleLabel_->SetStyle(STYLE_TEXT_COLOR, titleConfig.textColor);
+            titleLabel_->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER);
+            testView_->Add(titleLabel_);
+        }
+        
+        // 创建状态标签
+        const char* labelTexts[] = {
+            "状态: 初始化中...",
+            "电源: 未知",
+            "网络: 未知", 
+            "信号: 未知",
+            "SIM: 未知",
+            "网络类型: 未知",
+            "运营商: 未知",
+            "IMEI: 未知",
+            "ICCID: 未知",
+            "调制解调器: 未知",
+            "信号质量: 未知"
+        };
+        
+        for (int i = 0; i < MAX_STATUS_LABELS - 1 && i < 11; i++) {
+            statusLabels_[i] = new UILabel();
+            if (statusLabels_[i]) {
+                int yPos = 45 + (i * 32);
+                statusLabels_[i]->SetPosition(15, yPos, LABEL_WIDTH, LABEL_HEIGHT);
+                statusLabels_[i]->SetText(labelTexts[i]);
+                statusLabels_[i]->SetFont("SourceHanSansSC-Regular.otf", 16);
+                statusLabels_[i]->SetStyle(STYLE_TEXT_COLOR, TEXT_COLOR);
+                statusLabels_[i]->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT);
+                testView_->Add(statusLabels_[i]);
+            }
         }
+
     }
-    
-    printf("PPP运行状态显示更新完成\n");
-    
-    // 释放动态分配的内存
-    free(buffer);
-}
+
+    void PPPTestView::DestroyLabels()
+    {
+        if (titleLabel_) {
+            delete titleLabel_;
+            titleLabel_ = nullptr;
+        }
+        
+        for (int i = 0; i < MAX_STATUS_LABELS; i++) {
+            if (statusLabels_[i]) {
+                delete statusLabels_[i];
+                statusLabels_[i] = nullptr;
+            }
+        }
+    }
+
+    void PPPTestView::UpdateTestStatus(PPPTestStatus status)
+    {
+        currentStatus_ = status;
+        
+        if (!isTestActive_ || statusLabels_[0] == nullptr) return;
+        
+        const char* statusText = "";
+        switch (status) {
+            case PPPTestStatus::Idle:
+                statusText = "状态: 空闲";
+                break;
+            case PPPTestStatus::Initializing:
+                statusText = "状态: 初始化中...";
+                break;
+            case PPPTestStatus::Testing:
+                statusText = "状态: 测试中";
+                break;
+            case PPPTestStatus::Refreshing:
+                statusText = "状态: 刷新数据中...";
+                break;
+            case PPPTestStatus::Error:
+                statusText = "状态: 错误";
+                break;
+        }
+        
+        statusLabels_[0]->SetText(statusText);
+        RootView::GetInstance()->Invalidate();
+    }
+
+    void PPPTestView::UpdateNetworkInfo()
+    {
+        if (!isTestActive_ || !PPPTestModel::GetInstance()) return;
+        
+        const PPPStatusInfo& info = PPPTestModel::GetInstance()->GetStatusInfo();
+        if (!info.isValid) return;
+        
+        char buffer[256];
+        
+        // 更新电源状态
+        if (statusLabels_[1]) {
+            snprintf(buffer, sizeof(buffer), "电源: %s", info.powerStatus ? "开启" : "关闭");
+            statusLabels_[1]->SetText(buffer);
+        }
+        
+        // 更新网络状态
+        if (statusLabels_[2]) {
+            snprintf(buffer, sizeof(buffer), "网络: %s", info.networkStatus ? "已连接" : "未连接");
+            statusLabels_[2]->SetText(buffer);
+        }
+        
+        // 更新信号强度
+        if (statusLabels_[3]) {
+            snprintf(buffer, sizeof(buffer), "信号: %d", info.signalStrength);
+            statusLabels_[3]->SetText(buffer);
+        }
+        
+        // 更新SIM状态
+        if (statusLabels_[4]) {
+            const char* simStatus = PPPTestModel::GetInstance()->GetSimStatusName(info.simStatus);
+            snprintf(buffer, sizeof(buffer), "SIM: %s", simStatus);
+            statusLabels_[4]->SetText(buffer);
+        }
+        
+        // 更新网络类型
+        if (statusLabels_[5]) {
+            const char* networkType = PPPTestModel::GetInstance()->GetNetworkTypeName(info.networkType);
+            snprintf(buffer, sizeof(buffer), "网络类型: %s", networkType);
+            statusLabels_[5]->SetText(buffer);
+        }
+        
+        // 更新运营商
+        if (statusLabels_[6]) {
+            snprintf(buffer, sizeof(buffer), "运营商: %s", info.operatorName[0] ? info.operatorName : "未知");
+            statusLabels_[6]->SetText(buffer);
+        }
+        
+        RootView::GetInstance()->Invalidate();
+    }
+
+    void PPPTestView::UpdateSignalInfo()
+    {
+        if (!isTestActive_ || !PPPTestModel::GetInstance()) return;
+        
+        const PPPSignalInfo& info = PPPTestModel::GetInstance()->GetSignalInfo();
+        if (!info.isValid) return;
+        
+        char buffer[256];
+        
+        // 更新信号质量
+        if (statusLabels_[10]) {
+            if (info.rsrq != -1 && info.rsrp != -1) {
+                const char* levelName = PPPTestModel::GetInstance()->GetSignalLevelName(info.level);
+                snprintf(buffer, sizeof(buffer), "信号质量: RSRQ=%d RSRP=%d (%s)", 
+                        info.rsrq, info.rsrp, levelName);
+            } else {
+                snprintf(buffer, sizeof(buffer), "信号质量: 基本信号=%d", info.rxlev);
+            }
+            statusLabels_[10]->SetText(buffer);
+        }
+        
+        RootView::GetInstance()->Invalidate();
+    }
+
+    void PPPTestView::UpdateModemInfo()
+    {
+        if (!isTestActive_ || !PPPTestModel::GetInstance()) return;
+        
+        const PPPStatusInfo& info = PPPTestModel::GetInstance()->GetStatusInfo();
+        if (!info.isValid) return;
+        
+        char buffer[256];
+        
+        // 更新IMEI
+        if (statusLabels_[7]) {
+            snprintf(buffer, sizeof(buffer), "IMEI: %s", info.imei[0] ? info.imei : "未知");
+            statusLabels_[7]->SetText(buffer);
+        }
+        
+        // 更新ICCID
+        if (statusLabels_[8]) {
+            snprintf(buffer, sizeof(buffer), "ICCID: %s", info.iccid[0] ? info.iccid : "未知");
+            statusLabels_[8]->SetText(buffer);
+        }
+        
+        // 更新调制解调器版本
+        if (statusLabels_[9]) {
+            snprintf(buffer, sizeof(buffer), "调制解调器: %s", 
+                    info.modemVersion[0] ? info.modemVersion : "未知");
+            statusLabels_[9]->SetText(buffer);
+        }
+        
+        RootView::GetInstance()->Invalidate();
+    }
+
+    void PPPTestView::ShowInitProgress(int progress)
+    {
+        if (!isTestActive_ || statusLabels_[0] == nullptr) return;
+        
+        char buffer[64];
+        snprintf(buffer, sizeof(buffer), "状态: 初始化中... %d%%", progress);
+        statusLabels_[0]->SetText(buffer);
+        RootView::GetInstance()->Invalidate();
+    }
+
+    void PPPTestView::ShowErrorMessage(const char* error)
+    {
+        if (!isTestActive_ || statusLabels_[0] == nullptr) return;
+        
+        char buffer[128];
+        snprintf(buffer, sizeof(buffer), "状态: 错误 - %s", error ? error : "未知错误");
+        statusLabels_[0]->SetText(buffer);
+        RootView::GetInstance()->Invalidate();
+    }
+
+    void PPPTestView::UpdateDisplay()
+    {
+        UpdateNetworkInfo();
+        UpdateSignalInfo();
+        UpdateModemInfo();
+    }
+
+    UILabel* PPPTestView::GetStatusLabel(int index)
+    {
+        if (index >= 0 && index < MAX_STATUS_LABELS) {
+            return statusLabels_[index];
+        }
+        return nullptr;
+    }
+
+} // namespace OHOS
+
+// 保持向后兼容的C接口
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+// 全局变量用于简单UI
+static OHOS::UILabel* g_simple_ppp_label = nullptr;
+static OHOS::UIViewGroup* g_simple_ppp_container = nullptr;
+static OHOS::UIView* g_saved_current_view = nullptr;
+
+// 全局变量用于详细信号质量显示
+static OHOS::UILabel* g_ppp_status_labels[12] = {nullptr}; // 支持12个状态标签
+static bool g_ppp_init_completed = false;
 
 // 更新信号质量信息显示 - 统一格式结构
 static void update_signal_quality_display() {
@@ -310,10 +524,10 @@ static void update_signal_quality_display() {
     if (ret != PPP_ERR_OK) {
         printf("获取信号质量信息失败: %d\n", ret);
         // 显示错误信息
-        if (g_ppp_status_labels[5] != nullptr) {
-            g_ppp_status_labels[5]->SetText("信号质量获取失败");
-            g_ppp_status_labels[5]->SetVisible(true);
-            g_ppp_status_labels[5]->Invalidate();
+        if (g_ppp_status_labels[4] != nullptr) {
+            g_ppp_status_labels[4]->SetText("信号质量获取失败");
+            g_ppp_status_labels[4]->SetVisible(true);
+            g_ppp_status_labels[4]->Invalidate();
         }
         return;
     }
@@ -327,13 +541,13 @@ static void update_signal_quality_display() {
         
     if (!signal_info.valid) {
         printf("信号质量信息无效\n");
-        if (g_ppp_status_labels[5] != nullptr) {
-            g_ppp_status_labels[5]->SetText("信号质量: 信息无效");
-            g_ppp_status_labels[5]->SetVisible(true);
-            g_ppp_status_labels[5]->Invalidate();
+        if (g_ppp_status_labels[4] != nullptr) {
+            g_ppp_status_labels[4]->SetText("信号质量: 信息无效");
+            g_ppp_status_labels[4]->SetVisible(true);
+            g_ppp_status_labels[4]->Invalidate();
         }
         // 清空其他信号质量标签
-        for (int i = 6; i < 12; i++) {
+        for (int i = 5; i < 12; i++) {
             if (g_ppp_status_labels[i] != nullptr) {
                 g_ppp_status_labels[i]->SetText("");
                 g_ppp_status_labels[i]->SetVisible(false);
@@ -343,7 +557,7 @@ static void update_signal_quality_display() {
         return;
     }
     
-    int label_index = 5; // 从第5个标签开始显示信号质量信息(SIM状态已添加)
+    int label_index = 4; // 从第4个标签开始显示信号质量信息(去掉状态行后调整)
     
     // 检查LTE信号参数有效性
     if (signal_info.rsrq != 255 && signal_info.rsrp != 255 && 
@@ -476,231 +690,165 @@ static void update_signal_quality_display() {
     free(buffer);
 }
 
-// 全局变量,避免栈溢出
-static int g_consecutive_failures = 0;
-
-// 全局刷新标志,避免在定时器回调中直接操作UI
-static volatile bool g_need_refresh = false;
-
-// UI刷新回调函数 - 通过GraphicEvent在主UI线程中安全执行,避免栈溢出
-static void ppp_refresh_ui_callback(void* userData) {
-    (void)userData; // 未使用的参数
-    
-    if (!g_ppp_init_completed || g_ppp_test_view == nullptr) {
-        return; // 如果PPP未初始化完成或view已销毁,不执行刷新
+// 更新IMEI和ICCID信息显示
+static void update_imei_iccid_display() {
+    if (!g_ppp_init_completed) {
+        return;
     }
+
+    printf("=== 更新IMEI和ICCID显示 ===\n");
     
-    // 每次UI刷新时重新设置屏幕常亮,防止被其他程序覆盖
-    uapi_set_screen_on_api();
-    ScreenAlwaysOnCtr(1);
-    
-    printf("PPP UI刷新开始 - GraphicEvent安全机制\n");
-    
-    // 使用malloc为buffer分配内存,避免栈溢出
-    char* buffer = (char*)malloc(512);
-    if (buffer == nullptr) {
-        printf("ERROR: malloc失败,跳过此次刷新\n");
+    // 使用malloc动态分配,避免栈溢出
+    char* buffer = (char*)malloc(200);
+    if (buffer == NULL) {
+        printf("ERROR: Failed to allocate buffer for IMEI/ICCID display\n");
         return;
     }
     
-    // 安全地更新运行状态显示
-    update_ppp_runtime_status_display();
-    
-    // 尝试获取信号质量,但增加容错机制
-    #if SUPPORT_PPP_SERVICE
-    errcode_t ret = ppp_get_network_signal_info();
-    #else
-    errcode_t ret = ERRCODE_SUCC;
-    #endif
-    if (ret == ERRCODE_SUCC) {
-        g_consecutive_failures = 0; // 重置失败计数
-        update_signal_quality_display();
-        printf("PPP信号质量更新成功\n");
-    } else {
-        g_consecutive_failures++;
-        printf("PPP信号质量获取失败 (%d次)\n", g_consecutive_failures);
+    // 1. 更新IMEI信息 (标签索引0)
+    if (g_ppp_status_labels[0] != nullptr) {
+        #if SUPPORT_PPP_SERVICE
+        char* imei = cat1_api_runtime_get_cat1_imei();
+        snprintf(buffer, 200, "IMEI: %s", 
+                (imei && strlen(imei) > 0) ? imei : "未知");
+        #else
+        snprintf(buffer, 200, "IMEI: 模拟数据123456789012345");
+        #endif
         
-        // 如果连续失败超过3次,暂停信号质量查询,只更新基本状态
-        if (g_consecutive_failures >= 3) {
-            if (g_ppp_status_labels[5] != nullptr) {
-                g_ppp_status_labels[5]->SetText("信号查询暂停");
-            }
-            if (g_ppp_status_labels[6] != nullptr) {
-                g_ppp_status_labels[6]->SetText("(定时器冲突)");
-            }
-        }
+        g_ppp_status_labels[0]->SetText(buffer);
+        g_ppp_status_labels[0]->SetVisible(true);
+        g_ppp_status_labels[0]->Invalidate();
+        printf("设置IMEI标签[0]: %s\n", buffer);
     }
     
-    // 释放临时buffer
-    free(buffer);
-    
-    // 刷新UI显示
-    OHOS::RootView::GetInstance()->Invalidate();
-    printf("PPP UI刷新完成\n");
-}
-
-// PPP刷新定时器回调函数 - 使用GraphicEvent避免栈溢出
-static void ppp_refresh_timer_callback(void *arg) {
-    (void)arg;
-    
-    if (!g_ppp_init_completed || g_ppp_test_view == nullptr) {
-        return; // 如果PPP未初始化完成或view已销毁,不执行刷新
+    // 2. 更新ICCID信息 (标签索引1)
+    if (g_ppp_status_labels[1] != nullptr) {
+        #if SUPPORT_PPP_SERVICE
+        char* iccid = cat1_api_runtime_get_cat1_iccid();
+        snprintf(buffer, 200, "ICCID: %s", 
+                (iccid && strlen(iccid) > 0) ? iccid : "未知");
+        #else
+        snprintf(buffer, 200, "ICCID: 模拟数据89860000000000000000");
+        #endif
+        
+        g_ppp_status_labels[1]->SetText(buffer);
+        g_ppp_status_labels[1]->SetVisible(true);
+        g_ppp_status_labels[1]->Invalidate();
+        printf("设置ICCID标签[1]: %s\n", buffer);
     }
     
-    // 使用GraphicEvent将UI更新操作投递到主UI线程,避免栈溢出
-    // UIKit版本: 参数为 回调函数, 用户数据(NULL)
-    PostGraphicEvent(ppp_refresh_ui_callback, NULL);
+    printf("IMEI和ICCID显示更新完成\n");
     
-    printf("PPP定时器回调 - 已投递GraphicEvent\n");
+    // 释放动态分配的内存
+    free(buffer);
 }
 
-// 启动PPP刷新定时器
-static void start_ppp_refresh_timer() {
-    if (g_ppp_refresh_timer == NULL) {
-        g_ppp_refresh_timer = osTimerNew(ppp_refresh_timer_callback, osTimerPeriodic, NULL, NULL);
-        if (g_ppp_refresh_timer == NULL) {
-            printf("ERROR: Failed to create PPP refresh timer\n");
-            return;
-        }
+// 获取并更新PPP显示信息
+static void update_ppp_display_info(void)
+{
+    if (g_simple_ppp_label == nullptr) {
+        return;
     }
     
-    // 启动5秒周期定时器
-    osTimerStart(g_ppp_refresh_timer, PPP_REFRESH_INTERVAL_MS);
-    printf("PPP刷新定时器启动 (5秒周期,避免定时器冲突)\n");
-}
-
-// 停止PPP刷新定时器
-static void stop_ppp_refresh_timer() {
-    if (g_ppp_refresh_timer != NULL) {
-        osTimerStop(g_ppp_refresh_timer);
-        osTimerDelete(g_ppp_refresh_timer);
-        g_ppp_refresh_timer = NULL;
-        printf("PPP刷新定时器停止\n");
-    }
-}
-
-// PPP初始化定时器回调函数
-static void ppp_init_timer_callback(void *arg) {
-    (void)arg;
+    char display_text[1024] = {0};
+    char temp_buffer[200] = {0};
     
-    printf("=== PPP初始化超时,准备重试 ===\n");
+    // 标题
+    strcat(display_text, "=== PPP Test Mode ===\n\n");
     
-    if (g_ppp_init_retry_count >= MAX_PPP_INIT_RETRIES) {
-        printf("PPP初始化达到最大重试次数(%d),停止重试\n", MAX_PPP_INIT_RETRIES);
-        g_ppp_init_in_progress = false;
-        
-        // 简化状态显示,避免在回调中进行复杂UI操作
-        if (g_ppp_status_labels[1] != nullptr) {
-            g_ppp_status_labels[1]->SetText("PPP初始化失败");
-        }
-        return;
-    }
+    // 1. IMEI信息
+    char* imei = cat1_api_runtime_get_cat1_imei();
+    snprintf(temp_buffer, sizeof(temp_buffer), "IMEI: %s\n", 
+            (imei && strlen(imei) > 0) ? imei : "未知");
+    strcat(display_text, temp_buffer);
     
-    // 增加重试计数
-    g_ppp_init_retry_count++;
-    printf("开始第%d次PPP初始化重试\n", g_ppp_init_retry_count);
+    // 2. ICCID信息
+    char* iccid = cat1_api_runtime_get_cat1_iccid();
+    snprintf(temp_buffer, sizeof(temp_buffer), "ICCID: %s\n", 
+            (iccid && strlen(iccid) > 0) ? iccid : "未知");
+    strcat(display_text, temp_buffer);
     
-    // 简化状态显示
-    if (g_ppp_status_labels[1] != nullptr) {
-        g_ppp_status_labels[1]->SetText("PPP初始化重试中...");
+    // 3. SIM卡插入状态
+    int sim_stat = cat1_api_runtime_get_cat1_simstat();
+    const char* sim_desc;
+    switch(sim_stat) {
+        case 0: sim_desc = "未插入"; break;
+        case 1: sim_desc = "已插入"; break;
+        case 2: sim_desc = "被锁定"; break;
+        case 3: sim_desc = "已损坏"; break;
+        default: sim_desc = "状态未知"; break;
     }
+    snprintf(temp_buffer, sizeof(temp_buffer), "SIM状态: %s\n", sim_desc);
+    strcat(display_text, temp_buffer);
     
-    // 重新开始PPP初始化
-    printf("执行ppp_env_init (重试)...\n");
-    int init_ret = ppp_env_init();
-    if (init_ret == 0) {
-        printf("PPP环境初始化成功 (重试第%d次)\n", g_ppp_init_retry_count);
-        g_ppp_init_completed = true;
-        g_ppp_init_in_progress = false;
-        
-        // PPP初始化成功后重新设置屏幕常亮
-        uapi_set_screen_on_api();
-        ScreenAlwaysOnCtr(1);
-        printf("PPP初始化成功 - 屏幕常亮已重新设置\n");
-        
-        // 停止定时器
-        if (g_ppp_init_timer != NULL) {
-            osTimerStop(g_ppp_init_timer);
-        }
-        
-        // 启动5秒刷新定时器(重试成功)
-        start_ppp_refresh_timer();
-        
-        // 设置刷新标志,让主线程安全处理UI更新
-        g_need_refresh = true;
+    strcat(display_text, "\n");
+    
+    // 4. 信号强度信息
+    int signal = cat1_api_runtime_get_cat1_signal();
+    const char* signal_desc;
+    if (signal == 99) {
+        signal_desc = "无信号";
+        snprintf(temp_buffer, sizeof(temp_buffer), "信号强度: %s\n", signal_desc);
     } else {
-        printf("PPP环境初始化失败 (重试第%d次): %d\n", g_ppp_init_retry_count, init_ret);
+        // 根据信号强度分级
+        if (signal >= 20) signal_desc = "极强";
+        else if (signal >= 15) signal_desc = "强";
+        else if (signal >= 10) signal_desc = "中等";
+        else if (signal >= 5) signal_desc = "弱";
+        else signal_desc = "极弱";
         
-        // 重新启动定时器,等待下次重试
-        if (g_ppp_init_timer != NULL) {
-            osTimerStart(g_ppp_init_timer, PPP_INIT_TIMEOUT_MS);
-        }
+        snprintf(temp_buffer, sizeof(temp_buffer), "信号强度: %d (%s)\n", signal, signal_desc);
     }
-}
-
-// 启动PPP初始化和定时器
-static void start_ppp_init_with_timer() {
-    printf("=== 启动PPP初始化和定时器 ===\n");
+    strcat(display_text, temp_buffer);
     
-    // 重置状态
-    g_ppp_init_completed = false;
-    g_ppp_init_in_progress = true;
-    g_ppp_init_retry_count = 0;
-    
-    // 创建定时器
-    if (g_ppp_init_timer == NULL) {
-        g_ppp_init_timer = osTimerNew(ppp_init_timer_callback, osTimerOnce, NULL, NULL);
-        if (g_ppp_init_timer == NULL) {
-            printf("ERROR: Failed to create PPP init timer\n");
-            return;
-        }
+    // 5. 网络状态信息
+    uint8_t network_stat = cat1_api_runtime_get_cat1_networkstat();
+    const char* network_desc;
+    switch(network_stat) {
+        case 0: network_desc = "未注册"; break;
+        case 1: network_desc = "已注册(本地网络)"; break;
+        case 2: network_desc = "搜索中"; break;
+        case 3: network_desc = "注册被拒绝"; break;
+        case 5: network_desc = "已注册(漫游)"; break;
+        default: network_desc = "未知状态"; break;
     }
+    snprintf(temp_buffer, sizeof(temp_buffer), "网络状态: %s\n", network_desc);
+    strcat(display_text, temp_buffer);
     
-    // 开始PPP初始化
-    printf("执行ppp_env_init...\n");
-    int init_ret = ppp_env_init();
-    if (init_ret == 0) {
-        printf("PPP环境初始化成功\n");
-        g_ppp_init_completed = true;
-        g_ppp_init_in_progress = false;
-        
-        // PPP初始化成功后设置屏幕常亮
-        uapi_set_screen_on_api();
-        ScreenAlwaysOnCtr(1);
-        printf("PPP初始化成功 - 屏幕常亮已设置\n");
-        
-        // 启动5秒刷新定时器
-        start_ppp_refresh_timer();
-        
-        // 设置刷新标志,让主线程安全处理UI更新
-        g_need_refresh = true;
-    } else {
-        printf("PPP环境初始化失败: %d,启动定时器等待重试\n", init_ret);
-        
-        // 更新状态显示
-        if (g_ppp_status_labels[1] != nullptr) {
-            g_ppp_status_labels[1]->SetText("PPP初始化失败,5秒后重试...");
-        }
-        
-        // 启动定时器
-        osTimerStart(g_ppp_init_timer, PPP_INIT_TIMEOUT_MS);
+    strcat(display_text, "\n");
+    
+    // 时间信息
+    time_t current_time = time(NULL);
+    struct tm *local_time = localtime(&current_time);
+    if (local_time != NULL) {
+        snprintf(temp_buffer, sizeof(temp_buffer), "当前时间: %04d-%02d-%02d %02d:%02d:%02d\n\n",
+                local_time->tm_year + 1900, local_time->tm_mon + 1, local_time->tm_mday,
+                local_time->tm_hour, local_time->tm_min, local_time->tm_sec);
+        strcat(display_text, temp_buffer);
     }
+    
+    // 操作提示
+    strcat(display_text, "操作命令:\n");
+    strcat(display_text, "AT^PPPTEST=2 - 退出测试\n");
+    strcat(display_text, "AT^PPPTEST=3 - 刷新数据");
+    
+    // 更新显示
+    g_simple_ppp_label->SetText(display_text);
+    
+    printf("PPP display info updated with CAT1 data\n");
 }
 
-extern "C" {
-
-/**
- * @brief 启动PPP测试视图
- */
-void start_ppp_test_view(void)
+// 简化的PPP测试启动 - 创建最小化UI
+static void simple_ppp_test_start(void)
 {
-    printf("=== 启动PPP测试 ===\n");
+    printf("=== 简化PPP测试启动 ===\n");
     
     // 进入PPP界面时设置屏幕常亮
     uapi_set_screen_on_api();
     ScreenAlwaysOnCtr(1);
-    printf("PPP test view: Screen always on enabled\n");
+    printf("PPP test: Screen always on enabled\n");
     
+    // 获取根视图
     OHOS::RootView* rootView = OHOS::RootView::GetInstance();
     if (rootView == nullptr) {
         printf("ERROR: RootView not initialized\n");
@@ -708,98 +856,88 @@ void start_ppp_test_view(void)
     }
     
     // 保存当前显示的view
-    g_ppp_saved_view = rootView->GetChildrenHead();
-    if (g_ppp_saved_view != nullptr) {
-        rootView->Remove(g_ppp_saved_view);
+    g_saved_current_view = rootView->GetChildrenHead();
+    if (g_saved_current_view != nullptr) {
+        rootView->Remove(g_saved_current_view);
         printf("Saved and removed current view for later restore\n");
     }
     
-    // 创建ScrollView用于PPP测试
-    g_ppp_test_view = new OHOS::UIScrollView();
-    if (g_ppp_test_view == nullptr) {
-        printf("ERROR: Failed to create PPP test view\n");
-        return;
+    // 初始化全局状态标签数组
+    for (int i = 0; i < 12; i++) {
+        g_ppp_status_labels[i] = nullptr;
     }
     
-    // 设置PPP测试视图 - 适配360x360圆形LCD,支持大字体滚动
-    g_ppp_test_view->SetPosition(0, 0, 360, 360);
-    g_ppp_test_view->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0xff);
-    g_ppp_test_view->SetStyle(OHOS::STYLE_BACKGROUND_COLOR, 0xff000000); // 黑色背景
-    g_ppp_test_view->SetStyle(OHOS::STYLE_BORDER_RADIUS, 0);
-    g_ppp_test_view->SetTouchable(true);
-    g_ppp_test_view->SetDraggable(true);
-    g_ppp_test_view->SetVisible(true);
-    g_ppp_test_view->SetYScrollBarVisible(true);
-    g_ppp_test_view->SetScrollBlankSize(30); // 增加滚动空白,适应大字体
-    
-    // 创建标题标签 - 统一格式结构
-    PPPLabelConfig_t titleConfig = {
-        .left = 120,      // 居中位置优化
-        .top = 15,       // 顶部留白统一
-        .width = 280,    // 标题宽度统一
-        .height = 32,    // 标题高度统一
-        .fontSize = 18,  // 标题字体大小
-        .lineHeight = 32,// 行高与标签高度一致
-        .text = "PPP网络测试",
-        .lineBreakMode = OHOS::UILabel::LINE_BREAK_ADAPT
-    };
-    g_ppp_title_label = create_ppp_label(titleConfig);
-    if (g_ppp_title_label != nullptr) {
-        g_ppp_status_labels[0] = g_ppp_title_label;
-        
-        // 设置标题样式 - 统一格式结构
-        g_ppp_title_label->SetAlign(OHOS::TEXT_ALIGNMENT_CENTER);
-        g_ppp_title_label->SetStyle(OHOS::STYLE_TEXT_COLOR, 0xFF00FF00); // 绿色标题
-        g_ppp_title_label->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0);      // 透明背景
-        g_ppp_title_label->SetVisible(true);
-        g_ppp_title_label->Invalidate();
-        
-        g_ppp_test_view->Add(g_ppp_title_label);
-        printf("PPP标题标签创建成功: 位置(%d,%d) 尺寸(%dx%d) 文字='%s'\n", 
-               titleConfig.left, titleConfig.top, titleConfig.width, titleConfig.height, titleConfig.text);
-    } else {
-        printf("ERROR: PPP标题标签创建失败\n");
+    // 创建简单的容器
+    g_simple_ppp_container = new OHOS::UIViewGroup();
+    if (g_simple_ppp_container == nullptr) {
+        printf("ERROR: Failed to create PPP container\n");
+        return;
     }
     
-    // 创建状态显示标签 - 统一格式结构
-    int y_start = 65;       // 标题高度32px + top 15px + 间距 18px = 65px
-    int label_height = 28;  // 标签高度统一
-    int label_spacing = 32; // 标签间距统一
+    // 设置容器属性
+    g_simple_ppp_container->SetPosition(0, 0, 360, 360);
+    g_simple_ppp_container->SetStyle(OHOS::STYLE_BACKGROUND_OPA, 0xff);
+    g_simple_ppp_container->SetStyle(OHOS::STYLE_BACKGROUND_COLOR, 0xff000000); // 黑色背景
     
-    for (int i = 1; i < 12; i++) {
-        // 为不同类型标签设置不同的初始文本
-        const char* initial_text;
-        if (i <= 5) {
-            initial_text = "初始化中...";  // 基本信息标签(1-5): SIM状态、IMEI、ICCID、信号强度、网络状态
-        } else {
-            initial_text = "";              // 信号质量标签初始为空(6-11)
-        }
-        
-        PPPLabelConfig_t labelConfig = {
-            .left = 25,      // 左边距统一
-            .top = y_start + (i - 1) * label_spacing,
-            .width = 310,    // 标签宽度统一
-            .height = label_height,
-            .fontSize = 14,  // 内容字体大小
-            .lineHeight = label_height,
-            .text = initial_text,
-            .lineBreakMode = OHOS::UILabel::LINE_BREAK_WRAP
-        };
-        
-        g_ppp_status_labels[i] = create_ppp_label(labelConfig);
-        if (g_ppp_status_labels[i] != nullptr) {
-            g_ppp_test_view->Add(g_ppp_status_labels[i]);
+    // 创建详细的状态标签用于信号质量显示
+    const char* labelTexts[] = {
+        "IMEI: 未知",
+        "ICCID: 未知", 
+        "信号: 未知",
+        "SIM: 未知",
+        "信号质量: 未知",
+        "",  // RSRQ
+        "",  // RSRP
+        "",  // LTE综合质量
+        "",  // 预留
+        "",  // 预留
+        "",  // 预留
+        ""   // 预留
+    };
+    
+    // 创建状态标签
+    for (int i = 0; i < 12; i++) {
+        g_ppp_status_labels[i] = new OHOS::UILabel();
+        if (g_ppp_status_labels[i]) {
+            int yPos = 50 + (i * 28);  // 再往下移动20像素(从30改为50)
+            g_ppp_status_labels[i]->SetPosition(40, yPos, 320, 25);  // 再往右移动15像素(从25改为40),宽度相应调整
+            g_ppp_status_labels[i]->SetText(labelTexts[i]);
+            g_ppp_status_labels[i]->SetFont("SourceHanSansSC-Regular.otf", 14);
+            g_ppp_status_labels[i]->SetStyle(OHOS::STYLE_TEXT_COLOR, 0xffffffff); // 白色文字
+            g_ppp_status_labels[i]->SetAlign(OHOS::UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT);
+            g_ppp_status_labels[i]->SetVisible(i < 5); // 前5个标签默认可见(去掉状态行后调整)
+            g_simple_ppp_container->Add(g_ppp_status_labels[i]);
         }
     }
     
-    // 添加到根视图
-    rootView->Add(g_ppp_test_view);
+    // 设置初始化完成标志
+    g_ppp_init_completed = true;
+    
+    // 获取并显示实际的PPP信息
+    update_ppp_display_info();
+    
+    // 更新IMEI和ICCID信息
+    update_imei_iccid_display();
+    
+    // 更新详细的信号质量显示
+    update_signal_quality_display();
+    
+    // 添加容器到根视图
+    rootView->Add(g_simple_ppp_container);
     rootView->Invalidate();
     
-    printf("PPP test view created, starting initialization with timer...\n");
+    printf("Simple PPP UI created and displayed with detailed signal info\n");
+}
+
+/**
+ * @brief 启动PPP测试视图
+ */
+void start_ppp_test_view(void)
+{
+    printf("=== 启动PPP测试 ===\n");
     
-    // 使用定时器启动PPP初始化
-    start_ppp_init_with_timer();
+    // 使用简化版本,避免复杂对象创建
+    simple_ppp_test_start();
 }
 
 /**
@@ -811,79 +949,80 @@ void stop_ppp_test_view(void)
     
     // 退出PPP界面时恢复屏幕的正常状态
     ScreenAlwaysOnCtr(0);
-    printf("PPP test view: Screen always on disabled\n");
+    printf("PPP test: Screen always on disabled\n");
     
+    // 设置初始化完成标志为false
+    g_ppp_init_completed = false;
+    
+    // 清理UI
     OHOS::RootView* rootView = OHOS::RootView::GetInstance();
     if (rootView != nullptr) {
-        // 停止并删除定时器
-        if (g_ppp_init_timer != NULL) {
-            osTimerStop(g_ppp_init_timer);
-            osTimerDelete(g_ppp_init_timer);
-            g_ppp_init_timer = NULL;
-            printf("PPP init timer stopped and deleted\n");
-        }
-        
-        // 停止刷新定时器
-        stop_ppp_refresh_timer();
-        
-        // 删除PPP测试view
-        if (g_ppp_test_view != nullptr) {
-            rootView->Remove(g_ppp_test_view);
+        // 移除PPP容器
+        if (g_simple_ppp_container != nullptr) {
+            rootView->Remove(g_simple_ppp_container);
             
-            // 清理所有标签
+            // 清理所有状态标签
             for (int i = 0; i < 12; i++) {
                 if (g_ppp_status_labels[i] != nullptr) {
                     delete g_ppp_status_labels[i];
                     g_ppp_status_labels[i] = nullptr;
                 }
             }
-            g_ppp_title_label = nullptr;
             
-            delete g_ppp_test_view;
-            g_ppp_test_view = nullptr;
-            printf("PPP test view removed\n");
+            // 清理简单标签(如果存在)
+            if (g_simple_ppp_label != nullptr) {
+                delete g_simple_ppp_label;
+                g_simple_ppp_label = nullptr;
+            }
+            
+            // 清理容器
+            delete g_simple_ppp_container;
+            g_simple_ppp_container = nullptr;
+            printf("PPP UI cleaned up\n");
         }
         
         // 恢复原来的view
-        if (g_ppp_saved_view != nullptr) {
-            printf("Attempting to restore view at address: %p\n", g_ppp_saved_view);
-            
-            if (g_ppp_saved_view->GetParent() == nullptr) {
-                rootView->Add(g_ppp_saved_view);
-                rootView->Invalidate();
-                printf("Original view restored successfully\n");
-            } else {
-                printf("Warning: Original view still has parent, cannot restore\n");
-            }
-            g_ppp_saved_view = nullptr;
-        } else {
-            printf("No original view to restore\n");
+        if (g_saved_current_view != nullptr) {
+            rootView->Add(g_saved_current_view);
+            rootView->Invalidate();
+            g_saved_current_view = nullptr;
+            printf("Original view restored\n");
         }
     }
     
-    // 重置PPP状态变量
-    g_ppp_init_completed = false;
-    g_ppp_init_in_progress = false;
-    g_ppp_init_retry_count = 0;
+    printf("PPP Test Mode Stopped\n");
 }
 
 /**
- * @brief 刷新PPP测试数据 - 安全版本,检查定时器刷新请求
+ * @brief 刷新PPP测试数据
  */
 void refresh_ppp_test_data(void)
 {
-    printf("=== å\88·æ\96°PPPæµ\8bè¯\95æ\95°æ\8d®(æ\89\8bå\8a¨) ===\n");
+    printf("=== å\88·æ\96°PPPæ\95°æ\8d® ===\n");
     
-    if (!g_ppp_init_completed || g_ppp_test_view == nullptr) {
-        printf("PPP未初始化或view已销毁,无法刷新数据\n");
-        return;
+    // 更新UI显示
+    if (g_simple_ppp_container != nullptr && g_ppp_init_completed) {
+        // 重新获取最新的PPP信息
+        update_ppp_display_info();
+        
+        // 更新IMEI和ICCID信息
+        update_imei_iccid_display();
+        
+        // 更新详细的信号质量显示
+        update_signal_quality_display();
+        
+        OHOS::RootView* rootView = OHOS::RootView::GetInstance();
+        if (rootView != nullptr) {
+            rootView->Invalidate();
+        }
+        printf("PPP UI refreshed with latest data and detailed signal info\n");
+    } else {
+        printf("PPP UI not active or not initialized\n");
     }
-    
-    // 使用GraphicEvent进行安全的UI刷新,避免栈溢出  
-    // UIKit版本: 参数为 回调函数, 用户数据(NULL)
-    PostGraphicEvent(ppp_refresh_ui_callback, NULL);
-    
-    printf("PPP手动刷新请求已发送到GraphicEvent队列\n");
 }
 
-} // extern "C"
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __cplusplus */