增加产测二维码界面 2107/1 2107/head 2108/target/1
authorCaisking <Casiking@zhihuishixun.com>
Wed, 20 Aug 2025 04:04:34 +0000 (12:04 +0800)
committerCaisking <Casiking@zhihuishixun.com>
Wed, 20 Aug 2025 04:04:34 +0000 (12:04 +0800)
37 files changed:
code/sdk/zhihui/UI/producttest/CMakeLists.txt
code/sdk/zhihui/UI/producttest/README_QRCode.md [new file with mode: 0644]
code/sdk/zhihui/UI/producttest/include/testGPS.h
code/sdk/zhihui/UI/producttest/include/testLCD.h
code/sdk/zhihui/UI/producttest/include/testModel.h
code/sdk/zhihui/UI/producttest/include/testPresenter.h
code/sdk/zhihui/UI/producttest/include/testQRCode.h [new file with mode: 0644]
code/sdk/zhihui/UI/producttest/include/testSEChipTest.h
code/sdk/zhihui/UI/producttest/include/testTP.h
code/sdk/zhihui/UI/producttest/include/testView.h
code/sdk/zhihui/UI/producttest/include/testbt.h
code/sdk/zhihui/UI/producttest/include/testcat1.h
code/sdk/zhihui/UI/producttest/include/testchanging.h
code/sdk/zhihui/UI/producttest/include/testgsenson.h
code/sdk/zhihui/UI/producttest/include/testhrsenson.h
code/sdk/zhihui/UI/producttest/include/testluminance.h
code/sdk/zhihui/UI/producttest/include/testmagnetic.h
code/sdk/zhihui/UI/producttest/include/testmicrophone.h
code/sdk/zhihui/UI/producttest/include/testmotor.h
code/sdk/zhihui/UI/producttest/include/testspeak.h
code/sdk/zhihui/UI/producttest/src/testGPS.cpp
code/sdk/zhihui/UI/producttest/src/testLCD.cpp
code/sdk/zhihui/UI/producttest/src/testModel.cpp
code/sdk/zhihui/UI/producttest/src/testQRCode.cpp [new file with mode: 0644]
code/sdk/zhihui/UI/producttest/src/testSEChipTest.cpp
code/sdk/zhihui/UI/producttest/src/testTP.cpp
code/sdk/zhihui/UI/producttest/src/testView.cpp
code/sdk/zhihui/UI/producttest/src/testbt.cpp
code/sdk/zhihui/UI/producttest/src/testcat1.cpp
code/sdk/zhihui/UI/producttest/src/testchanging.cpp
code/sdk/zhihui/UI/producttest/src/testgsenson.cpp
code/sdk/zhihui/UI/producttest/src/testhrsenson.cpp
code/sdk/zhihui/UI/producttest/src/testluminance.cpp
code/sdk/zhihui/UI/producttest/src/testmagnetic.cpp
code/sdk/zhihui/UI/producttest/src/testmicrophone.cpp
code/sdk/zhihui/UI/producttest/src/testmotor.cpp
code/sdk/zhihui/UI/producttest/src/testspeak.cpp

index a1eada4..2ce9f8d 100644 (file)
@@ -54,6 +54,21 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks
    
     ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits
+    ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks
+    ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/innerkits
+
+    ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/events
+    ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits
+    ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits
+    ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils
+    ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits
+    ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits
+    ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks
+    ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits
+    ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/components
+
+    ${ROOT_DIR}/open_source/openharmony/third_party/qrcodegen/cpp
+
     ${ROOT_DIR}/zhihui/services/factorytest_service
     ${ROOT_DIR}/zhihui/drivers/
     ${ROOT_DIR}/zhihui/4g/cat1Service/include
diff --git a/code/sdk/zhihui/UI/producttest/README_QRCode.md b/code/sdk/zhihui/UI/producttest/README_QRCode.md
new file mode 100644 (file)
index 0000000..a94a25a
--- /dev/null
@@ -0,0 +1,50 @@
+# 产测二维码功能说明
+
+## 功能概述
+在产测功能中添加了一个二维码界面,可以显示产测结果的二维码,方便扫码获取产测信息。
+
+## 实现文件
+- `include/testQRCode.h` - 二维码视图头文件
+- `src/testQRCode.cpp` - 二维码视图实现文件
+
+## 功能特点
+1. **自动生成二维码内容**:包含设备信息、当前时间和测试结果
+2. **居中显示**:二维码在屏幕中央显示,大小为280x280像素
+3. **实时更新**:二维码内容会根据当前的测试结果动态更新
+4. **易于扫描**:使用低纠错级别,确保二维码清晰易读
+
+## 二维码内容格式
+```
+FD230产测结果
+设备: FD230
+时间: HH:MM:SS
+测试结果:
+LCD未测试
+Touch_Panel未测试
+Magnetic未测试
+...
+```
+
+## 使用方法
+1. 在产测主界面中,点击"QRCode"按钮
+2. 系统会显示包含当前产测结果的二维码
+3. 使用手机或其他设备扫描二维码
+4. 获取产测结果信息
+
+## 技术实现
+- 使用`UIQrcode`组件显示二维码
+- 通过`testModel::GetSummaryString()`获取测试结果
+- 使用`uapi_get_HHMMSS_Time()`获取当前时间
+- 二维码内容使用UTF-8编码,支持中文显示
+
+## 注意事项
+1. 二维码内容长度有限制,过长的内容可能无法正常显示
+2. 建议在测试完成后查看二维码,以获取完整的测试结果
+3. 二维码的纠错级别设置为LOW,确保在有限空间内显示更多信息
+
+## 扩展功能
+可以根据需要扩展二维码内容,例如:
+- 添加设备序列号
+- 添加固件版本信息
+- 添加测试人员信息
+- 添加测试环境参数
index d287853..20da60e 100644 (file)
@@ -76,7 +76,10 @@ namespace OHOS
         UILabelButtonExt* labelButton_next = nullptr;
         bool initViewStatus{false};
         UILabel *Title{nullptr};           // 标题
-
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index 90cee71..324594c 100644 (file)
@@ -31,6 +31,9 @@ namespace OHOS
         bool initViewStatus{false};
         UILabelButtonExt* labelButton_next = nullptr;
         UILabel *Title{nullptr};           // 标题
+
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index e731175..ad8264d 100644 (file)
@@ -74,7 +74,7 @@ namespace OHOS
         bool SetResult(std::string viewIdstr);
         test_status_enum GetResult(int viewId);
         std::string GetSummaryString();
-        std::string GetViewId(int viewid);
+        std::string GetTestItemDescription(int viewid);
    
 
     private:
index 5befff5..7930646 100644 (file)
@@ -78,6 +78,7 @@ namespace OHOS
         // pressuretest,\r
         PRESSURETEST,\r
         OLDTEST,\r
+        QRCODE,  // 添加二维码视图\r
         DEEPSLEEP,\r
         \r
         shutdown,\r
diff --git a/code/sdk/zhihui/UI/producttest/include/testQRCode.h b/code/sdk/zhihui/UI/producttest/include/testQRCode.h
new file mode 100644 (file)
index 0000000..e423500
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * @Author: penglei 1624952103@qq.com
+ * @Date: 2025-01-27 10:00:00
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2025-01-27 10:00:00
+ * @FilePath: /FD230/code/sdk/zhihui/UI/producttest/include/testQRCode.h
+ * @Description: 产测二维码视图头文件
+ */
+#ifndef TEST_QRCODE_VIEW_H
+#define TEST_QRCODE_VIEW_H
+
+#include "View.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label.h"
+#include "components/ui_qrcode.h"
+#include "producttest/include/testPresenter.h"
+#include <iostream>
+
+namespace OHOS
+{
+    class testQRCodeView
+    {
+    public:
+        testQRCodeView();
+        virtual ~testQRCodeView();
+        static testQRCodeView *GetInstance(void);
+
+        UIScrollView *testQRCodeInitIView(uint8_t);
+        void ClearAll(void);
+
+    private:
+        bool testQRCodeScrollViewInit(uint8_t id);
+        std::string GenerateQRCodeContent();
+        UIScrollView *testQRCodeScrollView{nullptr};
+        bool initViewStatus{false};
+        UILabel *Title{nullptr};           // 标题
+        UIQrcode *QRCodeView{nullptr};     // 二维码视图
+    };
+}
+
+#endif
index e8bbe00..1d70419 100644 (file)
@@ -50,6 +50,10 @@ namespace OHOS
         UILabel *Title{nullptr};           // 标题
 
         bool initViewStatus{false};
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index dfd3c05..b5f35bd 100644 (file)
@@ -43,6 +43,9 @@ namespace OHOS
         bool initViewStatus{false};
         UILabelButtonExt* labelButton_next = nullptr;
         UILabel *Title{nullptr};           // 标题
+
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index f23bfe1..dcf0891 100644 (file)
@@ -29,6 +29,7 @@
 #include "producttest/include/testbt.h"\r
 #include "producttest/include/testSEChipTest.h"\r
 #include "producttest/include/testPing.h"\r
+#include "producttest/include/testQRCode.h"\r
 #ifdef SUPPORT_GNSS\r
 #include "producttest/include/testGPS.h"\r
 #endif\r
@@ -96,6 +97,7 @@ namespace OHOS
         bool ChangeBTTESTView(int16_t thisView);\r
         bool ChangeSEChipTESTView(int16_t thisView);\r
         bool ChangePingTESTView(int16_t thisView);\r
+        bool ChangeQRCodeTESTView(int16_t thisView);\r
 #ifdef SUPPORT_GNSS\r
         bool ChangeGPSTESTView(int16_t thisView);\r
 #endif\r
@@ -109,8 +111,7 @@ namespace OHOS
         void ChangeView(int16_t hideView, int16_t showView);\r
         UIScrollView *GetSystemScrollView(int ViewId);\r
 \r
-        void AddResultButtons(UIScrollView *scrollView, int16_t viewId);\r
-\r
+        bool AddResultButtons(UIScrollView *scrollView, int16_t viewId,UILabelButton*&oktestBtn,UILabelButton*&failtestBtn);\r
     private:\r
         void InitIView(void);\r
         void initView_ext(int x, int y, int w, int h, int interval, const char *imagsrc);\r
@@ -144,6 +145,7 @@ namespace OHOS
 \r
         testSEChipView *test_SEChip_view{nullptr};\r
         testPingView *test_Ping_view{nullptr};\r
+        testQRCodeView *test_QRCode_view{nullptr};\r
 #ifdef SUPPORT_GNSS\r
         testGPSView *test_GPS_view{nullptr};\r
 #endif\r
index 4cf8d32..739e1f3 100644 (file)
@@ -74,7 +74,10 @@ namespace OHOS
 
         bool initViewStatus{false};
         UILabel *Title{nullptr};           // 标题
-       
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index d38f5eb..4ec0c6d 100644 (file)
@@ -94,6 +94,10 @@ namespace OHOS
         bool initViewStatus{false};
         UILabel *Title{nullptr};           // 标题
         UILabelButtonExt* button{NULL};
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index 959bdf0..3c677a8 100644 (file)
@@ -50,6 +50,10 @@ namespace OHOS
         UILabel *charnge_label{nullptr};           // 标题
 
         UILabelButtonExt* labelButton_next = nullptr;
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index 599a773..9e85b70 100644 (file)
@@ -50,6 +50,10 @@ namespace OHOS
         UILabel *z{nullptr}; //  "固件版本"
 
         UILabelButtonExt* labelButton_next = nullptr;
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index fe2a260..627b3cb 100644 (file)
@@ -101,6 +101,10 @@ namespace OHOS
         bool initViewStatus{false};
         UILabelButtonExt* labelButton_next = nullptr;
         UILabel *Title{nullptr};           // 标题
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index 444101a..a87320f 100644 (file)
@@ -38,6 +38,10 @@ namespace OHOS
 
         UILabelButtonExt* labelButton_next = nullptr;
         UILabel *Title{nullptr};           // 标题
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index e3c0304..b613db1 100644 (file)
@@ -7,11 +7,11 @@
 #include "components/ui_label.h"
 #include "components/ui_label_ext.h"
 #include "components/ui_image_view.h"
+#include "components/ui_label_button_ext.h"
 #include "producttest/include/testmagnetic.h"
 #ifdef FD230
 #include "CompassModel.h"
 #endif
-#include "components/ui_label_button_ext.h"
 //#include "cmsis_os.h"
 #include <iostream>
 
@@ -52,6 +52,10 @@ namespace OHOS
         UILabel *z{nullptr}; //  "固件版本"
 
         UILabelButtonExt* labelButton_next = nullptr;
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index 818db62..a8fce1f 100644 (file)
@@ -70,6 +70,10 @@ namespace OHOS
 #endif
         bool initViewStatus{false};
         UILabel *Title{nullptr};           // 标题
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index 782b2b3..cdec49d 100644 (file)
@@ -52,6 +52,10 @@ namespace OHOS
         UILabelButtonExt* button[2]{NULL};
         bool initViewStatus{false};
         UILabel *Title{nullptr};           // 标题
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index c565d57..94f12af 100644 (file)
@@ -51,6 +51,10 @@ namespace OHOS
         UILabelButtonExt* labelButton_next = nullptr;
         UILabelButtonExt* button[2]{NULL};
         UILabel *Title{nullptr};           // 标题
+        
+        // 添加成功失败按钮
+        UILabelButton *oktestBtn{nullptr};
+        UILabelButton *failtestBtn{nullptr};
     };
 }
 #endif
\ No newline at end of file
index c8e77cd..07cdb6c 100644 (file)
@@ -85,6 +85,18 @@ namespace OHOS
                 delete GPSbutton[1];
                 GPSbutton[1]=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
           
           
 
@@ -269,6 +281,17 @@ namespace OHOS
 
         testGPSScrollView->SetTouchable(true);
         testGPSScrollView->SetDraggable(true);
+        
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testGPSScrollView, GPS_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(GPS_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+        
         uint32_t tick;
         osStatus_t retTimer;
         GPS_TEST_timer = osTimerNew((osTimerFunc_t)gpsdataTimerCallBackproc, osTimerPeriodic, NULL, NULL);
index 9c7a0c2..b954aae 100644 (file)
@@ -3,6 +3,7 @@
 #include "producttest/include/testPresenter.h"
 #include "producttest/include/testLCD.h"
 #include "producttest/include/testView.h"
+#include "producttest/include/testModel.h"
 #include "cmsis_os2.h"
 #include "custom_runtime.h"
 #ifdef __cplusplus
@@ -72,6 +73,18 @@ namespace OHOS
             // } else {
             //     // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_cat1 vote\r\n");
             // }
+            /////////////////////////
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            /////////////////////////////
 
             delete testLCDScrollView;
             testLCDScrollView=nullptr;
@@ -182,7 +195,15 @@ namespace OHOS
         // }
 
 
-       
+
+        testView::GetInstance()->AddResultButtons(testLCDScrollView,LCD_TEST,oktestBtn,failtestBtn);
+        // 获取测试项描述
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(LCD_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         return true;
     }
 
index f533183..40dfc91 100644 (file)
@@ -125,12 +125,12 @@ namespace OHOS
         return test_status_list[viewId].status;
     }
 
-    // è\8e·å\8f\96æ\8f\8fè¿°str
-    std::string testModel::GetViewId(int viewId)
+    // è\8e·å\8f\96æµ\8bè¯\95项æ\8f\8fè¿°å­\97符串
+    std::string testModel::GetTestItemDescription(int viewId)
     {
         if (viewId < 0 || viewId >= MAX_TEST_ITEM)
         {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testModel::GetResult: viewId out of range");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testModel::GetTestItemDescription: viewId out of range");
             return nullptr;
         }
         return test_status_list[viewId].test_result;
diff --git a/code/sdk/zhihui/UI/producttest/src/testQRCode.cpp b/code/sdk/zhihui/UI/producttest/src/testQRCode.cpp
new file mode 100644 (file)
index 0000000..c1fd0b2
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * @Author: penglei 1624952103@qq.com
+ * @Date: 2025-01-27 10:00:00
+ * @LastEditors: penglei 1624952103@qq.com
+ * @LastEditTime: 2025-01-27 10:00:00
+ * @FilePath: /FD230/code/sdk/zhihui/UI/producttest/src/testQRCode.cpp
+ * @Description: 产测二维码视图实现文件
+ */
+#include "producttest/include/testQRCode.h"
+#include "producttest/include/testModel.h"
+#include "wearable_log.h"
+#include <string>
+
+namespace OHOS
+{
+    static testQRCodeView *g_pTestQRCodeView{nullptr};
+
+    testQRCodeView::testQRCodeView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "testQRCodeView::testQRCodeView");
+        g_pTestQRCodeView = this;
+    }
+
+    testQRCodeView::~testQRCodeView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "testQRCodeView::~testQRCodeView");
+        ClearAll();
+        g_pTestQRCodeView = nullptr;
+    }
+
+    testQRCodeView *testQRCodeView::GetInstance(void)
+    {
+        return g_pTestQRCodeView;
+    }
+
+    void testQRCodeView::ClearAll(void)
+    {
+        if (testQRCodeScrollView)
+        {
+            testQRCodeScrollView->RemoveAll();
+            delete testQRCodeScrollView;
+            testQRCodeScrollView = nullptr;
+        }
+        if (Title)
+        {
+            delete Title;
+            Title = nullptr;
+        }
+        if (QRCodeView)
+        {
+            delete QRCodeView;
+            QRCodeView = nullptr;
+        }
+        initViewStatus = false;
+    }
+
+    UIScrollView *testQRCodeView::testQRCodeInitIView(uint8_t id)
+    {
+        if (initViewStatus)
+        {
+            return testQRCodeScrollView;
+        }
+
+        if (!testQRCodeScrollViewInit(id))
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testQRCodeScrollViewInit failed");
+            return nullptr;
+        }
+
+        initViewStatus = true;
+        return testQRCodeScrollView;
+    }
+
+    bool testQRCodeView::testQRCodeScrollViewInit(uint8_t id)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "testQRCodeView::testQRCodeScrollViewInit");
+
+        // 创建滚动视图
+        testQRCodeScrollView = new UIScrollView();
+        if (testQRCodeScrollView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testQRCodeScrollView new failed");
+            return false;
+        }
+        testQRCodeScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        testQRCodeScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        testQRCodeScrollView->SetTouchable(true);
+        testQRCodeScrollView->SetDraggable(true);
+
+        // 创建标题
+        Title = new UILabel();
+        if (Title == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Title new failed");
+            return false;
+        }
+        Title->SetPosition(0, 20, Screen::GetInstance().GetWidth(), 40);
+        Title->SetText("产测二维码");
+        Title->SetStyle(STYLE_TEXT_FONT, 30);
+        Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+        Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        testQRCodeScrollView->Add(Title);
+
+        // 创建二维码视图
+        QRCodeView = new UIQrcode();
+        if (QRCodeView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QRCodeView new failed");
+            return false;
+        }
+
+        // 设置二维码位置和大小(居中显示)
+        int qrSize = 280;
+        int qrX = (Screen::GetInstance().GetWidth() - qrSize) / 2;
+        int qrY = 100;
+        QRCodeView->SetPosition(qrX, qrY, qrSize, qrSize);
+        QRCodeView->SetECCLevel(QrCode::Ecc::LOW);
+        QRCodeView->SetAutoEnable(false);
+        QRCodeView->SetResizeMode(UIImageView::ImageResizeMode::CENTER);
+
+        // 获取产测结果汇总字符串并设置为二维码内容
+        std::string qrContent = GenerateQRCodeContent();
+        QRCodeView->SetQrcodeInfo(qrContent.c_str());
+
+        testQRCodeScrollView->Add(QRCodeView);
+
+        return true;
+    }
+
+    std::string testQRCodeView::GenerateQRCodeContent()
+    {
+        std::string qrContent = "产测结果\n";
+        
+        // 添加设备信息
+        qrContent += "设备: FD230\n";
+        qrContent += "时间: ";
+        
+        // 获取当前时间
+        char current_time[9];
+        if (uapi_get_HHMMSS_Time(current_time, ':', true) == ERRCODE_SUCC)
+        {
+            qrContent += current_time;
+        }
+        qrContent += "\n";
+        
+        // 添加测试结果
+        std::string testSummary = testModel::GetInstance()->GetSummaryString();
+        if (!testSummary.empty())
+        {
+            qrContent += "测试结果:\n";
+            qrContent += testSummary;
+        }
+        else
+        {
+            qrContent += "暂无测试结果";
+        }
+        
+        return qrContent;
+    }
+}
index 043697d..608dc1c 100644 (file)
@@ -77,6 +77,18 @@ namespace OHOS
                 delete efuse_label;
                 efuse_label=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
 
             // uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
@@ -233,6 +245,16 @@ namespace OHOS
         Title= testAboutView::GetInstance()->init_title(142,40,"SEChip_TEST");
         testSEChipScrollView->Add(Title);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testSEChipScrollView, APPI_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(APPI_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
         //     uapi_pm_add_sleep_veto(PM_ID_P_TEST);
index 91394e0..a52ddb3 100644 (file)
@@ -70,6 +70,20 @@ namespace OHOS
             // } else {
             //     // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_cat1 vote\r\n");
             // }
+
+            /////////////////////////
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            /////////////////////////////
+
             delete testTPScrollView;
             testTPScrollView=nullptr;
 
@@ -192,6 +206,15 @@ namespace OHOS
 
         
 
+        testView::GetInstance()->AddResultButtons(testTPScrollView,TP_TEST,oktestBtn,failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(TP_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         return true;
     }
 
index c2575c7..a85de54 100644 (file)
@@ -58,6 +58,7 @@ namespace OHOS
         {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
+        {QRCODE, "QRCodeButton", "QRCode", "QRCodeButton_next", &testView::ChangeQRCodeTESTView, true},\r
 #if defined(SUPPORT_GNSS)\r
         {GPSTEST, "GPSTestbutton", "GPSTest", "GPSTestbutton_next", &testView::ChangeGPSTESTView, true},\r
 #endif\r
@@ -120,18 +121,6 @@ namespace OHOS
                 }\r
             }\r
         }\r
-        /////////////////////////\r
-        if (oktestBtn)\r
-        {\r
-            delete oktestBtn;\r
-            oktestBtn = nullptr;\r
-        }\r
-        if (failtestBtn)\r
-        {\r
-            delete failtestBtn;\r
-            failtestBtn = nullptr;\r
-        }\r
-        /////////////////////////////\r
         if (test_about_view)\r
         {\r
             delete test_about_view; // 1\r
@@ -216,6 +205,23 @@ namespace OHOS
             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
@@ -275,11 +281,11 @@ namespace OHOS
         return true;\r
     }\r
 \r
-    void testView::AddResultButtons(UIScrollView *scrollView, int16_t viewId)\r
+    bool testView::AddResultButtons(UIScrollView *scrollView, int16_t viewId,UILabelButton*&oktestBtn,UILabelButton*&failtestBtn)\r
     {\r
         if (scrollView == nullptr)\r
         {\r
-            return;\r
+            return false;\r
         }\r
 \r
         printf("目前测试项id:%d",viewId);\r
@@ -291,7 +297,7 @@ namespace OHOS
             if (oktestBtn == nullptr)\r
             {\r
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");\r
-                return; // 内存分配失败,返回false\r
+                return false; // 内存分配失败,返回false\r
             }\r
             oktestBtn->SetPosition(40, 80);\r
             oktestBtn->Resize(135, 88);\r
@@ -305,7 +311,7 @@ namespace OHOS
             if (failtestBtn == nullptr)\r
             {\r
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error");\r
-                return; // 内存分配失败,返回false\r
+                return false; // 内存分配失败,返回false\r
             }\r
             failtestBtn->SetPosition(220, 80);\r
             failtestBtn->Resize(135, 88);\r
@@ -318,7 +324,7 @@ namespace OHOS
         test_status_enum status = testModel::GetInstance()->GetResult(viewId);\r
         printf("目前该项的测试状态为:%d\n",status);\r
         // 获取测试项描述\r
-        std::string viewDesc = testModel::GetInstance()->GetViewId(viewId);\r
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(viewId);\r
         printf("目前测试项的描述是:%s\n",viewDesc.c_str());\r
 \r
         if (oktestBtn)\r
@@ -341,9 +347,10 @@ namespace OHOS
 \r
             // 设置按钮标识\r
             std::string okIdStr = "TestOK" + viewDesc;\r
-            printf("设置 按键的viewId %s\n", okIdStr.c_str());\r
+            printf("设置成功按键的viewId %s\n", okIdStr.c_str());\r
             oktestBtn->SetViewId(okIdStr.c_str());\r
-            oktestBtn->SetOnClickListener(testPresenter::GetInstance());\r
+            UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());\r
+            oktestBtn->SetOnClickListener(clickListener);\r
             scrollView->Add(oktestBtn);\r
         }\r
 \r
@@ -368,11 +375,14 @@ namespace OHOS
 \r
             // 设置按钮标识(修复了原代码中的错误)\r
             std::string failIdStr = "TestNO" + viewDesc;\r
-            printf("设置 按键的viewId %s\n", failIdStr.c_str());\r
+            printf("设置失败按键的viewId %s\n", failIdStr.c_str());\r
             failtestBtn->SetViewId(failIdStr.c_str());\r
-            failtestBtn->SetOnClickListener(testPresenter::GetInstance());\r
+            UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());\r
+            failtestBtn->SetOnClickListener(clickListener);\r
             scrollView->Add(failtestBtn);\r
         }\r
+\r
+        return true;\r
     }\r
 \r
     /// @brief 设置按钮\r
@@ -483,7 +493,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_LCD_view->testLCDInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], LCD_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -501,7 +510,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_TP_view->testTPInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], TP_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -519,7 +527,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_MG_view->testmagicInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], MAGETIC_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -537,7 +544,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_lum_view->testLUMInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], LUMINANCE_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -555,7 +561,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_charging_view->testCHANINGInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], BAT_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -573,7 +578,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_speak_view->testSPEAKInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], SPK_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -591,7 +595,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_motor_view->testMOTORInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], MOTOR_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -610,7 +613,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_cat1_view->testcat1InitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], CAT1_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
 #endif\r
@@ -646,7 +648,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_MP_view->testmicrophoneInitIView(thisView);\r
-            // AddResultButtons(SystemScrollView[thisView], thisView);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -664,7 +665,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_hr_view->testhrsensonInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], HR_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -682,7 +682,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_G_view->testGSENSONInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], GSENSOR_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -719,7 +718,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_BT_view->testBTInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], BT_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -737,7 +735,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_SEChip_view->SEChipInitIView(thisView);\r
-            AddResultButtons(SystemScrollView[thisView], APPI_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
@@ -747,7 +744,7 @@ namespace OHOS
     {\r
         if (SystemScrollView[thisView] == nullptr)\r
         {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangePingTESTView");\r
             test_Ping_view = new testPingView();\r
             if (test_Ping_view == nullptr)\r
             {\r
@@ -759,6 +756,24 @@ namespace OHOS
         }\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(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
@@ -773,7 +788,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_GPS_view->testGPSInitIView((uint8_t)thisView);\r
-            AddResultButtons(SystemScrollView[thisView], GPS_TEST);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
 \r
@@ -794,7 +808,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_pressure_view->testpressureInitIView((uint8_t)thisView);\r
-            // AddResultButtons(SystemScrollView[thisView], thisView);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
 \r
@@ -814,7 +827,6 @@ namespace OHOS
                 return false;\r
             }\r
             SystemScrollView[thisView] = test_A5133_view->testA5133InitIView(thisView);\r
-            // AddResultButtons(SystemScrollView[thisView], thisView);\r
             group->Add(SystemScrollView[thisView]);\r
         }\r
         return true;\r
index d1ac6d9..5ff2a92 100644 (file)
@@ -90,6 +90,18 @@ namespace OHOS
                 Title=nullptr;
             }
             
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             for(int i=0;i<5;i++)
             {
                 if(label_BR_SCAN[i])
@@ -387,6 +399,17 @@ namespace OHOS
         }
 
         discovery_falg=false;
+        
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testBTScrollView, BT_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(BT_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+        
         // uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
         //     uapi_pm_add_sleep_veto(PM_ID_P_TEST);
index 75f57b6..f6cd759 100644 (file)
@@ -81,6 +81,18 @@ namespace OHOS
                 delete Title;
                 Title=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
           
             
 
@@ -339,6 +351,17 @@ namespace OHOS
 
         testcat1ScrollView->SetTouchable(true);
         testcat1ScrollView->SetDraggable(true);
+        
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testcat1ScrollView, CAT1_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(CAT1_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+        
         uint32_t tick;
         osStatus_t retTimer;
         Gsenson_TEST_timer = osTimerNew((osTimerFunc_t)mgdataTimerCallBack, osTimerPeriodic, NULL, NULL);
index 21e59a1..b6ddea1 100644 (file)
@@ -74,6 +74,18 @@ namespace OHOS
                 charnge_label=nullptr;
             }
             
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -208,7 +220,15 @@ namespace OHOS
         charnge_label= testAboutView::GetInstance()->init_title(100,250,battery_buf);
         testCHANINGScrollView->Add(charnge_label);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testCHANINGScrollView, BAT_TEST, oktestBtn, failtestBtn);
 
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(BAT_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
 
         //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
index 34bc4f6..73f92f9 100644 (file)
@@ -104,6 +104,19 @@ namespace OHOS
                 delete labelButton_next;
                 labelButton_next=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -292,8 +305,15 @@ namespace OHOS
         testGsonsonScrollView->SetTouchable(true);
         testGsonsonScrollView->SetDraggable(true);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testGsonsonScrollView, GSENSOR_TEST, oktestBtn, failtestBtn);
 
-
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(GSENSOR_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
 
         return true;
     }
index 440a6c3..c78b6de 100644 (file)
@@ -80,6 +80,19 @@ namespace OHOS
                 delete Title;
                 Title=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -293,6 +306,16 @@ namespace OHOS
         testhrsensonScrollView->SetTouchable(true);
         testhrsensonScrollView->SetDraggable(true);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testhrsensonScrollView, HR_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(HR_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
 #ifdef SUPPORT_PPG_SERVICE
         int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST;
         send_ppg_cmd_msg(md);
index 898c28a..dc606eb 100644 (file)
@@ -64,6 +64,19 @@ namespace OHOS
                 delete Title;
                 Title=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -136,6 +149,16 @@ namespace OHOS
         Title= testAboutView::GetInstance()->init_title(99,54,"BRIGHTNESS_TEST");
         testLUMScrollView->Add(Title);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testLUMScrollView, LUMINANCE_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(LUMINANCE_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         // uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
         //     uapi_pm_add_sleep_veto(PM_ID_P_TEST);
index 7e6f556..ff47f4a 100644 (file)
@@ -87,6 +87,19 @@ namespace OHOS
                 delete labelButton_next;
                 labelButton_next=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -287,6 +300,16 @@ namespace OHOS
         testmagicScrollView->SetTouchable(true);
         testmagicScrollView->SetDraggable(true);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testmagicScrollView, MAGETIC_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(MAGETIC_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
         //     uapi_pm_add_sleep_veto(PM_ID_P_TEST);
index c3bb685..87e8922 100644 (file)
@@ -85,6 +85,19 @@ namespace OHOS
                 delete Title;
                 Title=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -307,6 +320,16 @@ namespace OHOS
         testmakephoneScrollView->SetTouchable(true);
         testmakephoneScrollView->SetDraggable(true);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testmakephoneScrollView, MIC_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(MIC_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
         //     uapi_pm_add_sleep_veto(PM_ID_P_TEST);
index 33ccb7d..8279212 100644 (file)
@@ -68,6 +68,19 @@ namespace OHOS
                 delete Title;
                 Title=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -209,6 +222,16 @@ namespace OHOS
         Title= testAboutView::GetInstance()->init_title(136,45,"MOTOR_TEST");
         tesMOTORScrollView->Add(Title);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(tesMOTORScrollView, MOTOR_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(MOTOR_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
         //     uapi_pm_add_sleep_veto(PM_ID_P_TEST);
index e741868..9dfadbd 100644 (file)
@@ -69,6 +69,19 @@ namespace OHOS
                 delete Title;
                 Title=nullptr;
             }
+            
+            // 清理成功失败按钮
+            if (oktestBtn)
+            {
+                delete oktestBtn;
+                oktestBtn = nullptr;
+            }
+            if (failtestBtn)
+            {
+                delete failtestBtn;
+                failtestBtn = nullptr;
+            }
+            
             //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
             // if (cnt == 1) {
             //     uapi_pm_remove_sleep_veto(PM_ID_P_TEST);
@@ -236,6 +249,16 @@ namespace OHOS
         testSPEAKScrollView->SetTouchable(true);
         testSPEAKScrollView->SetDraggable(true);
 
+        // 添加成功失败按钮
+        testView::GetInstance()->AddResultButtons(testSPEAKScrollView, SPK_TEST, oktestBtn, failtestBtn);
+
+        // 重新设置viewId,使用对应的测试项ID
+        std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(SPK_TEST);
+        std::string okIdStr = "TestOK" + viewDesc;
+        std::string failIdStr = "TestNO" + viewDesc;
+        oktestBtn->SetViewId(okIdStr.c_str());
+        failtestBtn->SetViewId(failIdStr.c_str());
+
         //  uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST);
         // if (cnt == 0) {
         //     uapi_pm_add_sleep_veto(PM_ID_P_TEST);