优化老化测试结构
authorhcj <1224667075@qq.com>
Tue, 2 Apr 2024 08:55:22 +0000 (16:55 +0800)
committerhcj <1224667075@qq.com>
Tue, 2 Apr 2024 08:55:22 +0000 (16:55 +0800)
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testold.h
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testold.cpp

index d234ca4..6ceb400 100644 (file)
@@ -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
index 3927316..bf8a389 100644 (file)
@@ -669,12 +669,12 @@ namespace OHOS
                 test_G_view = nullptr;\r
                 SystemScrollView[hideView]=nullptr;\r
             break;\r
-            // case OLDTEST:\r
-            //     RootView::GetInstance()->Remove(SystemScrollView[hideView]);\r
-            //     delete test_old_view;  \r
-            //     test_old_view = nullptr;\r
-            //     SystemScrollView[hideView]=nullptr;\r
-            //     break;\r
+            case OLDTEST:\r
+                RootView::GetInstance()->Remove(SystemScrollView[hideView]);\r
+                delete test_old_view;  \r
+                test_old_view = nullptr;\r
+                SystemScrollView[hideView]=nullptr;\r
+                break;\r
            default:\r
             break;\r
            }\r
index 9f1f029..679706e 100644 (file)
@@ -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()
index 22edd87..f5de4b2 100644 (file)
 //#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<UIView::OnDragListener *>(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,