From: hcj <1224667075@qq.com> Date: Tue, 2 Apr 2024 08:55:22 +0000 (+0800) Subject: 优化老化测试结构 X-Git-Tag: release_V1.2.70_20241020_135402~1233^2~2^2~1 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=ad2d0f09f051c977f8d656848b06a660e1e9e13d;p=mirrors%2FFD230.git 优化老化测试结构 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h index d234ca4ef..6ceb40064 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h @@ -35,20 +35,13 @@ namespace OHOS UIScrollView *testoldInitIView(void); void ClearAll(void); + void setbuf(char *buf); void set_data(); - UILabel *x{nullptr}; + void setlightvalue(int ,int ,int); private: bool testoldScrollViewcrollViewinit(void); UILabel *InitLabel(LabelConfig &labelConfig); - UIScrollView *testoldScrollView{nullptr}; - bool initViewStatus{false}; - UILabel *title{nullptr}; - // UILabel *x{nullptr}; - UILabel *y{nullptr}; - UILabel *z{nullptr}; - - UILabelButtonExt* labelButton_next = nullptr; }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp index 3927316ef..bf8a38974 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp @@ -669,12 +669,12 @@ namespace OHOS test_G_view = nullptr; SystemScrollView[hideView]=nullptr; break; - // case OLDTEST: - // RootView::GetInstance()->Remove(SystemScrollView[hideView]); - // delete test_old_view; - // test_old_view = nullptr; - // SystemScrollView[hideView]=nullptr; - // break; + case OLDTEST: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_old_view; + test_old_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; default: break; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp index 9f1f029b9..679706ed2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp @@ -5,12 +5,12 @@ namespace OHOS { - static testAboutView *g_pSystemAboutTheWatchView{nullptr}; + static testAboutView g_pSystemAboutTheWatchView; testAboutView::testAboutView() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); - g_pSystemAboutTheWatchView = this; + //g_pSystemAboutTheWatchView = this; } testAboutView::~testAboutView() @@ -23,7 +23,7 @@ namespace OHOS testAboutView *testAboutView::GetInstance() { - return g_pSystemAboutTheWatchView; + return &g_pSystemAboutTheWatchView; } void testAboutView::ClearAll() diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp index 22edd87ab..f5de4b2fb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp @@ -13,10 +13,19 @@ //#include "acc_service.h" namespace OHOS { + static UILabel *x{nullptr}; static uint8 AGING_task_falg=0; + UIScrollView *testoldScrollView{nullptr}; + bool initViewStatus{false}; + UILabel *title{nullptr}; + // UILabel *x{nullptr}; + UILabel *y{nullptr}; + UILabel *z{nullptr}; + UILabelButtonExt* labelButton_next = nullptr; + static void AGING_task(void *arg) { - while (AGING_task_falg==1) + while (AGING_task_falg) { msleep(1000); // uapi_tcxo_delay_ms(3000); @@ -32,9 +41,9 @@ namespace OHOS uint16_t angle_value= (int16_t)mag_service_get_fAzimuth(); char buf[16]={0}; sprintf(buf,"angle:%d",angle_value); - if( testoldView::GetInstance()->x && AGING_task_falg) + if( AGING_task_falg && testoldView::GetInstance()) { - testoldView::GetInstance()->x->SetText(buf); + testoldView::GetInstance()->setbuf(buf); RootView::GetInstance()->Invalidate(); msleep(1000); } @@ -52,9 +61,9 @@ namespace OHOS uint16 y_t=t.y; uint16 z_t=t.z; sprintf(buf,"gsensor:\nX:%d\nY:%d\nZ:%d",x_t,y_t,z_t); - if(testoldView::GetInstance()->x && AGING_task_falg) + if(AGING_task_falg && testoldView::GetInstance()) { - testoldView::GetInstance()->x->SetText(buf); + testoldView::GetInstance()->setbuf(buf); RootView::GetInstance()->Invalidate(); msleep(1000); } @@ -90,7 +99,7 @@ namespace OHOS return ERRCODE_SUCC; } - static testoldView *g_pSystemAboutTheWatchView{nullptr}; + void testoldView:: setlightvalue(int g,int r,int ir) { @@ -109,13 +118,12 @@ namespace OHOS int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST; send_ppg_cmd_msg(md); } - } testoldView::testoldView() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); - g_pSystemAboutTheWatchView = this; + } testoldView::~testoldView() @@ -126,8 +134,9 @@ namespace OHOS testoldView *testoldView::GetInstance() { - - return g_pSystemAboutTheWatchView; + static testoldView g_testoldView; + + return &g_testoldView; } void testoldView::ClearAll() { @@ -152,8 +161,12 @@ namespace OHOS delete testoldScrollView; testoldScrollView=nullptr; } - g_pSystemAboutTheWatchView=nullptr; } + void testoldView::setbuf(char *buf) + { + if(x) + x->SetText(buf); + } UILabel *testoldView::InitLabel(LabelConfig &labelConfig) @@ -198,16 +211,10 @@ namespace OHOS testoldScrollView->SetReboundSize(0); testoldScrollView->SetDirection(1); } - //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); - // if (draglistener == nullptr) - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); - // return false; - // } - // testoldScrollView->SetOnDragListener(draglistener); + LabelConfig Config = { - .left = 203, + .left = 142, .top = 52, .width = 60, .height = 35,