优化产测MAG、PPG、CYWEEAT、BT、录音等AT指令 2118/1 2118/head 2119/target/1 2121/target/1
authorpenglei <1624952103@qq.com>
Thu, 21 Aug 2025 07:05:44 +0000 (15:05 +0800)
committerpenglei <1624952103@qq.com>
Thu, 21 Aug 2025 07:05:44 +0000 (15:05 +0800)
18 files changed:
code/sdk/zhihui/UI/producttest/src/testView.cpp
code/sdk/zhihui/drivers/cywee/dml/cywee_dml.c
code/sdk/zhihui/drivers/cywee/dml/cywee_hal.h
code/sdk/zhihui/drivers/cywee/service/cywee_at_cmd.c
code/sdk/zhihui/drivers/mag/mmc5603/mmc5603_main.c
code/sdk/zhihui/drivers/mag/service/mag_at_cmd.c
code/sdk/zhihui/drivers/mag/service/mag_hal.h
code/sdk/zhihui/drivers/ppg/hal/ppg_hal.c
code/sdk/zhihui/drivers/ppg/hal/ppg_hal.h
code/sdk/zhihui/drivers/ppg/pah8009/factory/pah800x_factory_test.c
code/sdk/zhihui/drivers/ppg/pah8009/sensor/pah800x_main.c
code/sdk/zhihui/drivers/ppg/service/ppg_at_cmd.cpp
code/sdk/zhihui/drivers/vibrator/vibrator_at_cmd.c
code/sdk/zhihui/services/battery/test/battery_at_cmd.cpp
code/sdk/zhihui/utils/custom_utils.c
code/sdk/zhihui/utils/custom_utils_at_cmd.c
code/sdk/zhihui/utilscpp/custom_utilscpp.cpp
code/sdk/zhihui/utilscpp/custom_utilscpp.h

index 9a95103..d61afc6 100644 (file)
-#include "producttest/include/testView.h"\r
-#include "producttest/include/testPresenter.h"\r
-#include "producttest/include/testModel.h"\r
-#include "components/ui_label_button.h"\r
-#include "power_display_service.h"\r
-#include "wearable_log.h"\r
-#ifdef SUPPORT_CAT1_SERVICE\r
-#include "cat1_server.h"\r
-#include "cat1_ctl.h"\r
-#include "cat1_server_hal.h"\r
-#endif\r
-\r
-#include "custom_utils.h"\r
-#include "custom_runtime.h"\r
-\r
-#ifdef FD230\r
-#include "factorytest_protocol.h"\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-#if __cplusplus\r
-extern "C"\r
-{\r
-#endif\r
-#endif\r
-#include "pm_definition.h"\r
-#include "pm_veto.h"\r
-#include "pm.h"\r
-#ifdef __cplusplus\r
-#if __cplusplus\r
-}\r
-#endif\r
-#endif\r
-\r
-namespace OHOS\r
-{\r
-\r
-    static testView *g_pSystemView{nullptr};\r
-\r
-    // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与MainStopWatchView类中的特定成员函数指针进行了绑定。\r
-    test_ext Test_ViewMapper_t[] = {\r
-        {TESTVIEW, "", "", "", &testView::ChangeSystemAboutView, false}, // 占位,空的\r
-        {QRCODE, "QRCodeButton", "QRCode", "QRCodeButton_next", &testView::ChangeQRCodeTESTView, true},\r
-        {VISON, "AboutTheWatchButton", "Verison", "AboutTheWatchButton_next", &testView::ChangeSystemAboutView, true},\r
-        {LCD, "LCDButton", "LCD", "LCDButton_next", &testView::ChangeLCDTESTView, true},\r
-        {TP, "TPButton", "TP", "TPButton_next", &testView::ChangeTPTESTView, true},\r
-        {MAGETIC, "MAGETICButton", "Magetic", "MAGETICButton_next", &testView::ChangeMGTESTView, true},\r
-        {LUMINANCE, "luminanceButton", "luminance", "luminanceButton_next", &testView::ChangLUMTESTView, true},\r
-        {CHARG, "chargingButton", "bat&charger", "chargingButton_next", &testView::ChangchargingTESTView, true},\r
-        {SPEAK, "speakButton", "speak", "speakButton_next", &testView::ChangspeakTESTView, true},\r
-        {MOTOR, "motorButton", "motor", "motorButton_next", &testView::ChangmotorTESTView, true},\r
-#ifdef SUPPORT_CAT1_SERVICE\r
-        {CAT1, "cat1button", "CAT1", "cat1button_next", &testView::ChangeCAT1TESTView, true},\r
-#endif\r
-        {BUTTON, "buttonbutton", "oktestBtn", "buttonbutton_next", &testView::ChangKEYTESTView, true},\r
-        {MICROPHONE, "microphonebutton", "microphone", "microphonebutton_next", &testView::ChangeMPTESTView, true},\r
-        {HRSENSON, "hrsensonbutton", "hrsensor", "hrsensonbutton_next", &testView::ChangeHRTESTView, true},\r
-        {GSENSON, "gsensonbutton", "gsensor", "gsensonbutton_next", &testView::ChangeGTESTView, true},\r
-        {BTTEST, "BTbutton", "BT", "BTbutton_next", &testView::ChangeBTTESTView, true},\r
-        {SEChipTest, "SEChipTestbutton", "SEChipTest", "SEChipTestbutton_next", &testView::ChangeSEChipTESTView, true},\r
-        {PingTest, "PingTestbutton", "PingTest", "PingTestbutton_next", &testView::ChangePingTESTView, true},\r
-#if defined(SUPPORT_GNSS)\r
-        {GPSTEST, "GPSTestbutton", "GPSTest", "GPSTestbutton_next", &testView::ChangeGPSTESTView, true},\r
-#endif\r
-#ifdef ENABLE_LQBP002TA\r
-        {PRESSURETEST, "pressureTestbutton", "pressureTest", "pressureTestbutton_next", &testView::ChangepressureTestTESTView, true},\r
-#endif\r
-#ifdef AGINGTEST\r
-        {OLDTEST, "oldtestbutton", "aging", "oldtestexit", &testView::ChangeoldTESTView, true},\r
-#endif\r
-        {DEEPSLEEP, "deepsleep", "DeepSleepCurrent", "xxxxxxxxx", &testView::ChangeoldTESTView, true},\r
-        {shutdown, "shutdown", "shutdown", "xxxxxxxxx", &testView::ChangeoldTESTView, true},\r
-        {RESET, "reset", "reset", "xxxxxxxxx", &testView::ChangeoldTESTView, true},\r
-        {FACTORYRESE, "FactoryReset", "FactoryReset", "xxxxxxxxx", &testView::ChangeoldTESTView, true},\r
-#ifdef SUPPORT_A5133_SERVICE\r
-        {RF5133, "RF5133", "RF5133", "xxxxxxxxx", &testView::ChangeA5133TESTView, true},\r
-#endif\r
-\r
-    };\r
-\r
-    testView::testView()\r
-    {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testView::testView");\r
-        g_pSystemView = this;\r
-    }\r
-\r
-    testView::~testView()\r
-    {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testView::~testView");\r
-        ClearAll();\r
-        g_pSystemView = nullptr;\r
-    }\r
-\r
-    testView *testView::GetInstance()\r
-    {\r
-        return g_pSystemView;\r
-    }\r
-\r
-    void testView::ClearAll()\r
-    {\r
-        if (group)\r
-        {\r
-            group->RemoveAll();\r
-            delete group;\r
-            group = nullptr;\r
-            if (SystemScrollView[TESTVIEW])\r
-            {\r
-                SystemScrollView[TESTVIEW]->RemoveAll();\r
-                delete SystemScrollView[TESTVIEW];\r
-                SystemScrollView[TESTVIEW] = nullptr;\r
-                delete SystemLabel;\r
-                SystemLabel = nullptr;\r
-                int funcSize = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[TESTVIEW]);\r
-                for (int i = 0; i < funcSize; i++)\r
-                {\r
-                    if (button[i])\r
-                    {\r
-                        delete button[i];\r
-                        button[i] = NULL;\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if (test_about_view)\r
-        {\r
-            delete test_about_view; // 1\r
-            test_about_view = nullptr;\r
-        }\r
-\r
-        if (test_LCD_view)\r
-        {\r
-            delete test_LCD_view; // 2\r
-            test_LCD_view = nullptr;\r
-        }\r
-        if (test_TP_view)\r
-        {\r
-            delete test_TP_view; // 3\r
-            test_TP_view = nullptr;\r
-        }\r
-        if (test_lum_view)\r
-        {\r
-            delete test_lum_view; // 4\r
-            test_lum_view = nullptr;\r
-        }\r
-        if (test_charging_view)\r
-        {\r
-            delete test_charging_view; // 5\r
-            test_charging_view = nullptr;\r
-        }\r
-        if (test_speak_view)\r
-        {\r
-            delete test_speak_view; // 6\r
-            test_speak_view = nullptr;\r
-        }\r
-        if (test_motor_view)\r
-        {\r
-            delete test_motor_view; // 7\r
-            test_motor_view = nullptr;\r
-        }\r
-#ifdef SUPPORT_CAT1_SERVICE\r
-        if (test_cat1_view)\r
-        {\r
-            delete test_cat1_view; // 8\r
-            test_cat1_view = nullptr;\r
-        }\r
-#endif\r
-\r
-        if (test_KEY_view)\r
-        {\r
-            delete test_KEY_view; // 9\r
-            test_KEY_view = nullptr;\r
-        }\r
-        if (test_MG_view)\r
-        {\r
-            delete test_MG_view; // 10\r
-            test_MG_view = nullptr;\r
-        }\r
-        if (test_hr_view)\r
-        {\r
-            delete test_hr_view; // 11\r
-            test_hr_view = nullptr;\r
-        }\r
-        if (test_MP_view)\r
-        {\r
-            delete test_MP_view; // 12\r
-            test_MP_view = nullptr;\r
-        }\r
-        if (test_G_view)\r
-        {\r
-            delete test_G_view; // 13\r
-            test_G_view = nullptr;\r
-        }\r
-#ifdef SUPPORT_A5133_SERVICE\r
-        if (test_A5133_view)\r
-        {\r
-            delete test_A5133_view; // 13\r
-            test_A5133_view = nullptr;\r
-        }\r
-#endif\r
-        // delete test_G_view;//13\r
-        // test_G_view= nullptr;\r
-\r
-        for (int i = 1; i < 13; i++)\r
-        {\r
-            if (SystemScrollView[i])\r
-                SystemScrollView[i] = nullptr;\r
-        }\r
-        if (test_Ping_view)\r
-        {\r
-            delete test_Ping_view; // PingTest\r
-            test_Ping_view = nullptr;\r
-        }\r
-        if (test_QRCode_view)\r
-        {\r
-            delete test_QRCode_view; // QRCode\r
-            test_QRCode_view = nullptr;\r
-        }\r
-#ifdef SUPPORT_GNSS\r
-        if (test_GPS_view)\r
-        {\r
-            delete test_GPS_view; // GPS\r
-            test_GPS_view = nullptr;\r
-        }\r
-#endif\r
-    }\r
-\r
-    /// @brief 设置SystemScrollView\r
-    /// @param  void\r
-    /// @return true 设置成功,false 失败\r
-    bool testView::SetTheSystemScrollView(void)\r
-    {\r
-        SystemScrollView[TESTVIEW] = new UIScrollView();\r
-        if (SystemScrollView[TESTVIEW] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheSystemScrollView new fail!");\r
-            return false;\r
-        }\r
-        SystemScrollView[TESTVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
-        SystemScrollView[TESTVIEW]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-        SystemScrollView[TESTVIEW]->SetStyle(STYLE_BORDER_RADIUS, 0);\r
-\r
-        SystemScrollView[TESTVIEW]->SetScrollBlankSize(35);\r
-        SystemScrollView[TESTVIEW]->SetReboundSize(50);\r
-        SystemScrollView[TESTVIEW]->SetDirection(1);\r
-        SystemScrollView[TESTVIEW]->SetThrowDrag(true);         // 设置手指抬起屏幕后是否继续滚动。\r
-        SystemScrollView[TESTVIEW]->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。\r
-        SystemScrollView[TESTVIEW]->SetSwipeACCLevel(200);      /*设置手指抬起屏幕后的补偿距离。*/\r
-        // UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(new SystemViewOnDragListener());\r
-        //  if (draglistener == nullptr)\r
-        //  {\r
-        //      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");\r
-        //      return false;\r
-        //  }\r
-        // SystemScrollView[TESTVIEW]->SetOnDragListener(draglistener);\r
-        SystemScrollView[TESTVIEW]->SetTouchable(true);\r
-        SystemScrollView[TESTVIEW]->SetDraggable(true);\r
-        return true;\r
-    }\r
-\r
-    /// @brief 设置标题\r
-    /// @param  void\r
-    /// @return true 设置成功,false 失败\r
-    bool testView::SetTheTitle(void)\r
-    {\r
-        SystemLabel = new UILabel();\r
-        if (SystemLabel == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLabel new fail!");\r
-            return false;\r
-        }\r
-        SystemLabel->SetPosition(162, 52);\r
-        SystemLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-        SystemLabel->SetStyle(STYLE_TEXT_FONT, 30);\r
-        SystemLabel->SetStyle(STYLE_LINE_HEIGHT, 35);\r
-        SystemLabel->SetText("GNT TEST");\r
-        SystemLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        SystemLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        SystemLabel->SetRollSpeed(6);\r
-        SystemLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);\r
-\r
-        return true;\r
-    }\r
-\r
-    bool testView::AddResultButtons(UIScrollView *scrollView, int16_t viewId,UILabelButton*&oktestBtn,UILabelButton*&failtestBtn)\r
-    {\r
-        if (scrollView == nullptr)\r
-        {\r
-            return false;\r
-        }\r
-\r
-        printf("目前测试项id:%d",viewId);\r
-\r
-        // 创建新按钮(如果当前按钮为空)\r
-        if (oktestBtn == nullptr)\r
-        {\r
-            oktestBtn = new UILabelButton();\r
-            if (oktestBtn == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");\r
-                return false; // 内存分配失败,返回false\r
-            }\r
-            oktestBtn->SetPosition(40, 80);\r
-            oktestBtn->Resize(135, 88);\r
-\r
-            oktestBtn->SetStyle(STYLE_TEXT_FONT, 30);\r
-            oktestBtn->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-        }\r
-        if (failtestBtn == nullptr)\r
-        {\r
-            failtestBtn = new UILabelButton();\r
-            if (failtestBtn == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");\r
-                return false; // 内存分配失败,返回false\r
-            }\r
-            failtestBtn->SetPosition(220, 80);\r
-            failtestBtn->Resize(135, 88);\r
-\r
-            failtestBtn->SetStyle(STYLE_TEXT_FONT, 30);\r
-            failtestBtn->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-        }\r
-\r
-        // 获取当前测试项状态\r
-        test_status_enum status = testModel::GetInstance()->GetResult(viewId);\r
-        printf("目前该项的测试状态为:%d\n",status);\r
-        // 获取测试项描述\r
-        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(viewId);\r
-        printf("目前测试项的描述是:%s\n",viewDesc.c_str());\r
-        \r
-        // 安全检查:确保viewDesc不为空\r
-        if (viewDesc.empty())\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddResultButtons: viewDesc is empty for viewId %d", viewId);\r
-            return false;\r
-        }\r
-\r
-        if (oktestBtn)\r
-        {\r
-            oktestBtn->SetText("成功");\r
-            oktestBtn->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-            // 根据状态设置按钮样式\r
-            switch (status)\r
-            {\r
-            case TEST_STATUS_NONE:\r
-                oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);\r
-                break;\r
-            case TEST_STATUS_SUCCESS:\r
-                oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full);\r
-                break;\r
-            case TEST_STATUS_ERROR:\r
-                oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);\r
-                break;\r
-            }\r
-\r
-            // 设置按钮标识 - 修复悬空指针问题\r
-            okButtonViewId = "TestOK" + viewDesc;\r
-            printf("=== VIEWID DEBUG ===\n");\r
-            printf("设置前 oktestBtn->GetViewId() = %s\n", oktestBtn->GetViewId());\r
-            printf("准备设置 viewId = %s\n", okButtonViewId.c_str());\r
-            printf("okButtonViewId 字符串地址 = %p\n", okButtonViewId.c_str());\r
-            printf("okButtonViewId 字符串长度 = %zu\n", okButtonViewId.length());\r
-            \r
-            oktestBtn->SetViewId(okButtonViewId.c_str());\r
-            \r
-            printf("设置后 oktestBtn->GetViewId() = %s\n", oktestBtn->GetViewId());\r
-            printf("设置后 oktestBtn->GetViewId() 地址 = %p\n", oktestBtn->GetViewId());\r
-            printf("=== VIEWID DEBUG END ===\n");\r
-            \r
-            // UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());\r
-            oktestBtn->SetOnClickListener(presenter_);\r
-            scrollView->Add(oktestBtn);\r
-        }\r
-\r
-        if (failtestBtn)\r
-        {\r
-            failtestBtn->SetText("失败");\r
-            failtestBtn->SetAlign(TEXT_ALIGNMENT_CENTER);\r
-\r
-            // 根据状态设置按钮样式\r
-            switch (status)\r
-            {\r
-            case TEST_STATUS_NONE:\r
-                failtestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);\r
-                break;\r
-            case TEST_STATUS_SUCCESS:\r
-                failtestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);\r
-                break;\r
-            case TEST_STATUS_ERROR:\r
-                failtestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full);\r
-                break;\r
-            }\r
-\r
-            // 设置按钮标识(修复了原代码中的错误)- 修复悬空指针问题\r
-            failButtonViewId = "TestNO" + viewDesc;\r
-            printf("=== VIEWID DEBUG FAIL BUTTON ===\n");\r
-            printf("设置前 failtestBtn->GetViewId() = %s\n", failtestBtn->GetViewId());\r
-            printf("准备设置 viewId = %s\n", failButtonViewId.c_str());\r
-            printf("failButtonViewId 字符串地址 = %p\n", failButtonViewId.c_str());\r
-            printf("failButtonViewId 字符串长度 = %zu\n", failButtonViewId.length());\r
-            \r
-            failtestBtn->SetViewId(failButtonViewId.c_str());\r
-            \r
-            printf("设置后 failtestBtn->GetViewId() = %s\n", failtestBtn->GetViewId());\r
-            printf("设置后 failtestBtn->GetViewId() 地址 = %p\n", failtestBtn->GetViewId());\r
-            printf("=== VIEWID DEBUG FAIL BUTTON END ===\n");\r
-            \r
-            // UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());\r
-            failtestBtn->SetOnClickListener(presenter_);\r
-            scrollView->Add(failtestBtn);\r
-        }\r
-\r
-        return true;\r
-    }\r
-\r
-    /// @brief 设置按钮\r
-    /// @param oktestBtn\r
-    /// @return true 设置成功,false 失败\r
-\r
-    UILabelButtonExt *testView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener)\r
-    {\r
-        UILabelButtonExt *oktestBtn = new UILabelButtonExt();\r
-        if (oktestBtn == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: oktestBtn new  fail!");\r
-            return nullptr;\r
-        }\r
-        oktestBtn->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);\r
-        oktestBtn->SetViewId(buttonconfig.ViewId);\r
-        oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
-        oktestBtn->SetImageSrc(buttonconfig.ImageSrc, buttonconfig.ImageSrc);\r
-        oktestBtn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-        oktestBtn->SetOnClickListener(clickListener);\r
-\r
-        oktestBtn->SetText(buttonconfig.str);\r
-        oktestBtn->SetAlign(TEXT_ALIGNMENT_LEFT);\r
-        oktestBtn->SetLabelPosition(buttonconfig.label_x, buttonconfig.label_y);\r
-        oktestBtn->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, buttonconfig.Fontsize);\r
-        // oktestBtn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        oktestBtn->SetImagePosition(326, 37);\r
-        return oktestBtn;\r
-    }\r
-\r
-    void testView::initView_ext(int x, int y, int w, int h, int interval, const char *imagsrc)\r
-    {\r
-        if (!SetTheSystemScrollView())\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheSystemScrollView() fail!");\r
-            return;\r
-        }\r
-        if (!SetTheTitle())\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheTitle() fail!");\r
-            return;\r
-        }\r
-        /* -------------------------------------------------------------------------- */\r
-        UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());\r
-        /* -------------------------------------------------------------------------- */\r
-        ButtonConfig_ext_t buttonconfig;\r
-        buttonconfig.x = x;\r
-        buttonconfig.y = y;\r
-        buttonconfig.w = w;\r
-        buttonconfig.h = h;\r
-\r
-        int len = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[0]);\r
-\r
-        for (int i = 1; i < len; i++)\r
-        {\r
-            buttonconfig.str = Test_ViewMapper_t[i].Labe_str;\r
-            buttonconfig.ViewId = Test_ViewMapper_t[i].viewid_str;\r
-            buttonconfig.ImageSrc = imagsrc;\r
-            buttonconfig.label_x = 40;\r
-            buttonconfig.label_y = 0;\r
-            buttonconfig.Fontsize = 30;\r
-            buttonconfig.ALIGN = TEXT_ALIGNMENT_LEFT;\r
-            button[i] = SetTheButton_ext(buttonconfig, clickListener);\r
-            buttonconfig.y += interval;\r
-        }\r
-        /* -------------------------------------------------------------------------- */\r
-    }\r
-\r
-    // 0.跳转到系统视图,其他视图都市通过这个视图跳转\r
-    bool testView::ChangeSystemView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemView");\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    // 1.跳转到关于手表\r
-    bool testView::ChangeSystemAboutView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
-            test_about_view = new testAboutView();\r
-            if (test_about_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_about_view->SystemAbouTheWatchtInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeLCDTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeLCDTESTView");\r
-            test_LCD_view = new testLCDView();\r
-            if (test_LCD_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_LCD_view->testLCDInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeTPTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeTPTESTView");\r
-            test_TP_view = new testTPView();\r
-            if (test_TP_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_TP_view->testTPInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeMGTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeMGTESTView");\r
-            test_MG_view = new testMagicView();\r
-            if (test_MG_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_MG_view->testmagicInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangLUMTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangLUMTESTView");\r
-            test_lum_view = new testLUMView();\r
-            if (test_lum_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_lum_view->testLUMInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangchargingTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangchargingTESTView");\r
-            test_charging_view = new testCHANINGView();\r
-            if (test_charging_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_charging_view->testCHANINGInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangspeakTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangspeakTESTView");\r
-            test_speak_view = new testSPEAKView();\r
-            if (test_speak_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_speak_view->testSPEAKInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangmotorTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangmotorTESTView");\r
-            test_motor_view = new testMOTORView();\r
-            if (test_motor_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_motor_view->testMOTORInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeCAT1TESTView(int16_t thisView)\r
-    {\r
-#ifdef SUPPORT_CAT1_SERVICE\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeCAT1TESTView");\r
-            test_cat1_view = new testcat1View();\r
-            if (test_cat1_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_cat1_view->testcat1InitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-#endif\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangKEYTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangKEYTESTView");\r
-            test_KEY_view = new testbuttonView();\r
-            if (test_KEY_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_KEY_view->testBUTTONInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeMPTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeMPTESTView");\r
-            test_MP_view = new testmicrohoneView();\r
-            if (test_MP_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_MP_view->testmicrophoneInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeHRTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeHRTESTView");\r
-            test_hr_view = new testhrsenson1View();\r
-            if (test_hr_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_hr_view->testhrsensonInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeGTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeGTESTView");\r
-            test_G_view = new testgsensonView();\r
-            if (test_G_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_G_view->testGSENSONInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeoldTESTView(int16_t thisView)\r
-    {\r
-#ifdef AGINGTEST\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeoldTESTView");\r
-            test_old_view = new testoldView();\r
-            if (test_old_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_old_view->testoldInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-#endif\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeBTTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeBTTESTView");\r
-            test_BT_view = new testBTView();\r
-            if (test_BT_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_BT_view->testBTInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeSEChipTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");\r
-            test_SEChip_view = new testSEChipView();\r
-            if (test_SEChip_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_SEChip_view->SEChipInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangePingTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangePingTESTView");\r
-            test_Ping_view = new testPingView();\r
-            if (test_Ping_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_Ping_view->testPingInitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-    bool testView::ChangeQRCodeTESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeQRCodeTESTView");\r
-            test_QRCode_view = new testQRCodeView();\r
-            if (test_QRCode_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_QRCode_view->testQRCodeInitIView((uint8_t)thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-\r
-#if defined(SUPPORT_GNSS)\r
-    bool testView::ChangeGPSTESTView(int16_t thisView)\r
-    {\r
-\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");\r
-            test_GPS_view = new testGPSView();\r
-            if (test_GPS_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_GPS_view->testGPSInitIView((uint8_t)thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-\r
-        return true;\r
-    }\r
-#endif\r
-#ifdef ENABLE_LQBP002TA\r
-    bool testView::ChangepressureTestTESTView(int16_t thisView)\r
-    {\r
-\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");\r
-            test_pressure_view = new testpressureView();\r
-            if (test_pressure_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_pressure_view->testpressureInitIView((uint8_t)thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-\r
-        return true;\r
-    }\r
-#endif\r
-#ifdef SUPPORT_A5133_SERVICE\r
-    bool testView::ChangeA5133TESTView(int16_t thisView)\r
-    {\r
-        if (SystemScrollView[thisView] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeA5133TESTView");\r
-            test_A5133_view = new testA5133View();\r
-            if (test_A5133_view == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
-                return false;\r
-            }\r
-            SystemScrollView[thisView] = test_A5133_view->testA5133InitIView(thisView);\r
-            group->Add(SystemScrollView[thisView]);\r
-        }\r
-        return true;\r
-    }\r
-#endif\r
-\r
-    UIScrollView *testView::GetSystemScrollView(int ViewId)\r
-    {\r
-        if (SystemScrollView[ViewId] == nullptr)\r
-        {\r
-            return nullptr;\r
-        }\r
-        return SystemScrollView[ViewId];\r
-    }\r
-\r
-    /* -------------------------------------------------------------------------- */\r
-    // 1.MainStopWatchViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。\r
-\r
-    // 3.根据传入的interface参数执行相应视图ID关联的成员函数。\r
-    bool testView::ClickFunc(int16_t interface)\r
-    {\r
-        int funcSize = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[TESTVIEW]);\r
-        for (int i = 1; i < funcSize; i++)\r
-        {\r
-            if (interface == Test_ViewMapper_t[i].viewId)\r
-            {\r
-                bool jug = (this->*(Test_ViewMapper_t[i].func))(interface);\r
-                if (jug == false)\r
-                {\r
-                    return false;\r
-                }\r
-                return true;\r
-            }\r
-        }\r
-        return false;\r
-    }\r
-\r
-    // 4.切换视图\r
-    void testView::ChangeView(int16_t hideView, int16_t showView)\r
-    {\r
-        if (hideView > MAX_TESTVIEWID)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemViewId Overstep ones bounds");\r
-            return;\r
-        }\r
-        if (SystemScrollView[hideView] != nullptr)\r
-        {\r
-            SystemScrollView[hideView]->SetVisible(false);\r
-        }\r
-        else\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemScrollView[%d] is nullptr", hideView);\r
-        }\r
-        ClickFunc(showView);\r
-        if (SystemScrollView[showView] != nullptr)\r
-        {\r
-            SystemScrollView[showView]->SetVisible(true);\r
-        }\r
-        else\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemScrollView[%d] is nullptr", showView);\r
-        }\r
-        if (hideView != 0)\r
-        {\r
-            switch (hideView)\r
-            {\r
-            case VISON:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_about_view;\r
-                test_about_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case LCD:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_LCD_view;\r
-                test_LCD_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case TP:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_TP_view;\r
-                test_TP_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case MAGETIC:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_MG_view;\r
-                test_MG_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case LUMINANCE:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_lum_view;\r
-                test_lum_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case CHARG:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_charging_view;\r
-                test_charging_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-\r
-            case SPEAK:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_speak_view;\r
-                test_speak_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case MOTOR:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_motor_view;\r
-                test_motor_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-#ifdef SUPPORT_CAT1_SERVICE\r
-            case CAT1:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_cat1_view;\r
-                test_cat1_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-#endif\r
-            case BUTTON:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_KEY_view;\r
-                test_KEY_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case MICROPHONE:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_MP_view;\r
-                test_MP_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case HRSENSON:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_hr_view;\r
-                test_hr_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case GSENSON:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_G_view;\r
-                test_G_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case OLDTEST:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_old_view;\r
-                test_old_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case BTTEST:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_BT_view;\r
-                test_BT_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case SEChipTest:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_SEChip_view;\r
-                test_SEChip_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-            case PingTest:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_Ping_view;\r
-                test_Ping_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-#if defined(SUPPORT_GNSS)\r
-            case GPSTEST:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_GPS_view;\r
-                test_GPS_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-#endif\r
-#ifdef SUPPORT_A5133_SERVICE\r
-            case RF5133:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_A5133_view;\r
-                test_A5133_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-#endif\r
-#if defined(ENABLE_LQBP002TA)\r
-            case PRESSURETEST:\r
-                group->Remove(SystemScrollView[hideView]);\r
-                delete test_pressure_view;\r
-                test_pressure_view = nullptr;\r
-                SystemScrollView[hideView] = nullptr;\r
-                break;\r
-#endif\r
-            default:\r
-                break;\r
-            }\r
-        }\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "change>>>>>>>>>>>hideView %d > showView %d >>>", hideView, showView);\r
-    }\r
-    /* -------------------------------------------------------------------------- */\r
-\r
-    void testView::OnStart()\r
-    {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnStart>>>>>>>>>>>>>");\r
-\r
-        if (group == nullptr)\r
-        {\r
-            group = new UIViewGroup();\r
-            if (group == nullptr)\r
-            {\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeGroupView new fail!");\r
-            }\r
-        }\r
-        group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
-        group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-        group->SetTouchable(true);\r
-        group->SetDraggable(true);\r
-\r
-        // InitIView();\r
-        initView_ext(43, 120, 380, 100, 120, "/user/res/SETTING_NEXT.bin");\r
-        const power_display_svr_api_t *display_api = power_display_svr_get_api();\r
-        if (display_api->get_screen_state() != SCREEN_ON)\r
-        {\r
-            display_api->turn_on_screen();\r
-        }\r
-        display_api->set_auto_timeout_function(false);\r
-\r
-        uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cnt : %d\n", cnt);\r
-        if (cnt == 0)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_pm_add_sleep_veto(PM_ID_P_TEST);");\r
-            uapi_pm_add_sleep_veto(PM_ID_P_TEST);\r
-        }\r
-\r
-        if (!uapi_dev_runtime_get_factory_test_status_flag())\r
-            uapi_set4GCapability(true);\r
-\r
-        start_custom_ble_service();\r
-\r
-        if (SystemScrollView[TESTVIEW] == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: OnSetUpView  has nullptr");\r
-            return;\r
-        }\r
-        SystemScrollView[TESTVIEW]->Add(SystemLabel);\r
-        int len = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[0]);\r
-        for (int i = 0; i < len; i++)\r
-        {\r
-            SystemScrollView[TESTVIEW]->Add(button[i]);\r
-        }\r
-        group->Add(SystemScrollView[TESTVIEW]);\r
-        AddViewToRootContainer(group);\r
-    }\r
-\r
+#include "producttest/include/testView.h"
+#include "producttest/include/testPresenter.h"
+#include "producttest/include/testModel.h"
+#include "components/ui_label_button.h"
+#include "power_display_service.h"
+#include "wearable_log.h"
+#ifdef SUPPORT_CAT1_SERVICE
+#include "cat1_server.h"
+#include "cat1_ctl.h"
+#include "cat1_server_hal.h"
+#endif
+
+#include "custom_utils.h"
+#include "custom_runtime.h"
+
+#ifdef FD230
+#include "factorytest_protocol.h"
+#endif
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C"
+{
+#endif
+#endif
+#include "pm_definition.h"
+#include "pm_veto.h"
+#include "pm.h"
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif
+#endif
+
+namespace OHOS
+{
+
+    static testView *g_pSystemView{nullptr};
+
+    // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与MainStopWatchView类中的特定成员函数指针进行了绑定。
+    test_ext Test_ViewMapper_t[] = {
+        {TESTVIEW, "", "", "", &testView::ChangeSystemAboutView, false}, // 占位,空的
+        {QRCODE, "QRCodeButton", "QRCode", "QRCodeButton_next", &testView::ChangeQRCodeTESTView, true},
+        {VISON, "AboutTheWatchButton", "Verison", "AboutTheWatchButton_next", &testView::ChangeSystemAboutView, true},
+        {LCD, "LCDButton", "LCD", "LCDButton_next", &testView::ChangeLCDTESTView, true},
+        {TP, "TPButton", "TP", "TPButton_next", &testView::ChangeTPTESTView, true},
+        {MAGETIC, "MAGETICButton", "Magetic", "MAGETICButton_next", &testView::ChangeMGTESTView, true},
+        {LUMINANCE, "luminanceButton", "luminance", "luminanceButton_next", &testView::ChangLUMTESTView, true},
+        {CHARG, "chargingButton", "bat&charger", "chargingButton_next", &testView::ChangchargingTESTView, true},
+        {SPEAK, "speakButton", "speak", "speakButton_next", &testView::ChangspeakTESTView, true},
+        {MOTOR, "motorButton", "motor", "motorButton_next", &testView::ChangmotorTESTView, true},
+#ifdef SUPPORT_CAT1_SERVICE
+        {CAT1, "cat1button", "CAT1", "cat1button_next", &testView::ChangeCAT1TESTView, true},
+#endif
+        {BUTTON, "buttonbutton", "oktestBtn", "buttonbutton_next", &testView::ChangKEYTESTView, true},
+        {MICROPHONE, "microphonebutton", "microphone", "microphonebutton_next", &testView::ChangeMPTESTView, true},
+        {HRSENSON, "hrsensonbutton", "hrsensor", "hrsensonbutton_next", &testView::ChangeHRTESTView, true},
+        {GSENSON, "gsensonbutton", "gsensor", "gsensonbutton_next", &testView::ChangeGTESTView, true},
+        {BTTEST, "BTbutton", "BT", "BTbutton_next", &testView::ChangeBTTESTView, true},
+        {SEChipTest, "SEChipTestbutton", "SEChipTest", "SEChipTestbutton_next", &testView::ChangeSEChipTESTView, true},
+        {PingTest, "PingTestbutton", "PingTest", "PingTestbutton_next", &testView::ChangePingTESTView, true},
+#if defined(SUPPORT_GNSS)
+        {GPSTEST, "GPSTestbutton", "GPSTest", "GPSTestbutton_next", &testView::ChangeGPSTESTView, true},
+#endif
+#ifdef ENABLE_LQBP002TA
+        {PRESSURETEST, "pressureTestbutton", "pressureTest", "pressureTestbutton_next", &testView::ChangepressureTestTESTView, true},
+#endif
+#ifdef AGINGTEST
+        {OLDTEST, "oldtestbutton", "aging", "oldtestexit", &testView::ChangeoldTESTView, true},
+#endif
+        {DEEPSLEEP, "deepsleep", "DeepSleepCurrent", "xxxxxxxxx", &testView::ChangeoldTESTView, true},
+        {shutdown, "shutdown", "shutdown", "xxxxxxxxx", &testView::ChangeoldTESTView, true},
+        {RESET, "reset", "reset", "xxxxxxxxx", &testView::ChangeoldTESTView, true},
+        {FACTORYRESE, "FactoryReset", "FactoryReset", "xxxxxxxxx", &testView::ChangeoldTESTView, true},
+#ifdef SUPPORT_A5133_SERVICE
+        {RF5133, "RF5133", "RF5133", "xxxxxxxxx", &testView::ChangeA5133TESTView, true},
+#endif
+
+    };
+
+    testView::testView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testView::testView");
+        g_pSystemView = this;
+    }
+
+    testView::~testView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testView::~testView");
+        ClearAll();
+        g_pSystemView = nullptr;
+    }
+
+    testView *testView::GetInstance()
+    {
+        return g_pSystemView;
+    }
+
+    void testView::ClearAll()
+    {
+        if (group)
+        {
+            group->RemoveAll();
+            delete group;
+            group = nullptr;
+            if (SystemScrollView[TESTVIEW])
+            {
+                SystemScrollView[TESTVIEW]->RemoveAll();
+                delete SystemScrollView[TESTVIEW];
+                SystemScrollView[TESTVIEW] = nullptr;
+                delete SystemLabel;
+                SystemLabel = nullptr;
+                int funcSize = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[TESTVIEW]);
+                for (int i = 0; i < funcSize; i++)
+                {
+                    if (button[i])
+                    {
+                        delete button[i];
+                        button[i] = NULL;
+                    }
+                }
+            }
+        }
+        if (test_about_view)
+        {
+            delete test_about_view; // 1
+            test_about_view = nullptr;
+        }
+
+        if (test_LCD_view)
+        {
+            delete test_LCD_view; // 2
+            test_LCD_view = nullptr;
+        }
+        if (test_TP_view)
+        {
+            delete test_TP_view; // 3
+            test_TP_view = nullptr;
+        }
+        if (test_lum_view)
+        {
+            delete test_lum_view; // 4
+            test_lum_view = nullptr;
+        }
+        if (test_charging_view)
+        {
+            delete test_charging_view; // 5
+            test_charging_view = nullptr;
+        }
+        if (test_speak_view)
+        {
+            delete test_speak_view; // 6
+            test_speak_view = nullptr;
+        }
+        if (test_motor_view)
+        {
+            delete test_motor_view; // 7
+            test_motor_view = nullptr;
+        }
+#ifdef SUPPORT_CAT1_SERVICE
+        if (test_cat1_view)
+        {
+            delete test_cat1_view; // 8
+            test_cat1_view = nullptr;
+        }
+#endif
+
+        if (test_KEY_view)
+        {
+            delete test_KEY_view; // 9
+            test_KEY_view = nullptr;
+        }
+        if (test_MG_view)
+        {
+            delete test_MG_view; // 10
+            test_MG_view = nullptr;
+        }
+        if (test_hr_view)
+        {
+            delete test_hr_view; // 11
+            test_hr_view = nullptr;
+        }
+        if (test_MP_view)
+        {
+            delete test_MP_view; // 12
+            test_MP_view = nullptr;
+        }
+        if (test_G_view)
+        {
+            delete test_G_view; // 13
+            test_G_view = nullptr;
+        }
+#ifdef SUPPORT_A5133_SERVICE
+        if (test_A5133_view)
+        {
+            delete test_A5133_view; // 13
+            test_A5133_view = nullptr;
+        }
+#endif
+        // delete test_G_view;//13
+        // test_G_view= nullptr;
+
+        for (int i = 1; i < 13; i++)
+        {
+            if (SystemScrollView[i])
+                SystemScrollView[i] = nullptr;
+        }
+        if (test_Ping_view)
+        {
+            delete test_Ping_view; // PingTest
+            test_Ping_view = nullptr;
+        }
+        if (test_QRCode_view)
+        {
+            delete test_QRCode_view; // QRCode
+            test_QRCode_view = nullptr;
+        }
+#ifdef SUPPORT_GNSS
+        if (test_GPS_view)
+        {
+            delete test_GPS_view; // GPS
+            test_GPS_view = nullptr;
+        }
+#endif
+    }
+
+    /// @brief 设置SystemScrollView
+    /// @param  void
+    /// @return true 设置成功,false 失败
+    bool testView::SetTheSystemScrollView(void)
+    {
+        SystemScrollView[TESTVIEW] = new UIScrollView();
+        if (SystemScrollView[TESTVIEW] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheSystemScrollView new fail!");
+            return false;
+        }
+        SystemScrollView[TESTVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        SystemScrollView[TESTVIEW]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        SystemScrollView[TESTVIEW]->SetStyle(STYLE_BORDER_RADIUS, 0);
+
+        SystemScrollView[TESTVIEW]->SetScrollBlankSize(35);
+        SystemScrollView[TESTVIEW]->SetReboundSize(50);
+        SystemScrollView[TESTVIEW]->SetDirection(1);
+        SystemScrollView[TESTVIEW]->SetThrowDrag(true);         // 设置手指抬起屏幕后是否继续滚动。
+        SystemScrollView[TESTVIEW]->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。
+        SystemScrollView[TESTVIEW]->SetSwipeACCLevel(200);      /*设置手指抬起屏幕后的补偿距离。*/
+        // UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(new SystemViewOnDragListener());
+        //  if (draglistener == nullptr)
+        //  {
+        //      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");
+        //      return false;
+        //  }
+        // SystemScrollView[TESTVIEW]->SetOnDragListener(draglistener);
+        SystemScrollView[TESTVIEW]->SetTouchable(true);
+        SystemScrollView[TESTVIEW]->SetDraggable(true);
+        return true;
+    }
+
+    /// @brief 设置标题
+    /// @param  void
+    /// @return true 设置成功,false 失败
+    bool testView::SetTheTitle(void)
+    {
+        SystemLabel = new UILabel();
+        if (SystemLabel == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLabel new fail!");
+            return false;
+        }
+        SystemLabel->SetPosition(162, 52);
+        SystemLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        SystemLabel->SetStyle(STYLE_TEXT_FONT, 30);
+        SystemLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+        SystemLabel->SetText("GNT TEST");
+        SystemLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+        SystemLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        SystemLabel->SetRollSpeed(6);
+        SystemLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, 30);
+
+        return true;
+    }
+
+    bool testView::AddResultButtons(UIScrollView *scrollView, int16_t viewId,UILabelButton*&oktestBtn,UILabelButton*&failtestBtn)
+    {
+        if (scrollView == nullptr)
+        {
+            return false;
+        }
+
+        printf("目前测试项id:%d",viewId);
+
+        // 创建新按钮(如果当前按钮为空)
+        if (oktestBtn == nullptr)
+        {
+            oktestBtn = new UILabelButton();
+            if (oktestBtn == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");
+                return false; // 内存分配失败,返回false
+            }
+            oktestBtn->SetPosition(40, 80);
+            oktestBtn->Resize(135, 88);
+
+            oktestBtn->SetStyle(STYLE_TEXT_FONT, 30);
+            oktestBtn->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+        }
+        if (failtestBtn == nullptr)
+        {
+            failtestBtn = new UILabelButton();
+            if (failtestBtn == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");
+                return false; // 内存分配失败,返回false
+            }
+            failtestBtn->SetPosition(220, 80);
+            failtestBtn->Resize(135, 88);
+
+            failtestBtn->SetStyle(STYLE_TEXT_FONT, 30);
+            failtestBtn->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+        }
+
+        // 获取当前测试项状态
+        test_status_enum status = testModel::GetInstance()->GetResult(viewId);
+        printf("目前该项的测试状态为:%d\n",status);
+        // 获取测试项描述
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(viewId);
+        printf("目前测试项的描述是:%s\n",viewDesc.c_str());
+        
+        // 安全检查:确保viewDesc不为空
+        if (viewDesc.empty())
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddResultButtons: viewDesc is empty for viewId %d", viewId);
+            return false;
+        }
+
+        if (oktestBtn)
+        {
+            oktestBtn->SetText("成功");
+            oktestBtn->SetAlign(TEXT_ALIGNMENT_CENTER);
+            // 根据状态设置按钮样式
+            switch (status)
+            {
+            case TEST_STATUS_NONE:
+                oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);
+                break;
+            case TEST_STATUS_SUCCESS:
+                oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full);
+                break;
+            case TEST_STATUS_ERROR:
+                oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);
+                break;
+            }
+
+            // 设置按钮标识 - 修复悬空指针问题
+            okButtonViewId = "TestOK" + viewDesc;
+            printf("=== VIEWID DEBUG ===\n");
+            printf("设置前 oktestBtn->GetViewId() = %s\n", oktestBtn->GetViewId());
+            printf("准备设置 viewId = %s\n", okButtonViewId.c_str());
+            printf("okButtonViewId 字符串地址 = %p\n", okButtonViewId.c_str());
+            printf("okButtonViewId 字符串长度 = %zu\n", okButtonViewId.length());
+            
+            oktestBtn->SetViewId(okButtonViewId.c_str());
+            
+            printf("设置后 oktestBtn->GetViewId() = %s\n", oktestBtn->GetViewId());
+            printf("设置后 oktestBtn->GetViewId() 地址 = %p\n", oktestBtn->GetViewId());
+            printf("=== VIEWID DEBUG END ===\n");
+            
+            // UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());
+            oktestBtn->SetOnClickListener(presenter_);
+            scrollView->Add(oktestBtn);
+        }
+
+        if (failtestBtn)
+        {
+            failtestBtn->SetText("失败");
+            failtestBtn->SetAlign(TEXT_ALIGNMENT_CENTER);
+
+            // 根据状态设置按钮样式
+            switch (status)
+            {
+            case TEST_STATUS_NONE:
+                failtestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);
+                break;
+            case TEST_STATUS_SUCCESS:
+                failtestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full);
+                break;
+            case TEST_STATUS_ERROR:
+                failtestBtn->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full);
+                break;
+            }
+
+            // 设置按钮标识(修复了原代码中的错误)- 修复悬空指针问题
+            failButtonViewId = "TestNO" + viewDesc;
+            printf("=== VIEWID DEBUG FAIL BUTTON ===\n");
+            printf("设置前 failtestBtn->GetViewId() = %s\n", failtestBtn->GetViewId());
+            printf("准备设置 viewId = %s\n", failButtonViewId.c_str());
+            printf("failButtonViewId 字符串地址 = %p\n", failButtonViewId.c_str());
+            printf("failButtonViewId 字符串长度 = %zu\n", failButtonViewId.length());
+            
+            failtestBtn->SetViewId(failButtonViewId.c_str());
+            
+            printf("设置后 failtestBtn->GetViewId() = %s\n", failtestBtn->GetViewId());
+            printf("设置后 failtestBtn->GetViewId() 地址 = %p\n", failtestBtn->GetViewId());
+            printf("=== VIEWID DEBUG FAIL BUTTON END ===\n");
+            
+            // UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());
+            failtestBtn->SetOnClickListener(presenter_);
+            scrollView->Add(failtestBtn);
+        }
+
+        return true;
+    }
+
+    /// @brief 设置按钮
+    /// @param oktestBtn
+    /// @return true 设置成功,false 失败
+
+    UILabelButtonExt *testView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener)
+    {
+        UILabelButtonExt *oktestBtn = new UILabelButtonExt();
+        if (oktestBtn == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: oktestBtn new  fail!");
+            return nullptr;
+        }
+        oktestBtn->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);
+        oktestBtn->SetViewId(buttonconfig.ViewId);
+        oktestBtn->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        oktestBtn->SetImageSrc(buttonconfig.ImageSrc, buttonconfig.ImageSrc);
+        oktestBtn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+        oktestBtn->SetOnClickListener(clickListener);
+
+        oktestBtn->SetText(buttonconfig.str);
+        oktestBtn->SetAlign(TEXT_ALIGNMENT_LEFT);
+        oktestBtn->SetLabelPosition(buttonconfig.label_x, buttonconfig.label_y);
+        oktestBtn->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, buttonconfig.Fontsize);
+        // oktestBtn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+        oktestBtn->SetImagePosition(326, 37);
+        return oktestBtn;
+    }
+
+    void testView::initView_ext(int x, int y, int w, int h, int interval, const char *imagsrc)
+    {
+        if (!SetTheSystemScrollView())
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheSystemScrollView() fail!");
+            return;
+        }
+        if (!SetTheTitle())
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheTitle() fail!");
+            return;
+        }
+        /* -------------------------------------------------------------------------- */
+        UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());
+        /* -------------------------------------------------------------------------- */
+        ButtonConfig_ext_t buttonconfig;
+        buttonconfig.x = x;
+        buttonconfig.y = y;
+        buttonconfig.w = w;
+        buttonconfig.h = h;
+
+        int len = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[0]);
+
+        for (int i = 1; i < len; i++)
+        {
+            buttonconfig.str = Test_ViewMapper_t[i].Labe_str;
+            buttonconfig.ViewId = Test_ViewMapper_t[i].viewid_str;
+            buttonconfig.ImageSrc = imagsrc;
+            buttonconfig.label_x = 40;
+            buttonconfig.label_y = 0;
+            buttonconfig.Fontsize = 30;
+            buttonconfig.ALIGN = TEXT_ALIGNMENT_LEFT;
+            button[i] = SetTheButton_ext(buttonconfig, clickListener);
+            buttonconfig.y += interval;
+        }
+        /* -------------------------------------------------------------------------- */
+    }
+
+    // 0.跳转到系统视图,其他视图都市通过这个视图跳转
+    bool testView::ChangeSystemView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemView");
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    // 1.跳转到关于手表
+    bool testView::ChangeSystemAboutView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");
+            test_about_view = new testAboutView();
+            if (test_about_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_about_view->SystemAbouTheWatchtInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeLCDTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeLCDTESTView");
+            test_LCD_view = new testLCDView();
+            if (test_LCD_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_LCD_view->testLCDInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeTPTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeTPTESTView");
+            test_TP_view = new testTPView();
+            if (test_TP_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_TP_view->testTPInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeMGTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeMGTESTView");
+            test_MG_view = new testMagicView();
+            if (test_MG_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_MG_view->testmagicInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangLUMTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangLUMTESTView");
+            test_lum_view = new testLUMView();
+            if (test_lum_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_lum_view->testLUMInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangchargingTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangchargingTESTView");
+            test_charging_view = new testCHANINGView();
+            if (test_charging_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_charging_view->testCHANINGInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangspeakTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangspeakTESTView");
+            test_speak_view = new testSPEAKView();
+            if (test_speak_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_speak_view->testSPEAKInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangmotorTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangmotorTESTView");
+            test_motor_view = new testMOTORView();
+            if (test_motor_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_motor_view->testMOTORInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeCAT1TESTView(int16_t thisView)
+    {
+#ifdef SUPPORT_CAT1_SERVICE
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeCAT1TESTView");
+            test_cat1_view = new testcat1View();
+            if (test_cat1_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_cat1_view->testcat1InitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+#endif
+        return true;
+    }
+
+    bool testView::ChangKEYTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangKEYTESTView");
+            test_KEY_view = new testbuttonView();
+            if (test_KEY_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_KEY_view->testBUTTONInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeMPTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeMPTESTView");
+            test_MP_view = new testmicrohoneView();
+            if (test_MP_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_MP_view->testmicrophoneInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeHRTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeHRTESTView");
+            test_hr_view = new testhrsenson1View();
+            if (test_hr_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_hr_view->testhrsensonInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeGTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeGTESTView");
+            test_G_view = new testgsensonView();
+            if (test_G_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_G_view->testGSENSONInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeoldTESTView(int16_t thisView)
+    {
+#ifdef AGINGTEST
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeoldTESTView");
+            test_old_view = new testoldView();
+            if (test_old_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_old_view->testoldInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+#endif
+        return true;
+    }
+
+    bool testView::ChangeBTTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeBTTESTView");
+            test_BT_view = new testBTView();
+            if (test_BT_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_BT_view->testBTInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeSEChipTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");
+            test_SEChip_view = new testSEChipView();
+            if (test_SEChip_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_SEChip_view->SEChipInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangePingTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangePingTESTView");
+            test_Ping_view = new testPingView();
+            if (test_Ping_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_Ping_view->testPingInitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+    bool testView::ChangeQRCodeTESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeQRCodeTESTView");
+            test_QRCode_view = new testQRCodeView();
+            if (test_QRCode_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_QRCode_view->testQRCodeInitIView((uint8_t)thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+
+#if defined(SUPPORT_GNSS)
+    bool testView::ChangeGPSTESTView(int16_t thisView)
+    {
+
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");
+            test_GPS_view = new testGPSView();
+            if (test_GPS_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_GPS_view->testGPSInitIView((uint8_t)thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+
+        return true;
+    }
+#endif
+#ifdef ENABLE_LQBP002TA
+    bool testView::ChangepressureTestTESTView(int16_t thisView)
+    {
+
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");
+            test_pressure_view = new testpressureView();
+            if (test_pressure_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_pressure_view->testpressureInitIView((uint8_t)thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+
+        return true;
+    }
+#endif
+#ifdef SUPPORT_A5133_SERVICE
+    bool testView::ChangeA5133TESTView(int16_t thisView)
+    {
+        if (SystemScrollView[thisView] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeA5133TESTView");
+            test_A5133_view = new testA5133View();
+            if (test_A5133_view == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);
+                return false;
+            }
+            SystemScrollView[thisView] = test_A5133_view->testA5133InitIView(thisView);
+            group->Add(SystemScrollView[thisView]);
+        }
+        return true;
+    }
+#endif
+
+    UIScrollView *testView::GetSystemScrollView(int ViewId)
+    {
+        if (SystemScrollView[ViewId] == nullptr)
+        {
+            return nullptr;
+        }
+        return SystemScrollView[ViewId];
+    }
+
+    /* -------------------------------------------------------------------------- */
+    // 1.MainStopWatchViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。
+
+    // 3.根据传入的interface参数执行相应视图ID关联的成员函数。
+    bool testView::ClickFunc(int16_t interface)
+    {
+        int funcSize = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[TESTVIEW]);
+        for (int i = 1; i < funcSize; i++)
+        {
+            if (interface == Test_ViewMapper_t[i].viewId)
+            {
+                bool jug = (this->*(Test_ViewMapper_t[i].func))(interface);
+                if (jug == false)
+                {
+                    return false;
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // 4.切换视图
+    void testView::ChangeView(int16_t hideView, int16_t showView)
+    {
+        if (hideView > MAX_TESTVIEWID)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemViewId Overstep ones bounds");
+            return;
+        }
+        if (SystemScrollView[hideView] != nullptr)
+        {
+            SystemScrollView[hideView]->SetVisible(false);
+        }
+        else
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemScrollView[%d] is nullptr", hideView);
+        }
+        ClickFunc(showView);
+        if (SystemScrollView[showView] != nullptr)
+        {
+            SystemScrollView[showView]->SetVisible(true);
+        }
+        else
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemScrollView[%d] is nullptr", showView);
+        }
+        if (hideView != 0)
+        {
+            switch (hideView)
+            {
+            case VISON:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_about_view;
+                test_about_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case LCD:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_LCD_view;
+                test_LCD_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case TP:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_TP_view;
+                test_TP_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case MAGETIC:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_MG_view;
+                test_MG_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case LUMINANCE:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_lum_view;
+                test_lum_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case CHARG:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_charging_view;
+                test_charging_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+
+            case SPEAK:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_speak_view;
+                test_speak_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case MOTOR:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_motor_view;
+                test_motor_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+#ifdef SUPPORT_CAT1_SERVICE
+            case CAT1:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_cat1_view;
+                test_cat1_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+#endif
+            case BUTTON:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_KEY_view;
+                test_KEY_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case MICROPHONE:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_MP_view;
+                test_MP_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case HRSENSON:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_hr_view;
+                test_hr_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case GSENSON:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_G_view;
+                test_G_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case OLDTEST:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_old_view;
+                test_old_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case BTTEST:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_BT_view;
+                test_BT_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case SEChipTest:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_SEChip_view;
+                test_SEChip_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+            case PingTest:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_Ping_view;
+                test_Ping_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+#if defined(SUPPORT_GNSS)
+            case GPSTEST:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_GPS_view;
+                test_GPS_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+#endif
+#ifdef SUPPORT_A5133_SERVICE
+            case RF5133:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_A5133_view;
+                test_A5133_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+#endif
+#if defined(ENABLE_LQBP002TA)
+            case PRESSURETEST:
+                group->Remove(SystemScrollView[hideView]);
+                delete test_pressure_view;
+                test_pressure_view = nullptr;
+                SystemScrollView[hideView] = nullptr;
+                break;
+#endif
+            default:
+                break;
+            }
+        }
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "change>>>>>>>>>>>hideView %d > showView %d >>>", hideView, showView);
+    }
+    /* -------------------------------------------------------------------------- */
+
+    void testView::OnStart()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnStart>>>>>>>>>>>>>");
+
+        if (group == nullptr)
+        {
+            group = new UIViewGroup();
+            if (group == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "WatchQRCodeView::WatchQRCodeGroupView new fail!");
+            }
+        }
+        group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        group->SetTouchable(true);
+        group->SetDraggable(true);
+
+        // InitIView();
+        initView_ext(43, 120, 380, 100, 120, "/user/res/SETTING_NEXT.bin");
+        const power_display_svr_api_t *display_api = power_display_svr_get_api();
+        if (display_api->get_screen_state() != SCREEN_ON)
+        {
+            display_api->turn_on_screen();
+        }
+        display_api->set_auto_timeout_function(false);
+
+        uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "cnt : %d\n", cnt);
+        if (cnt == 0)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_pm_add_sleep_veto(PM_ID_P_TEST);");
+            uapi_pm_add_sleep_veto(PM_ID_P_TEST);
+        }
+
+        if (!uapi_dev_runtime_get_factory_test_status_flag())
+            uapi_set4GCapability(true);
+
+        start_custom_ble_service();
+
+        if (SystemScrollView[TESTVIEW] == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: OnSetUpView  has nullptr");
+            return;
+        }
+        SystemScrollView[TESTVIEW]->Add(SystemLabel);
+        int len = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[0]);
+        for (int i = 0; i < len; i++)
+        {
+            SystemScrollView[TESTVIEW]->Add(button[i]);
+        }
+        group->Add(SystemScrollView[TESTVIEW]);
+        AddViewToRootContainer(group);
+    }
+
 } // namespace OHOS
\ No newline at end of file
index 02fec33..ddbd68a 100644 (file)
@@ -116,6 +116,8 @@ static act_ext_result_t c_act_ext_result_t = {0};
 
 uint8_t cywee_ble_service_flag = 0;
 
+static uint8_t cywee_factory_log = 0;
+
 #define SPORT_CHECK_MS 1000
 
 #ifdef CYWEE_MAC_ACTIVE
@@ -127,6 +129,11 @@ int cm__hs1__init(void);
 int cm__hs1__deinit(void);
 #endif
 
+void cywee_set_factory_log_switch(uint8_t cmd)
+{
+    cywee_factory_log = cmd;
+}
+
 void cywee_get_sleep_time_data(uint32_t *fall_sleep_time,uint32_t *wake_up_time,uint16_t *total_time,uint8_t data_type)
 {
     if (fall_sleep_time == NULL || wake_up_time == NULL || total_time == NULL)
@@ -1725,7 +1732,8 @@ void CWM_APSensorDataOutput_listen(const dml_sensorData_t * pSdo)
         }      
         if (pSdo->validData & DML_SENSOR_DATA_VALID_ACC)
         {
-            //CWM_OS_dbgPrintf("acc: x=%.3f, y=%.3f, z=%.3f\n",pSdo->acc_data[0], pSdo->acc_data[1], pSdo->acc_data[2]);
+            if(cywee_factory_log)
+                CWM_OS_dbgPrintf("acc: x=%.3f, y=%.3f, z=%.3f\n",pSdo->acc_data[0], pSdo->acc_data[1], pSdo->acc_data[2]);
             rawdata[AccdataCount].acc_x = pSdo->acc_data[0];
             rawdata[AccdataCount].acc_y = pSdo->acc_data[1];
             rawdata[AccdataCount].acc_z = pSdo->acc_data[2];
index 59d9c74..6bb4ba6 100644 (file)
@@ -206,6 +206,8 @@ void cywee_get_act_ext_data(act_ext_result_t *data);
 
 void cywee_get_sleep_time_data(uint32_t *fall_sleep_time,uint32_t *wake_up_time,uint16_t *total_time,uint8_t data_type);
 
+void cywee_set_factory_log_switch(uint8_t cmd);
+
 #ifdef __cplusplus
 #if __cplusplus
 }
index a7bdfb0..a73ed6d 100644 (file)
@@ -41,6 +41,31 @@ static int ConvertCmdToParam(uint8_t *para, uint32_t paraLen,
 }
 
 
+// 新增的gsensor测试函数
+static uint32_t cywee_gsensor_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+    uint8_t argv[CYWEE_MAX_ARGC][CYWEE_MAX_ARGV_LEN] = { 0 };
+    uint32_t argc = 0;
+
+    int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+    if (ret != ERRCODE_SUCC) {
+        printf("CYWEE_GSENSOR ATCMD Convert Command Failed\n");
+        return ERRCODE_FAIL;
+    }
+
+    if (argc != 1) {
+        printf("CYWEE_GSENSOR ATCMD Set Parameter Failed argc %d, should be AT^CYWEEGSENSOR=cmd\n", argc);
+        return ERRCODE_FAIL;
+    }
+
+    uint8_t cmd = (uint8_t)atoi((char*)argv[0]);
+    
+    cywee_set_factory_log_switch(cmd);
+    
+    return ERRCODE_SUCC;
+}
+
 static uint32_t cywee_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
 {
     unused(strCommonCmd);
@@ -105,6 +130,7 @@ static const at_cmd_table_t g_cywee_cmd[] = {
     { (char *)"AT^CYWEETEST",      cywee_do_test, (char *)"free" },
     { (char *)"AT^CYWEETEST",      cywee_do_test, (char *)"pause" },
     { (char *)"AT^CYWEETEST",      cywee_do_test, (char *)"resume" },
+    { (char *)"AT^CYWEEGSENSOR",   cywee_gsensor_test, (char *)"1" },
 };
 
 at_cmd_table_t *get_cywee_cmd_table(uint32_t *cmd_count)
index 54a24f9..736a389 100644 (file)
@@ -43,6 +43,8 @@ static float fAzimuth, fPitch, fRoll;
 /* This variable is used to save the calibration accuracy. */  \r
 static int iAccuracy;\r
 \r
+static uint8_t mag_factory_log = 0;\r
+\r
 /* Read saved calibration parameters. These para is saved in somewhere that can not disappear when power-off\r
  * ReadPara function should be create by customer.If customer can not implement this function, should comment it out\r
  * If there is no parameter saved, ReadPara() should return -1, else return 1;\r
@@ -228,7 +230,9 @@ extern uint8_t is_xts_test_done(void);
        iAccuracy = GetMagAccuracy();\r
 \r
        // MMC_LOG("fAzimuth =%f iAccuracy=%d\r\n",fAzimuth,iAccuracy); \r
-\r
+       if(mag_factory_log)\r
+               printf("fAzimuth =%.3f\n",fAzimuth);    \r
+       \r
        /* Get the SET Flag from algorithm */   \r
        // if(GetMagSaturation())  \r
        // {\r
@@ -481,3 +485,8 @@ int mmc5603_stop(void)
 \r
        return 0;\r
 }\r
+\r
+void mag_set_factory_log_switch(uint8_t cmd)\r
+{\r
+    mag_factory_log = cmd;\r
+}\r
index 1679400..f44cbf2 100644 (file)
@@ -57,6 +57,7 @@ static uint32_t mag_start_test(uint8_t *para, uint32_t paraLen, char *strCommonC
     UNUSED(paraLen);
     UNUSED(para);
     do_mag_service_check_msg(MAG_SERVICE_CMD_START_CHECK);
+    mag_set_factory_log_switch(1);
     return ERRCODE_SUCC;
 }
 static uint32_t mag_stop_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
@@ -65,6 +66,7 @@ static uint32_t mag_stop_test(uint8_t *para, uint32_t paraLen, char *strCommonCm
     UNUSED(paraLen);
     UNUSED(para);
     do_mag_service_check_msg(MAG_SERVICE_CMD_STOP_CHECK);
+    mag_set_factory_log_switch(0);
     return ERRCODE_SUCC;
 }
 static const at_cmd_table_t g_mag_cmd[] = {
index d08ed39..2531c1f 100644 (file)
@@ -32,6 +32,8 @@ uint8_t mag_get_chip_id(void);
 void mag_get_iAccuracy(int *data);
 void mag_get_fAzimuth(float *data);
 
+void mag_set_factory_log_switch(uint8_t cmd);
+
 #ifdef __cplusplus
 #if __cplusplus
 }
index 5f8f480..76f4df4 100644 (file)
@@ -49,6 +49,7 @@
 // S_AGPIO_R0 PRG_LED_POWER ON  心率等电源控制脚
 #define GPIO_PIN_PRG_LED_ON S_AGPIO_R0
 
+static uint8_t ppg_factory_log = 0;
 
 void ppg_power_on(void)
 {
@@ -196,3 +197,13 @@ void ppg_check_int(void)
     pah8009_check_int();
 #endif
 }
+
+void ppg_set_factory_log_switch(uint8_t cmd)
+{
+    ppg_factory_log = cmd;
+}
+
+uint8_t ppg_get_factory_log_switch(void)
+{
+    return ppg_factory_log;
+}
\ No newline at end of file
index aef8c39..cdb034b 100644 (file)
@@ -62,6 +62,9 @@ int32_t ppg_get_factory_data(void);
 void ppg_ble_send(uint8_t hr);
 void ppg_check_int(void);
 
+void ppg_set_factory_log_switch(uint8_t cmd);
+uint8_t ppg_get_factory_log_switch(void);
+
 #ifdef __cplusplus
 #if __cplusplus
 }
index 5d5148d..153b819 100644 (file)
@@ -304,7 +304,7 @@ static void pah_sensor_factory_mode_verify_result(void)
                        {\r
                                _factory_state.verify_result.ch_result[i].is_passed = true;\r
                        }\r
-                       printf("ch[%d] : (min, value, max)=(%d, %d, %d), result=%d \n",\\r
+                       LOG_PRINT("ch[%d] : (min, value, max)=(%d, %d, %d), result=%d \n",\\r
                                                i, _factory_state.verify_config.ch_spec[i].min, \\r
                                                _factory_state.test_result.adc[i], \\r
                                                _factory_state.verify_config.ch_spec[i].max, \\r
@@ -321,7 +321,7 @@ static void pah_sensor_factory_mode_verify_result(void)
                        {\r
                                _factory_state.verify_result.ch_result[i].is_passed = true;\r
                        }\r
-                       printf("ch[%d] : (min, value)=(%d, %d), result=%d \n",\\r
+                       LOG_PRINT("ch[%d] : (min, value)=(%d, %d), result=%d \n",\\r
                                                i, _factory_state.verify_config.ch_spec[i].min, \\r
                                                _factory_state.test_result.adc[i], \\r
                                                _factory_state.verify_result.ch_result[i].is_passed);\r
@@ -340,12 +340,14 @@ static void pah_sensor_factory_mode_verify_result(void)
 \r
                        factory_test_ch[i] = _factory_state.test_result.adc[i];\r
 \r
-                       printf("ch[%d] : (value, max)=(%d, %d), result=%d \n",\\r
+                       LOG_PRINT("ch[%d] : (value, max)=(%d, %d), result=%d \n",\\r
                                                i, _factory_state.test_result.adc[i], \\r
                                                _factory_state.verify_config.ch_spec[i].max, \\r
                                                _factory_state.verify_result.ch_result[i].is_passed);\r
                }\r
        }\r
+\r
+       printf("ch[0]:%d,ch[1]:%d,ch[2]:%d\n",factory_test_ch[0],factory_test_ch[1],factory_test_ch[2]);\r
 }\r
 \r
 \r
@@ -550,7 +552,7 @@ void pah8009_get_leaklight_data(uint16_t *ch0,uint16_t *ch1,uint16_t *ch2)
        *ch1 = factory_test_ch[1];\r
        *ch2 = factory_test_ch[2];\r
 \r
-       printf("factory_test_ch[0]:%d,factory_test_ch[0]:%d,factory_test_ch[0]:%d\n",factory_test_ch[0],factory_test_ch[1],factory_test_ch[2]);\r
+       printf("ch[0]:%d,ch[1]:%d,ch[2]:%d\n",factory_test_ch[0],factory_test_ch[1],factory_test_ch[2]);\r
 \r
        factory_test_ch[0] = 0;\r
        factory_test_ch[1] = 0;\r
index 29acb76..185c382 100644 (file)
@@ -609,14 +609,19 @@ void hr_alg_task(void)
 \r
                 if(time_cnt >= 20) \r
                 {\r
-                    time_cnt = 0;\r
-                    // ppg_msg_callback_t func =  ppg_get_send_msg_callback_func();\r
-#ifdef SUPPORT_CYWEE_SERVICE\r
-                    // if(uapi_dev_runtime_get_train_status())\r
+                    if(ppg_get_factory_log_switch())\r
                     {\r
-                        do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CHECK_ACC, NULL); // 检查gsensor是否停止\r
+                        printf("green data : %d\n",factory_data);\r
                     }\r
-#endif\r
+\r
+                    time_cnt = 0;\r
+                    // ppg_msg_callback_t func =  ppg_get_send_msg_callback_func();\r
+// #ifdef SUPPORT_CYWEE_SERVICE\r
+//                     // if(uapi_dev_runtime_get_train_status())\r
+//                     {\r
+//                         do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CHECK_ACC, NULL); // 检查gsensor是否停止\r
+//                     }\r
+// #endif\r
                     if(hr > 0)\r
                     {\r
                         int hr_int = round(hr);\r
@@ -972,14 +977,19 @@ void spo2_alg_task(void)
 \r
                 if(time_cnt >= 20) \r
                 {\r
-                    time_cnt = 0;\r
-                    // ppg_msg_callback_t func =  ppg_get_send_msg_callback_func();\r
-#ifdef SUPPORT_CYWEE_SERVICE\r
-                    // if(uapi_dev_runtime_get_train_status())\r
+                    if(ppg_get_factory_log_switch())\r
                     {\r
-                        do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CHECK_ACC, NULL); // 检查gsensor是否停止\r
+                        printf("red data : %d\n",factory_data);\r
                     }\r
-#endif\r
+\r
+                    time_cnt = 0;\r
+                    // ppg_msg_callback_t func =  ppg_get_send_msg_callback_func();\r
+// #ifdef SUPPORT_CYWEE_SERVICE\r
+//                     // if(uapi_dev_runtime_get_train_status())\r
+//                     {\r
+//                         do_cywee_service_check_msg(CYWEE_SERVICE_CMD_CHECK_ACC, NULL); // 检查gsensor是否停止\r
+//                     }\r
+// #endif\r
                 }\r
                 // ppg_msg_callback_t func =  ppg_get_send_msg_callback_func();\r
 \r
index de8421c..9539965 100644 (file)
@@ -10,6 +10,8 @@
 #include <string.h>
 #include <math.h>
 
+#include "ppg_hal.h"
+
 #ifdef PPG_VC9202
 #include "vc9202_hal.h"
 #include "vc9202_common.h"
@@ -74,10 +76,12 @@ static uint32_t ppg_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
     uint32_t md = PPG_SERVICE_CMD_TYPE_DO_PPG_TEST;
     if (strcmp(mode, "hrs") == 0) {
         md = PPG_SERVICE_CMD_TYPE_DO_PPG_TEST;
+        ppg_set_factory_log_switch(1);
     } else if (strcmp(mode, "hrv") == 0) {
         md = PPG_SERVICE_CMD_TYPE_DO_HRV_TEST;
     } else if (strcmp(mode, "spo2") == 0) {
         md = PPG_SERVICE_CMD_TYPE_DO_SPO2_TEST;
+        ppg_set_factory_log_switch(1);
     } else if (strcmp(mode, "leaklight") == 0) {
         md = PPG_SERVICE_CMD_TYPE_DO_LEAKLIGHT_TEST;
     } else if (strcmp(mode, "graycard") == 0) {
@@ -90,6 +94,7 @@ static uint32_t ppg_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
 
     if(enabled == 0 )
     {   
+        ppg_set_factory_log_switch(0);
         if (md == PPG_SERVICE_CMD_TYPE_DO_SPO2_TEST)
         {
             md = PPG_SERVICE_CMD_TYPE_STOP_SPO2_TEST;
index c26d38a..6743ef6 100644 (file)
@@ -7,6 +7,7 @@
 #include "vibrator.h"
 #include "debug_print.h"
 #include "vibrator_hal.h"
+#include "cmsis_os2.h"
 
 #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
 #define VIBRATOR_MAX_ARGC            8
 #define VIBRATOR_SUCCESS             0
 #define VIBRATOR_FAILED              (-1)
 
+// 马达定时器相关变量
+static osTimerId_t g_vibrator_timer = NULL;
+
+// 马达定时器回调函数
+static void vibrator_timer_callback(void *argument)
+{
+    UNUSED(argument);
+    // 执行马达震动
+    custom_VibratorFunc_int(0);
+}
+
 static int ConvertCmdToParam(uint8_t *para, uint32_t paraLen,
         uint8_t argv[VIBRATOR_MAX_ARGC][VIBRATOR_MAX_ARGV_LEN], uint32_t* argc)
 {
@@ -68,6 +80,57 @@ static uint32_t vibrator_do_test(uint8_t *para, uint32_t paraLen, char *strCommo
     hal_custom_VibratorFunc(duty,cycle,duration);
     return ERRCODE_SUCC;
 }
+
+// 马达定时器控制AT指令实现
+static uint32_t vibrator_timer_control(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+    uint8_t argv[VIBRATOR_MAX_ARGC][VIBRATOR_MAX_ARGV_LEN] = { 0 };
+    uint32_t argc = 0;
+
+    int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+    if (ret != VIBRATOR_SUCCESS) {
+        PRINT("VIBRATORTIMER ATCMD Convert Command Failed\n");
+        return ERRCODE_FAIL;
+    }
+
+    if (argc != 1) {
+        PRINT("VIBRATORTIMER ATCMD Set Parameter Failed argc %d, should be AT^VIBRATORTIMER=cmd\n", argc);
+        return ERRCODE_FAIL;
+    }
+
+    uint8_t cmd = (uint8_t)atoi((char*)argv[0]);
+    
+    if(cmd == 1)
+    {
+        if (g_vibrator_timer == NULL) {
+            g_vibrator_timer = osTimerNew((osTimerFunc_t)vibrator_timer_callback, osTimerPeriodic, NULL, NULL);
+        }
+        
+        if (g_vibrator_timer) {
+            osTimerStart(g_vibrator_timer, 1000); // 1秒间隔
+            PRINT("VIBRATORTIMER ATCMD Start timer with 1s interval\n");
+        } else {
+            PRINT("VIBRATORTIMER ATCMD Create timer failed\n");
+            return ERRCODE_FAIL;
+        }
+    }
+    else if(cmd == 0)
+    {        
+        if (g_vibrator_timer) {
+            osTimerStop(g_vibrator_timer);
+            osTimerDelete(g_vibrator_timer);
+            g_vibrator_timer = NULL;
+            PRINT("VIBRATORTIMER ATCMD Stop and delete timer\n");
+        }
+    
+        PRINT("VIBRATORTIMER ATCMD Unknown command %d\n", cmd);
+        return ERRCODE_FAIL;
+    }
+    
+    return ERRCODE_SUCC;
+}
+
 extern errcode_t hal_custom_resume_touch(void);
 static uint32_t resume_touch(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
 {
@@ -78,8 +141,8 @@ static uint32_t resume_touch(uint8_t *para, uint32_t paraLen, char *strCommonCmd
 
 static const at_cmd_table_t g_vibrator_cmd[] = {
     { (char *)"AT^VIBRATORTEST",      vibrator_do_test, (char *)"1" },
+    { (char *)"AT^VIBRATORTIMER",     vibrator_timer_control, (char *)"1" },
     { (char *)"AT^RESUMETOUCH",      resume_touch, (char *)"1" },
-
 };
 
 at_cmd_table_t *get_vibrator_cmd_table(uint32_t *cmd_count)
index e7cb6df..4038fe7 100644 (file)
@@ -79,8 +79,26 @@ static uint32_t battery_do_test(uint8_t *para, uint32_t paraLen, char *strCommon
     return ERRCODE_SUCC;
 }
 
+static uint32_t battery_get_info(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(para);
+    UNUSED(paraLen);
+    UNUSED(strCommonCmd);
+    
+    // 获取电池信息:电量、电压、充电状态
+    float voltage = 0.0f;
+    uint8_t percent = batteryservice_get_voltage(&voltage);
+    uint8_t charge_status = get_charge_stat();
+    
+    printf("BATTERY INFO: Percent=%d%%, Voltage=%.2fV, ChargeStatus=%d\n", 
+          percent, voltage, charge_status);
+    
+    return ERRCODE_SUCC;
+}
+
 static const at_cmd_table_t g_battery_cmd[] = {
     { (char *)"AT^CHARGETEST",      battery_do_test, (char *)"enable" },
+    { (char *)"AT^BATTERYINFO",     battery_get_info, (char *)"" },
 };
 
 at_cmd_table_t *get_battery_cmd_table(uint32_t *cmd_count)
index 52354fe..8c4677b 100644 (file)
@@ -637,6 +637,12 @@ void startup_post_init_task(void)
     }
     uapi_gei_btmac_and_chipinfo();
 
+    uint8_t buildversion[128]={0};
+    uint16_t versionlen = 128;
+    uapi_get_buildversion(buildversion,versionlen);
+
+    wstp_print("\nfac:BuildVer:%s\n",buildversion);
+
     uint8_t len = 1;
     uapi_get_file_data("user/userdata/timestamp_of_day.bin",&day,&len);
     time(&rawtime);
@@ -2994,7 +3000,7 @@ void uapi_gei_btmac_and_chipinfo(void)
     sprintf((char *)btaddr_str, "%02X:%02X:%02X:%02X:%02X:%02X", btaddr[0], btaddr[1], btaddr[2], btaddr[3], btaddr[4], btaddr[5]);
     uapi_cywee_get_chipinfo(chipinfo,sizeof(chipinfo));
 
-    wstp_print("^^^^ BTMAC=%s ^^^^ CyweeChipInfo=%s\n",btaddr_str,chipinfo);
+    wstp_print("fac:^^^^ BTMAC=%s ^^^^ CyweeChipInfo=%s\n",btaddr_str,chipinfo);
 }
 
 uint8_t uapi_get_cywee_active_state(void)
index 67ff689..6709e7f 100644 (file)
@@ -7,6 +7,8 @@
 #include "custom_utils.h"
 #include "debug_print.h"
 #include "custom_runtime.h"
+#include "factorytest_protocol.h"
+#include "los_base.h"
 #ifdef SUPPORT_CUSTOM_CONFIG
 #include "ConfigModelC.h"
 #endif
@@ -82,6 +84,168 @@ static int ConvertCmdToParam(uint8_t *para, uint32_t paraLen,
 }
 
 
+// // 表冠测试AT指令实现
+// static uint32_t crown_test_control(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+// {
+//     UNUSED(strCommonCmd);
+//     uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 };
+//     uint32_t argc = 0;
+
+//     int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+//     if (ret != CUSTOM_UTILS_SUCCESS) {
+//         wstp_print("CROWNTEST ATCMD Convert Command Failed\n");
+//         return ERRCODE_FAIL;
+//     }
+
+//     if (argc != 1) {
+//         wstp_print("CROWNTEST ATCMD Set Parameter Failed argc %d, should be AT^CROWNTEST=cmd\n", argc);
+//         return ERRCODE_FAIL;
+//     }
+
+//     uint8_t cmd = (uint8_t)atoi((char*)argv[0]);
+    
+//     if(cmd == 1)
+//     {
+//         uint8_t crown_cmd = 1;
+//         do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_CROWN_TEST, &crown_cmd, sizeof(crown_cmd));
+//         wstp_print("CROWNTEST ATCMD Enter crown test interface\n");
+
+//     }
+//     else if(cmd == 2)
+//     {
+//         uint8_t crown_cmd = 0;
+//         do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_CROWN_TEST, &crown_cmd, sizeof(crown_cmd));
+//         wstp_print("CROWNTEST ATCMD Exit crown test interface\n");
+//     }
+
+//     return ERRCODE_SUCC;
+// }
+
+// LCD测试AT指令实现
+static uint32_t lcd_test_control(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+    uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 };
+    uint32_t argc = 0;
+
+    int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+    if (ret != CUSTOM_UTILS_SUCCESS) {
+        wstp_print("LCDTEST ATCMD Convert Command Failed\n");
+        return ERRCODE_FAIL;
+    }
+
+    if (argc != 1) {
+        wstp_print("LCDTEST ATCMD Set Parameter Failed argc %d, should be AT^LCDTEST=cmd\n", argc);
+        return ERRCODE_FAIL;
+    }
+
+    uint8_t cmd = (uint8_t)atoi((char*)argv[0]);
+    
+    if(cmd == 1)
+    {
+        // 进入LCD测试界面
+        uint8_t lcd_cmd = 1;
+        do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_TEST, &lcd_cmd, sizeof(lcd_cmd));
+        wstp_print("LCDTEST ATCMD Enter LCD test interface\n");
+
+        for(int i = 1; i < 6; i++)
+        {
+            LOS_Msleep(2000);
+            do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_COLOR_TEST, &i, 1);
+        }
+    }
+    else if(cmd == 2)
+    {
+        // 退出LCD测试界面
+        uint8_t lcd_cmd = 0;
+        do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_TEST, &lcd_cmd, sizeof(lcd_cmd));
+        wstp_print("LCDTEST ATCMD Exit LCD test interface\n");
+    }
+    // else if(cmd >= 3 && cmd <= 7)
+    // {
+
+    //     // 改变LCD屏幕颜色
+    //     uint8_t color_cmd = cmd - 2; // 转换为颜色命令 (1-5)
+        
+        
+    //     // 根据命令打印对应的颜色信息
+    //     switch(color_cmd)
+    //     {
+    //         case 1:
+    //             wstp_print("LCDTEST ATCMD Set LCD color: Red\n");
+    //             break;
+    //         case 2:
+    //             wstp_print("LCDTEST ATCMD Set LCD color: Green\n");
+    //             break;
+    //         case 3:
+    //             wstp_print("LCDTEST ATCMD Set LCD color: Blue\n");
+    //             break;
+    //         case 4:
+    //             wstp_print("LCDTEST ATCMD Set LCD color: White\n");
+    //             break;
+    //         case 5:
+    //             wstp_print("LCDTEST ATCMD Set LCD color: Black\n");
+    //             break;
+    //         default:
+    //             wstp_print("LCDTEST ATCMD Set LCD color: Unknown\n");
+    //             break;
+    //     }
+    // }
+    // else
+    // {
+    //     wstp_print("LCDTEST ATCMD Unknown command %d\n", cmd);
+    //     wstp_print("LCDTEST ATCMD Usage:\n");
+    //     wstp_print("  AT^LCDTEST=1 - Enter LCD test interface\n");
+    //     wstp_print("  AT^LCDTEST=2 - Exit LCD test interface\n");
+    //     wstp_print("  AT^LCDTEST=3 - Set LCD color: Red\n");
+    //     wstp_print("  AT^LCDTEST=4 - Set LCD color: Green\n");
+    //     wstp_print("  AT^LCDTEST=5 - Set LCD color: Blue\n");
+    //     wstp_print("  AT^LCDTEST=6 - Set LCD color: White\n");
+    //     wstp_print("  AT^LCDTEST=7 - Set LCD color: Black\n");
+    //     return ERRCODE_FAIL;
+    // }
+
+    return ERRCODE_SUCC;
+}
+
+// // TP测试AT指令实现
+// static uint32_t tp_test_control(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+// {
+//     UNUSED(strCommonCmd);
+//     uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 };
+//     uint32_t argc = 0;
+
+//     int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+//     if (ret != CUSTOM_UTILS_SUCCESS) {
+//         wstp_print("TPTEST ATCMD Convert Command Failed\n");
+//         return ERRCODE_FAIL;
+//     }
+
+//     if (argc != 1) {
+//         wstp_print("TPTEST ATCMD Set Parameter Failed argc %d, should be AT^TPTEST=cmd\n", argc);
+//         return ERRCODE_FAIL;
+//     }
+
+//     uint8_t cmd = (uint8_t)atoi((char*)argv[0]);
+    
+//     if(cmd == 1)
+//     {
+//         // 进入TP测试界面
+//         uint8_t tp_cmd = 1;
+//         do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_TP_TEST, &tp_cmd, sizeof(tp_cmd));
+//         wstp_print("TPTEST ATCMD Enter TP test interface\n");
+//     }
+//     else if(cmd == 2)
+//     {
+//         // 退出TP测试界面
+//         uint8_t tp_cmd = 0;
+//         do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_TP_TEST, &tp_cmd, sizeof(tp_cmd));
+//         wstp_print("TPTEST ATCMD Exit TP test interface\n");
+//     }
+
+//     return ERRCODE_SUCC;
+// }
+
 static uint32_t custom_utils_setsn(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
 {
     UNUSED(strCommonCmd);
@@ -1397,7 +1561,99 @@ static uint32_t custom_at_gpio(uint8_t *para, uint32_t paraLen, char *strCommonC
     return ERRCODE_SUCC;
 }
 
+static uint32_t custom_factory_bt_test_start(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+
+    custom_factory_bt_scan_start();
+
+    return ERRCODE_SUCC;
+}
+
+static uint32_t custom_factory_bt_test_stop(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+
+    custom_factory_bt_scan_stop();
+
+    return ERRCODE_SUCC;
+}
+
+// 录音相关AT指令实现
+static uint32_t custom_audio_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
+{
+    UNUSED(strCommonCmd);
+    uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 };
+    uint32_t argc = 0;
+
+    int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
+    if (ret != CUSTOM_UTILS_SUCCESS) {
+        wstp_print("AUDIO TEST ATCMD Convert Command Failed\n");
+        return ERRCODE_FAIL;
+    }
+
+    if (argc != 1) {
+        wstp_print("AUDIO TEST ATCMD Set Parameter Failed argc %d\n", argc);
+        wstp_print("Usage: AT^AUDIOTEST=cmd\n");
+        wstp_print("  cmd: 1=start record, 2=stop record, 3=start play, 4=stop play\n");
+        return ERRCODE_FAIL;
+    }
+
+    uint8_t cmd = (uint8_t)atoi((char*)argv[0]);
+    
+    switch (cmd) {
+        case 1: // 开始录音
+            {
+                errcode_t ret = do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_START_MIC, NULL, 0);
+                if (ret == ERRCODE_SUCC) {
+                    wstp_print("AUDIO RECORD START: Success (Queued)\n");
+                } else {
+                    wstp_print("AUDIO RECORD START: Failed, ret=%d\n", ret);
+                }
+            }
+            break;
+        case 2: // 停止录音
+            {
+                errcode_t ret = do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_STOP_MIC, NULL, 0);
+                if (ret == ERRCODE_SUCC) {
+                    wstp_print("AUDIO RECORD STOP: Success (Queued)\n");
+                } else {
+                    wstp_print("AUDIO RECORD STOP: Failed, ret=%d\n", ret);
+                }
+            }
+            break;
+        case 3: // 开始播放
+            {
+                errcode_t ret = do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_START_CHECK_MIC, NULL, 0);
+                if (ret == ERRCODE_SUCC) {
+                    wstp_print("AUDIO PLAY START: Success (Queued)\n");
+                } else {
+                    wstp_print("AUDIO PLAY START: Failed, ret=%d\n", ret);
+                }
+            }
+            break;
+        case 4: // 停止播放并删除录音
+            {
+                errcode_t ret = do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_STOP_CHECK_MIC, NULL, 0);
+                if (ret == ERRCODE_SUCC) {
+                    wstp_print("AUDIO PLAY STOP: Success (Queued)\n");
+                    // 停止播放后自动删除录音文件
+                    // uapi_delete_files("/user/userdata/microphone.mp3");
+                    wstp_print("AUDIO RECORD DELETE: Success\n");
+                } else {
+                    wstp_print("AUDIO PLAY STOP: Failed, ret=%d\n", ret);
+                }
+            }
+            break;
+        default:
+            wstp_print("AUDIO TEST ATCMD Unknown command %d\n", cmd);
+            wstp_print("Usage: AT^AUDIOTEST=cmd\n");
+            wstp_print("  cmd: 1=start record, 2=stop record, 3=start play, 4=stop play\n");
+            return ERRCODE_FAIL;
+    }
 
+    return ERRCODE_SUCC;
+}
 
 static const at_cmd_table_t g_custom_utils_cmd[] = {
     { (char *)"AT^CUSTOM_SN",      custom_utils_setsn, (char *)"123456789ABCDEF2345678" },
@@ -1490,6 +1746,14 @@ static const at_cmd_table_t g_custom_utils_cmd[] = {
     { (char *)"AT^AUTOOTACHECK",      send_check_ota_atuoota, (char *)" " },
     { (char *)"AT^POWEROFF",      custom_at_poweroff, (char *)" " },
     { (char *)"AT^GPIO",      custom_at_gpio, (char *)" " },
+    // { (char *)"AT^CROWNKEYTEST",      crown_test_control, (char *)" " },
+    { (char *)"AT^LCDTEST",      lcd_test_control, (char *)" " },
+    // { (char *)"AT^TPTEST",      tp_test_control, (char *)" " },
+    { (char *)"AT^BTTESTSTART",      custom_factory_bt_test_start, (char *)" " },
+    { (char *)"AT^BTTESTSTOP",      custom_factory_bt_test_stop, (char *)" " },
+    
+    // 录音相关AT指令
+    { (char *)"AT^AUDIOTEST",      custom_audio_test, (char *)" " },
 };
 
 
index 18402bb..e99ead7 100644 (file)
 #include "audio_manager.h"
 #include "audio_base_type.h"
 
+
+#include "bts_br_gap.h"
+#include "bts_le_gap.h"
+
+#ifdef SUPPORT_BLE_SERVICE
+#include "bleService.h"
+#endif
+
+#include "bluetooth/include/BluetoothModel.h"
+
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -71,6 +82,7 @@ extern "C" {
 #define IN_BUF_SIZE (1 << 8)
 #define OUT_BUF_SIZE (1 << 8)
 
+static osTimerId_t g_bt_scan_timer = NULL;
 
 static SRes Decode2(CLzmaDec *state, ISeqOutStream *outStream, ISeqInStream *inStream,
     UInt64 unpackSize)
@@ -354,4 +366,81 @@ errcode_t post_func_to_graphic(void (*func)(void))
 
 #ifdef __cplusplus
 }
-#endif /* __cplusplus */
\ No newline at end of file
+#endif /* __cplusplus */
+
+
+static void custom_factory_bt_scan_callback(void)
+{
+#ifdef SUPPORT_BLE_SERVICE
+  std::list<OHOS::BluetoothCaseInfo> btScansDevicesList_ = OHOS::BluetoothModel::GetInstance()->GetCase();
+  std::list<OHOS::BluetoothCaseInfo>::iterator node = btScansDevicesList_.begin();
+  if (btScansDevicesList_.empty()) {
+      printf("btScansDevicesList_.empty()\n");
+      return;
+  }
+
+  int i = 0;
+
+  while (node != btScansDevicesList_.end()) {
+      i++;
+      printf("fac:device[%d]:name %s, addr:%02X %02X %02X %02X %02X %02X Rssi:%d\n",
+      i,node->deviceName,node->addr[0],node->addr[1],node->addr[2],node->addr[3],node->addr[4],node->addr[5],node->temp);
+
+      OHOS::BluetoothModel::GetInstance()->SortScansCaseRssi();
+      node++;
+  }
+#endif
+}  
+
+void custom_factory_bt_scan_start(void)
+{
+    if (g_bt_scan_timer == NULL) {
+        g_bt_scan_timer = osTimerNew((osTimerFunc_t)custom_factory_bt_scan_callback, osTimerPeriodic, NULL, NULL);
+    }
+    
+    if (g_bt_scan_timer) {
+        osTimerStart(g_bt_scan_timer, 2000); // 1秒间隔
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "custom_factory_bt_scan_start!");  
+    }
+#ifdef SUPPORT_BLE_SERVICE
+    #ifdef BLE_scan
+    srv_ble_start_scan();
+    #else
+    uint32_t device_classes = 
+    DEVICE_MAJOR_CLASS_AUDIO_VIDEO|DEVICE_MAJOR_CLASS_PHONE|SERVICE_AUDIO
+    |SERVICE_LIMITED_DISCOVERABILITY|SERVICE_POSITIONING|SERVICE_NETWORKING
+    |SERVICE_RENDER|SERVICE_CAPTURE|SERVICE_OBJECT_TRANSFER|SERVICE_TELEPHONY
+    |SERVICE_INFORMATION;
+    // errcode_t err = gap_br_set_inquiry_paramters(device_classes, 5);
+    errcode_t err = gap_br_set_inquiry_paramters(0,20);
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"gap_br_set_inquiry_paramters errcode_t %d!\n",err);
+
+    bool ret = gap_br_start_discovery();
+    OHOS::BluetoothModel::GetInstance()->SortScansCaseRssi();
+    #ifdef FD230
+    OHOS::BluetoothModel::GetInstance()->set_test_bt_falg(true);
+    #endif
+
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"gap_br_start_discovery bool %d!\n",ret);
+    #endif
+#endif
+}
+
+void custom_factory_bt_scan_stop(void)
+{
+    if (g_bt_scan_timer) {
+        osTimerStop(g_bt_scan_timer);
+        osTimerDelete(g_bt_scan_timer);
+        g_bt_scan_timer = NULL;
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "custom_factory_bt_scan_stop!");  
+    }
+#ifdef SUPPORT_BLE_SERVICE
+     #ifdef BLE_scan
+      srv_ble_stop_scan();
+      #else
+      bool ret = gap_br_cancel_discovery();
+      WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"gap_br_cancel_discovery bool %d!\n",ret);
+      
+      #endif
+#endif
+}
\ No newline at end of file
index cf97323..74c5db6 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * @Author: penglei 1624952103@qq.com
  * @Date: 2024-07-09 20:22:54
- * @LastEditors: SnickerSun snickersun@163.com
- * @LastEditTime: 2024-09-27 09:40:39
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2025-08-20 15:13:20
  * @FilePath: /FD230/code/sdk/drivers/peripheral/utilscpp/custom_utilscpp.h
  * @Description: 
  * 
@@ -31,6 +31,8 @@ void CustomEventPublish(uint16_t topic, uint8_t *data , uint32_t size);
 void custom_set_volume(uint8_t channel,int32_t sounding);
 
 
+void custom_factory_bt_scan_start(void);
+void custom_factory_bt_scan_stop(void);
 
 /**
  * input: