From: 胡传军 <1224667075@qq.com> Date: Thu, 9 Jan 2025 13:37:00 +0000 (+0000) Subject: Merge #1615 into sdk602patch1126 from refs/changes/1615/head X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=59481aaf9afe047eb19cecee973c90017408204d;p=mirrors%2FFD230.git Merge #1615 into sdk602patch1126 from refs/changes/1615/head 增加压力计测试项(未实现) * refs/changes/1615/head: (3 commits squashed) - 增加压力计测试项(未实现) - 增加压力计测试项(未实现 ) - 增加压力计测试项(未实现 ) Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1615 --- diff --git a/code/sdk/zhihui/UI/producttest/CMakeLists.txt b/code/sdk/zhihui/UI/producttest/CMakeLists.txt index 6d6e50212..e3e73c1c0 100644 --- a/code/sdk/zhihui/UI/producttest/CMakeLists.txt +++ b/code/sdk/zhihui/UI/producttest/CMakeLists.txt @@ -26,6 +26,8 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/testModel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/testPing.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/testGPS.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/testpressure.cpp + ) set(PUBLIC_HEADER diff --git a/code/sdk/zhihui/UI/producttest/include/testPresenter.h b/code/sdk/zhihui/UI/producttest/include/testPresenter.h index f651e28fa..e1aedea50 100644 --- a/code/sdk/zhihui/UI/producttest/include/testPresenter.h +++ b/code/sdk/zhihui/UI/producttest/include/testPresenter.h @@ -49,6 +49,8 @@ namespace OHOS PingTest, GPSTEST, + // pressuretest, + PRESSURETEST, OLDTEST, DEEPSLEEP, diff --git a/code/sdk/zhihui/UI/producttest/include/testView.h b/code/sdk/zhihui/UI/producttest/include/testView.h index a24c08b22..9c0d29c98 100644 --- a/code/sdk/zhihui/UI/producttest/include/testView.h +++ b/code/sdk/zhihui/UI/producttest/include/testView.h @@ -30,6 +30,7 @@ #include "producttest/include/testSEChipTest.h" #include "producttest/include/testPing.h" #include "producttest/include/testGPS.h" +#include "producttest/include/testpressure.h" #ifdef SUPPORT_A5133_SERVICE #include "producttest/include/testA5133.h" @@ -99,6 +100,7 @@ namespace OHOS bool ChangeSEChipTESTView(int16_t thisView); bool ChangePingTESTView(int16_t thisView); bool ChangeGPSTESTView(int16_t thisView); + bool ChangepressureTestTESTView(int16_t thisView); #ifdef SUPPORT_A5133_SERVICE bool ChangeA5133TESTView(int16_t thisView); #endif @@ -141,6 +143,7 @@ namespace OHOS testSEChipView *test_SEChip_view{nullptr}; testPingView *test_Ping_view{nullptr}; testGPSView *test_GPS_view{nullptr}; + testpressureView * test_pressure_view{nullptr}; #ifdef SUPPORT_A5133_SERVICE testA5133View *test_A5133_view{nullptr}; diff --git a/code/sdk/zhihui/UI/producttest/include/testpressure.h b/code/sdk/zhihui/UI/producttest/include/testpressure.h new file mode 100644 index 000000000..a8640796f --- /dev/null +++ b/code/sdk/zhihui/UI/producttest/include/testpressure.h @@ -0,0 +1,80 @@ +#ifndef TEST_PRESSURE_VIEW_H +#define TEST_PRESSURE_VIEW_H + +#include "BaseView.h" +#include "View.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label.h" +#include "components/ui_label_ext.h" +#include "components/ui_button.h" +#include "components/ui_image_view.h" +#include "components/ui_label_button_ext.h" + +//#include "cmsis_os.h" +#include +namespace OHOS +{ + + class testpressureView + { + + public: + struct ButtonConfig_ext_t + { + int x; + int y; + int w; + int h; + const char *str; + const char *ViewId; + const char *ImageSrc; + + //label + int label_x; + int label_y; + uint8_t ALIGN; + int Fontsize; + + }; + + + + struct LabelConfig + { + int16_t left; + int16_t top; + int16_t width; + int16_t height; + int16_t fontSize; // 字体大小 + int16_t lineHeigh; // 行高 + char *text; // 文本 + uint8_t lineBreakMode; // 断行模式。 + }; + + + + + testpressureView(); + virtual ~testpressureView(); + static testpressureView *GetInstance(void); + + UIScrollView *testpressureInitIView(uint8_t); + void pressuredataTimerCallBack(void); + + void ClearAll(void); + private: + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); + UILabel *InitLabel(LabelConfig &labelConfig); + bool testpressureScrollViewcrollViewinit(uint8_t); + UIScrollView *testpressureScrollView{nullptr}; + UILabel *label_1_MSG=NULL; + UILabel *label_2_MSG{nullptr}; + UILabelButtonExt* GPSbutton[2]{nullptr}; + + UILabelButtonExt* labelButton_next = nullptr; + bool initViewStatus{false}; + UILabel *Title{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 bdba8a29d..4341286c2 100644 --- a/code/sdk/zhihui/UI/producttest/src/testGPS.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testGPS.cpp @@ -79,7 +79,7 @@ namespace OHOS GPSbutton[0]=nullptr; } - if(GPSbutton[0]) + if(GPSbutton[1]) { delete GPSbutton[1]; GPSbutton[1]=nullptr; diff --git a/code/sdk/zhihui/UI/producttest/src/testView.cpp b/code/sdk/zhihui/UI/producttest/src/testView.cpp index 346c9c2b2..bbb64bdab 100644 --- a/code/sdk/zhihui/UI/producttest/src/testView.cpp +++ b/code/sdk/zhihui/UI/producttest/src/testView.cpp @@ -47,6 +47,7 @@ namespace OHOS #if defined(SUPPORT_GNSS) {GPSTEST,"GPSTestbutton","GPSTest","GPSTestbutton_next" ,&testView::ChangeGPSTESTView,true}, #endif + {PRESSURETEST,"pressureTestbutton","pressureTest","pressureTestbutton_next" ,&testView::ChangepressureTestTESTView,true}, #ifdef AGINGTEST {OLDTEST,"oldtestbutton","aging" ,"oldtestexit",&testView::ChangeoldTESTView,true}, #endif @@ -647,6 +648,26 @@ SystemScrollView[TESTVIEW]->SetStyle(STYLE_BORDER_RADIUS, 0); return true; } + bool testView::ChangepressureTestTESTView(int16_t thisView) + { + + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView"); + test_pressure_view = new testpressureView(); + if (test_pressure_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_pressure_view->testpressureInitIView((uint8_t)thisView); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + + return true; + } + + #ifdef SUPPORT_A5133_SERVICE bool testView::ChangeA5133TESTView(int16_t thisView) @@ -835,6 +856,13 @@ SystemScrollView[TESTVIEW]->SetStyle(STYLE_BORDER_RADIUS, 0); SystemScrollView[hideView]=nullptr; break; #endif + case PRESSURETEST: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_pressure_view; + test_pressure_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + default: break; } diff --git a/code/sdk/zhihui/UI/producttest/src/testpressure.cpp b/code/sdk/zhihui/UI/producttest/src/testpressure.cpp new file mode 100644 index 000000000..950a5e1bf --- /dev/null +++ b/code/sdk/zhihui/UI/producttest/src/testpressure.cpp @@ -0,0 +1,226 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" + +#include "cmsis_os2.h" +#include "producttest/include/testView.h" +#include "producttest/include/testpressure.h" +// #include "gnss_sample.h" +#include "graphic_service.h" + +namespace OHOS +{ + + static testpressureView *g_pSystemAboutTheWatchView{nullptr}; + + testpressureView::testpressureView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testpressureView::~testpressureView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testpressureView::~testpressureView"); + ClearAll(); + //g_pSystemAboutTheWatchView = nullptr; + } + + testpressureView *testpressureView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + static osTimerId_t P_TEST_timer=NULL; + + void testpressureView::ClearAll() + { + if(testpressureScrollView) + { + testpressureScrollView->RemoveAll(); + + if (P_TEST_timer != NULL) { + osTimerStop(P_TEST_timer); + osTimerDelete(P_TEST_timer); + P_TEST_timer = NULL; + } + if(labelButton_next) + { + delete labelButton_next; + labelButton_next=nullptr; + } + if(label_1_MSG) + { + delete label_1_MSG; + label_1_MSG=nullptr; + } + + if(label_2_MSG) + { + delete label_2_MSG; + label_2_MSG=nullptr; + } + + if(Title) + { + delete Title; + Title=nullptr; + } + + delete testpressureScrollView; + testpressureScrollView=nullptr; + } + } + + UILabelButtonExt *testpressureView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig) + { + UILabelButtonExt *button = new UILabelButtonExt(); + if (button == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button new fail!"); + return nullptr; + } + button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h); + button->SetViewId(buttonconfig.ViewId); + button->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); + //button->SetStyle(STYLE_BORDER_RADIUS,0); + button->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED); + //button->SetStyleForState(STYLE_BORDER_RADIUS,0, UIButton::PRESSED); + button->SetTouchable(true); + button->SetStyle(STYLE_BACKGROUND_OPA, 0x80); + button->SetText(buttonconfig.str); + button->SetAlign(TEXT_ALIGNMENT_LEFT); + button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y ); + button->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, buttonconfig.Fontsize); + UIView:: OnClickListener *touchListener = static_cast(testPresenter::GetInstance()); + button->SetOnClickListener(touchListener); + + return button; + } + + UILabel *testpressureView::InitLabel(LabelConfig &labelConfig) + { + UILabel *label = new UILabel(); + if (label == nullptr) + { + return nullptr; + } + label->SetPosition(labelConfig.left, labelConfig.top, labelConfig.width, labelConfig.height); // 位置大小 + label->SetStyle(STYLE_TEXT_FONT, labelConfig.fontSize); // 字体大小 + label->SetStyle(STYLE_LINE_HEIGHT, labelConfig.lineHeigh); // 字体行高 + label->SetText(labelConfig.text); // 内容 + label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。 + label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME_EN, labelConfig.fontSize); + label->SetAlign(TEXT_ALIGNMENT_LEFT); + return label; + } + + + void testpressureView:: pressuredataTimerCallBack(void) + { + //此处实现数据刷新 + } + + void pressuredataTimerCallBackproc() + { + GraphicService::GetInstance()->PostGraphicEvent(std::bind(&testpressureView::pressuredataTimerCallBack,testpressureView::GetInstance())); + } + + + bool testpressureView::testpressureScrollViewcrollViewinit(uint8_t id) + { + + testpressureScrollView = new UIScrollView(); + if (testpressureScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testpressureScrollView new fail!"); + return false; + } + testpressureScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testpressureScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testpressureScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + testpressureScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + testpressureScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); + + + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testpressureScrollView->SetOnDragListener(draglistener); + + LabelConfig Config = { + .left = 50, + .top = 85, + .width = Screen::GetInstance().GetWidth()-80, + .height = 35, + .fontSize = 20, + .lineHeigh = 25, + .text = "", + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + label_1_MSG= InitLabel(Config); + if (label_1_MSG == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return false; + } + testpressureScrollView->Add(label_1_MSG); + + Config = { + .left = 50, + .top = 50, + .width = 350, + .height = 30, + .fontSize = 25, + .lineHeigh = 35, + .text = "", + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + label_2_MSG= InitLabel(Config); + if (label_2_MSG == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return false; + } + testpressureScrollView->Add(label_2_MSG); + + + + labelButton_next= testAboutView::GetInstance()->init_button_next(267,320,Test_ViewMapper_t[id].viewid_str_next); + testpressureScrollView->Add(labelButton_next); + + Title= testAboutView::GetInstance()->init_title(165,45,"PRESSURE_TEST"); + testpressureScrollView->Add(Title); + + + testpressureScrollView->SetTouchable(true); + testpressureScrollView->SetDraggable(true); + uint32_t tick; + osStatus_t retTimer; + P_TEST_timer = osTimerNew((osTimerFunc_t)pressuredataTimerCallBackproc, osTimerPeriodic, NULL, NULL); + tick =2000;// osMs2Tick(1000); + retTimer = osTimerStart(P_TEST_timer, tick); + if (retTimer != osOK && P_TEST_timer != NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); + osTimerDelete(P_TEST_timer); + P_TEST_timer = NULL; + return false; + } + return true; + } + + UIScrollView *testpressureView::testpressureInitIView(uint8_t id) + { + if (!testpressureScrollViewcrollViewinit(id)) + { + return nullptr; + } + return testpressureScrollView; + } +} + +// #endif