From 82d279e816439738a1dbb654727f891b01551f46 Mon Sep 17 00:00:00 2001 From: Caisking Date: Wed, 20 Aug 2025 12:04:34 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E4=BA=A7=E6=B5=8B=E4=BA=8C?= =?utf8?q?=E7=BB=B4=E7=A0=81=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- code/sdk/zhihui/UI/producttest/CMakeLists.txt | 15 ++ .../zhihui/UI/producttest/README_QRCode.md | 50 ++++++ .../zhihui/UI/producttest/include/testGPS.h | 5 +- .../zhihui/UI/producttest/include/testLCD.h | 3 + .../zhihui/UI/producttest/include/testModel.h | 2 +- .../UI/producttest/include/testPresenter.h | 1 + .../UI/producttest/include/testQRCode.h | 41 +++++ .../UI/producttest/include/testSEChipTest.h | 4 + .../zhihui/UI/producttest/include/testTP.h | 3 + .../zhihui/UI/producttest/include/testView.h | 6 +- .../zhihui/UI/producttest/include/testbt.h | 5 +- .../zhihui/UI/producttest/include/testcat1.h | 4 + .../UI/producttest/include/testchanging.h | 4 + .../UI/producttest/include/testgsenson.h | 4 + .../UI/producttest/include/testhrsenson.h | 4 + .../UI/producttest/include/testluminance.h | 4 + .../UI/producttest/include/testmagnetic.h | 6 +- .../UI/producttest/include/testmicrophone.h | 4 + .../zhihui/UI/producttest/include/testmotor.h | 4 + .../zhihui/UI/producttest/include/testspeak.h | 4 + .../sdk/zhihui/UI/producttest/src/testGPS.cpp | 23 +++ .../sdk/zhihui/UI/producttest/src/testLCD.cpp | 23 ++- .../zhihui/UI/producttest/src/testModel.cpp | 6 +- .../zhihui/UI/producttest/src/testQRCode.cpp | 160 ++++++++++++++++++ .../UI/producttest/src/testSEChipTest.cpp | 22 +++ code/sdk/zhihui/UI/producttest/src/testTP.cpp | 23 +++ .../zhihui/UI/producttest/src/testView.cpp | 88 +++++----- code/sdk/zhihui/UI/producttest/src/testbt.cpp | 23 +++ .../zhihui/UI/producttest/src/testcat1.cpp | 23 +++ .../UI/producttest/src/testchanging.cpp | 20 +++ .../zhihui/UI/producttest/src/testgsenson.cpp | 22 ++- .../UI/producttest/src/testhrsenson.cpp | 23 +++ .../UI/producttest/src/testluminance.cpp | 23 +++ .../UI/producttest/src/testmagnetic.cpp | 23 +++ .../UI/producttest/src/testmicrophone.cpp | 23 +++ .../zhihui/UI/producttest/src/testmotor.cpp | 23 +++ .../zhihui/UI/producttest/src/testspeak.cpp | 23 +++ 37 files changed, 695 insertions(+), 49 deletions(-) create mode 100644 code/sdk/zhihui/UI/producttest/README_QRCode.md create mode 100644 code/sdk/zhihui/UI/producttest/include/testQRCode.h create mode 100644 code/sdk/zhihui/UI/producttest/src/testQRCode.cpp diff --git a/code/sdk/zhihui/UI/producttest/CMakeLists.txt b/code/sdk/zhihui/UI/producttest/CMakeLists.txt index a1eada4cc..2ce9f8d04 100644 --- a/code/sdk/zhihui/UI/producttest/CMakeLists.txt +++ b/code/sdk/zhihui/UI/producttest/CMakeLists.txt @@ -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 index 000000000..a94a25a2f --- /dev/null +++ b/code/sdk/zhihui/UI/producttest/README_QRCode.md @@ -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,确保在有限空间内显示更多信息 + +## 扩展功能 +可以根据需要扩展二维码内容,例如: +- 添加设备序列号 +- 添加固件版本信息 +- 添加测试人员信息 +- 添加测试环境参数 diff --git a/code/sdk/zhihui/UI/producttest/include/testGPS.h b/code/sdk/zhihui/UI/producttest/include/testGPS.h index d28785330..20da60e2e 100644 --- a/code/sdk/zhihui/UI/producttest/include/testGPS.h +++ b/code/sdk/zhihui/UI/producttest/include/testGPS.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testLCD.h b/code/sdk/zhihui/UI/producttest/include/testLCD.h index 90cee71e1..324594cd1 100644 --- a/code/sdk/zhihui/UI/producttest/include/testLCD.h +++ b/code/sdk/zhihui/UI/producttest/include/testLCD.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testModel.h b/code/sdk/zhihui/UI/producttest/include/testModel.h index e73117535..ad8264d6a 100644 --- a/code/sdk/zhihui/UI/producttest/include/testModel.h +++ b/code/sdk/zhihui/UI/producttest/include/testModel.h @@ -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: diff --git a/code/sdk/zhihui/UI/producttest/include/testPresenter.h b/code/sdk/zhihui/UI/producttest/include/testPresenter.h index 5befff5a6..793064683 100644 --- a/code/sdk/zhihui/UI/producttest/include/testPresenter.h +++ b/code/sdk/zhihui/UI/producttest/include/testPresenter.h @@ -78,6 +78,7 @@ namespace OHOS // pressuretest, PRESSURETEST, OLDTEST, + QRCODE, // 添加二维码视图 DEEPSLEEP, shutdown, diff --git a/code/sdk/zhihui/UI/producttest/include/testQRCode.h b/code/sdk/zhihui/UI/producttest/include/testQRCode.h new file mode 100644 index 000000000..e423500e3 --- /dev/null +++ b/code/sdk/zhihui/UI/producttest/include/testQRCode.h @@ -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 + +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 diff --git a/code/sdk/zhihui/UI/producttest/include/testSEChipTest.h b/code/sdk/zhihui/UI/producttest/include/testSEChipTest.h index e8bbe00fc..1d7041991 100644 --- a/code/sdk/zhihui/UI/producttest/include/testSEChipTest.h +++ b/code/sdk/zhihui/UI/producttest/include/testSEChipTest.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testTP.h b/code/sdk/zhihui/UI/producttest/include/testTP.h index dfd3c05e9..b5f35bdf6 100644 --- a/code/sdk/zhihui/UI/producttest/include/testTP.h +++ b/code/sdk/zhihui/UI/producttest/include/testTP.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testView.h b/code/sdk/zhihui/UI/producttest/include/testView.h index f23bfe141..dcf0891f6 100644 --- a/code/sdk/zhihui/UI/producttest/include/testView.h +++ b/code/sdk/zhihui/UI/producttest/include/testView.h @@ -29,6 +29,7 @@ #include "producttest/include/testbt.h" #include "producttest/include/testSEChipTest.h" #include "producttest/include/testPing.h" +#include "producttest/include/testQRCode.h" #ifdef SUPPORT_GNSS #include "producttest/include/testGPS.h" #endif @@ -96,6 +97,7 @@ namespace OHOS bool ChangeBTTESTView(int16_t thisView); bool ChangeSEChipTESTView(int16_t thisView); bool ChangePingTESTView(int16_t thisView); + bool ChangeQRCodeTESTView(int16_t thisView); #ifdef SUPPORT_GNSS bool ChangeGPSTESTView(int16_t thisView); #endif @@ -109,8 +111,7 @@ namespace OHOS void ChangeView(int16_t hideView, int16_t showView); UIScrollView *GetSystemScrollView(int ViewId); - void AddResultButtons(UIScrollView *scrollView, int16_t viewId); - + bool AddResultButtons(UIScrollView *scrollView, int16_t viewId,UILabelButton*&oktestBtn,UILabelButton*&failtestBtn); private: void InitIView(void); void initView_ext(int x, int y, int w, int h, int interval, const char *imagsrc); @@ -144,6 +145,7 @@ namespace OHOS testSEChipView *test_SEChip_view{nullptr}; testPingView *test_Ping_view{nullptr}; + testQRCodeView *test_QRCode_view{nullptr}; #ifdef SUPPORT_GNSS testGPSView *test_GPS_view{nullptr}; #endif diff --git a/code/sdk/zhihui/UI/producttest/include/testbt.h b/code/sdk/zhihui/UI/producttest/include/testbt.h index 4cf8d32ae..739e1f3d3 100644 --- a/code/sdk/zhihui/UI/producttest/include/testbt.h +++ b/code/sdk/zhihui/UI/producttest/include/testbt.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testcat1.h b/code/sdk/zhihui/UI/producttest/include/testcat1.h index d38f5eb13..4ec0c6dd1 100644 --- a/code/sdk/zhihui/UI/producttest/include/testcat1.h +++ b/code/sdk/zhihui/UI/producttest/include/testcat1.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testchanging.h b/code/sdk/zhihui/UI/producttest/include/testchanging.h index 959bdf08e..3c677a831 100644 --- a/code/sdk/zhihui/UI/producttest/include/testchanging.h +++ b/code/sdk/zhihui/UI/producttest/include/testchanging.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testgsenson.h b/code/sdk/zhihui/UI/producttest/include/testgsenson.h index 599a773bb..9e85b70dd 100644 --- a/code/sdk/zhihui/UI/producttest/include/testgsenson.h +++ b/code/sdk/zhihui/UI/producttest/include/testgsenson.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testhrsenson.h b/code/sdk/zhihui/UI/producttest/include/testhrsenson.h index fe2a2605e..627b3cb7c 100644 --- a/code/sdk/zhihui/UI/producttest/include/testhrsenson.h +++ b/code/sdk/zhihui/UI/producttest/include/testhrsenson.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testluminance.h b/code/sdk/zhihui/UI/producttest/include/testluminance.h index 444101a8c..a87320f43 100644 --- a/code/sdk/zhihui/UI/producttest/include/testluminance.h +++ b/code/sdk/zhihui/UI/producttest/include/testluminance.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testmagnetic.h b/code/sdk/zhihui/UI/producttest/include/testmagnetic.h index e3c030473..b613db1a3 100644 --- a/code/sdk/zhihui/UI/producttest/include/testmagnetic.h +++ b/code/sdk/zhihui/UI/producttest/include/testmagnetic.h @@ -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 @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testmicrophone.h b/code/sdk/zhihui/UI/producttest/include/testmicrophone.h index 818db62b9..a8fce1f3e 100644 --- a/code/sdk/zhihui/UI/producttest/include/testmicrophone.h +++ b/code/sdk/zhihui/UI/producttest/include/testmicrophone.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testmotor.h b/code/sdk/zhihui/UI/producttest/include/testmotor.h index 782b2b371..cdec49d95 100644 --- a/code/sdk/zhihui/UI/producttest/include/testmotor.h +++ b/code/sdk/zhihui/UI/producttest/include/testmotor.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/include/testspeak.h b/code/sdk/zhihui/UI/producttest/include/testspeak.h index c565d5708..94f12afdb 100644 --- a/code/sdk/zhihui/UI/producttest/include/testspeak.h +++ b/code/sdk/zhihui/UI/producttest/include/testspeak.h @@ -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 diff --git a/code/sdk/zhihui/UI/producttest/src/testGPS.cpp b/code/sdk/zhihui/UI/producttest/src/testGPS.cpp index c8e77cd3b..07cdb6c52 100644 --- a/code/sdk/zhihui/UI/producttest/src/testGPS.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testGPS.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testLCD.cpp b/code/sdk/zhihui/UI/producttest/src/testLCD.cpp index 9c7a0c280..b954aae4e 100644 --- a/code/sdk/zhihui/UI/producttest/src/testLCD.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testLCD.cpp @@ -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; } diff --git a/code/sdk/zhihui/UI/producttest/src/testModel.cpp b/code/sdk/zhihui/UI/producttest/src/testModel.cpp index f53318330..40dfc9167 100644 --- a/code/sdk/zhihui/UI/producttest/src/testModel.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testModel.cpp @@ -125,12 +125,12 @@ namespace OHOS return test_status_list[viewId].status; } - // 获取描述str - std::string testModel::GetViewId(int viewId) + // 获取测试项描述字符串 + 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 index 000000000..c1fd0b2d7 --- /dev/null +++ b/code/sdk/zhihui/UI/producttest/src/testQRCode.cpp @@ -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 + +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; + } +} diff --git a/code/sdk/zhihui/UI/producttest/src/testSEChipTest.cpp b/code/sdk/zhihui/UI/producttest/src/testSEChipTest.cpp index 043697d80..608dc1c75 100644 --- a/code/sdk/zhihui/UI/producttest/src/testSEChipTest.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testSEChipTest.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testTP.cpp b/code/sdk/zhihui/UI/producttest/src/testTP.cpp index 91394e0fc..a52ddb394 100644 --- a/code/sdk/zhihui/UI/producttest/src/testTP.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testTP.cpp @@ -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; } diff --git a/code/sdk/zhihui/UI/producttest/src/testView.cpp b/code/sdk/zhihui/UI/producttest/src/testView.cpp index c2575c794..a85de5438 100644 --- a/code/sdk/zhihui/UI/producttest/src/testView.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testView.cpp @@ -58,6 +58,7 @@ namespace OHOS {BTTEST, "BTbutton", "BT", "BTbutton_next", &testView::ChangeBTTESTView, true}, {SEChipTest, "SEChipTestbutton", "SEChipTest", "SEChipTestbutton_next", &testView::ChangeSEChipTESTView, true}, {PingTest, "PingTestbutton", "PingTest", "PingTestbutton_next", &testView::ChangePingTESTView, true}, + {QRCODE, "QRCodeButton", "QRCode", "QRCodeButton_next", &testView::ChangeQRCodeTESTView, true}, #if defined(SUPPORT_GNSS) {GPSTEST, "GPSTestbutton", "GPSTest", "GPSTestbutton_next", &testView::ChangeGPSTESTView, true}, #endif @@ -120,18 +121,6 @@ namespace OHOS } } } - ///////////////////////// - if (oktestBtn) - { - delete oktestBtn; - oktestBtn = nullptr; - } - if (failtestBtn) - { - delete failtestBtn; - failtestBtn = nullptr; - } - ///////////////////////////// if (test_about_view) { delete test_about_view; // 1 @@ -216,6 +205,23 @@ namespace OHOS 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 @@ -275,11 +281,11 @@ namespace OHOS return true; } - void testView::AddResultButtons(UIScrollView *scrollView, int16_t viewId) + bool testView::AddResultButtons(UIScrollView *scrollView, int16_t viewId,UILabelButton*&oktestBtn,UILabelButton*&failtestBtn) { if (scrollView == nullptr) { - return; + return false; } printf("目前测试项id:%d",viewId); @@ -291,7 +297,7 @@ namespace OHOS if (oktestBtn == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error"); - return; // 内存分配失败,返回false + return false; // 内存分配失败,返回false } oktestBtn->SetPosition(40, 80); oktestBtn->Resize(135, 88); @@ -305,7 +311,7 @@ namespace OHOS if (failtestBtn == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButtonExt is error"); - return; // 内存分配失败,返回false + return false; // 内存分配失败,返回false } failtestBtn->SetPosition(220, 80); failtestBtn->Resize(135, 88); @@ -318,7 +324,7 @@ namespace OHOS test_status_enum status = testModel::GetInstance()->GetResult(viewId); printf("目前该项的测试状态为:%d\n",status); // 获取测试项描述 - std::string viewDesc = testModel::GetInstance()->GetViewId(viewId); + std::string viewDesc = testModel::GetInstance()->GetTestItemDescription(viewId); printf("目前测试项的描述是:%s\n",viewDesc.c_str()); if (oktestBtn) @@ -341,9 +347,10 @@ namespace OHOS // 设置按钮标识 std::string okIdStr = "TestOK" + viewDesc; - printf("设置 按键的viewId %s\n", okIdStr.c_str()); + printf("设置成功按键的viewId %s\n", okIdStr.c_str()); oktestBtn->SetViewId(okIdStr.c_str()); - oktestBtn->SetOnClickListener(testPresenter::GetInstance()); + UIView::OnClickListener *clickListener = static_cast(testPresenter::GetInstance()); + oktestBtn->SetOnClickListener(clickListener); scrollView->Add(oktestBtn); } @@ -368,11 +375,14 @@ namespace OHOS // 设置按钮标识(修复了原代码中的错误) std::string failIdStr = "TestNO" + viewDesc; - printf("设置 按键的viewId %s\n", failIdStr.c_str()); + printf("设置失败按键的viewId %s\n", failIdStr.c_str()); failtestBtn->SetViewId(failIdStr.c_str()); - failtestBtn->SetOnClickListener(testPresenter::GetInstance()); + UIView::OnClickListener *clickListener = static_cast(testPresenter::GetInstance()); + failtestBtn->SetOnClickListener(clickListener); scrollView->Add(failtestBtn); } + + return true; } /// @brief 设置按钮 @@ -483,7 +493,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_LCD_view->testLCDInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], LCD_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -501,7 +510,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_TP_view->testTPInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], TP_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -519,7 +527,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_MG_view->testmagicInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], MAGETIC_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -537,7 +544,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_lum_view->testLUMInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], LUMINANCE_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -555,7 +561,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_charging_view->testCHANINGInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], BAT_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -573,7 +578,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_speak_view->testSPEAKInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], SPK_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -591,7 +595,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_motor_view->testMOTORInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], MOTOR_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -610,7 +613,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_cat1_view->testcat1InitIView(thisView); - AddResultButtons(SystemScrollView[thisView], CAT1_TEST); group->Add(SystemScrollView[thisView]); } #endif @@ -646,7 +648,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_MP_view->testmicrophoneInitIView(thisView); - // AddResultButtons(SystemScrollView[thisView], thisView); group->Add(SystemScrollView[thisView]); } return true; @@ -664,7 +665,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_hr_view->testhrsensonInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], HR_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -682,7 +682,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_G_view->testGSENSONInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], GSENSOR_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -719,7 +718,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_BT_view->testBTInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], BT_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -737,7 +735,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_SEChip_view->SEChipInitIView(thisView); - AddResultButtons(SystemScrollView[thisView], APPI_TEST); group->Add(SystemScrollView[thisView]); } return true; @@ -747,7 +744,7 @@ namespace OHOS { if (SystemScrollView[thisView] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangePingTESTView"); test_Ping_view = new testPingView(); if (test_Ping_view == nullptr) { @@ -759,6 +756,24 @@ namespace OHOS } 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(thisView); + group->Add(SystemScrollView[thisView]); + } + return true; + } + #if defined(SUPPORT_GNSS) bool testView::ChangeGPSTESTView(int16_t thisView) { @@ -773,7 +788,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_GPS_view->testGPSInitIView((uint8_t)thisView); - AddResultButtons(SystemScrollView[thisView], GPS_TEST); group->Add(SystemScrollView[thisView]); } @@ -794,7 +808,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_pressure_view->testpressureInitIView((uint8_t)thisView); - // AddResultButtons(SystemScrollView[thisView], thisView); group->Add(SystemScrollView[thisView]); } @@ -814,7 +827,6 @@ namespace OHOS return false; } SystemScrollView[thisView] = test_A5133_view->testA5133InitIView(thisView); - // AddResultButtons(SystemScrollView[thisView], thisView); group->Add(SystemScrollView[thisView]); } return true; diff --git a/code/sdk/zhihui/UI/producttest/src/testbt.cpp b/code/sdk/zhihui/UI/producttest/src/testbt.cpp index d1ac6d990..5ff2a9294 100644 --- a/code/sdk/zhihui/UI/producttest/src/testbt.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testbt.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testcat1.cpp b/code/sdk/zhihui/UI/producttest/src/testcat1.cpp index 75f57b66c..f6cd75965 100644 --- a/code/sdk/zhihui/UI/producttest/src/testcat1.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testcat1.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testchanging.cpp b/code/sdk/zhihui/UI/producttest/src/testchanging.cpp index 21e59a1e7..b6ddea1c1 100644 --- a/code/sdk/zhihui/UI/producttest/src/testchanging.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testchanging.cpp @@ -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) { diff --git a/code/sdk/zhihui/UI/producttest/src/testgsenson.cpp b/code/sdk/zhihui/UI/producttest/src/testgsenson.cpp index 34bc4f6a1..73f92f9e2 100644 --- a/code/sdk/zhihui/UI/producttest/src/testgsenson.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testgsenson.cpp @@ -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; } diff --git a/code/sdk/zhihui/UI/producttest/src/testhrsenson.cpp b/code/sdk/zhihui/UI/producttest/src/testhrsenson.cpp index 440a6c3f2..c78b6de87 100644 --- a/code/sdk/zhihui/UI/producttest/src/testhrsenson.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testhrsenson.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testluminance.cpp b/code/sdk/zhihui/UI/producttest/src/testluminance.cpp index 898c28ab2..dc606ebfb 100644 --- a/code/sdk/zhihui/UI/producttest/src/testluminance.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testluminance.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testmagnetic.cpp b/code/sdk/zhihui/UI/producttest/src/testmagnetic.cpp index 7e6f5566d..ff47f4ae4 100644 --- a/code/sdk/zhihui/UI/producttest/src/testmagnetic.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testmagnetic.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testmicrophone.cpp b/code/sdk/zhihui/UI/producttest/src/testmicrophone.cpp index c3bb6853f..87e89221b 100644 --- a/code/sdk/zhihui/UI/producttest/src/testmicrophone.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testmicrophone.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testmotor.cpp b/code/sdk/zhihui/UI/producttest/src/testmotor.cpp index 33ccb7d57..827921286 100644 --- a/code/sdk/zhihui/UI/producttest/src/testmotor.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testmotor.cpp @@ -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); diff --git a/code/sdk/zhihui/UI/producttest/src/testspeak.cpp b/code/sdk/zhihui/UI/producttest/src/testspeak.cpp index e741868ed..9dfadbd99 100644 --- a/code/sdk/zhihui/UI/producttest/src/testspeak.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testspeak.cpp @@ -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); -- 2.17.1