漏光和灰卡测试产测ui
authorhcj <1224667075@qq.com>
Wed, 20 Mar 2024 02:47:40 +0000 (10:47 +0800)
committerhcj <1224667075@qq.com>
Wed, 20 Mar 2024 02:47:40 +0000 (10:47 +0800)
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h
code/sdk/application/wearable/fd230app/nativeui/producttest/include/testhrsenson.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testhrsenson.cpp [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp

index ce419c5..3123c0a 100644 (file)
@@ -468,7 +468,8 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testmotor.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testbutton.cpp 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testmakephone.cpp  
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testcat1.cpp 
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testcat1.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testhrsenson.cpp 
 )
 if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES)
 set(SOURCES   
index 994e546..e11ce9a 100644 (file)
@@ -13,6 +13,7 @@
 #include "producttest/include/testbutton.h" \r
 #include "producttest/include/testmakephone.h"\r
 #include "producttest/include/testcat1.h" \r
+#include "producttest/include/testhrsenson.h" \r
 #include "common/key_code.h"\r
 namespace OHOS\r
 {\r
@@ -30,6 +31,7 @@ namespace OHOS
         CAT1,\r
         BUTTON,\r
         MAKEPHONE,\r
+        HRSENSON,\r
         TEST_1,\r
 \r
         MAX_TESTVIEWID,\r
index 78242fe..164ce47 100644 (file)
@@ -22,7 +22,7 @@
 #include "producttest/include/testmagnetic.h"\r
 #include "producttest/include/testmakephone.h"\r
 #include "producttest/include/testcat1.h" \r
-\r
+#include "producttest/include/testhrsenson.h" \r
 namespace OHOS\r
 {\r
     \r
@@ -77,8 +77,9 @@ namespace OHOS
         bool ChangKEYTESTView(int16_t thisView);\r
         bool ChangeMGTESTView(int16_t thisView);\r
         bool ChangeMPTESTView(int16_t thisView);\r
+        bool ChangeHRTESTView(int16_t thisView);\r
+        bool ChangeCAT1TESTView(int16_t thisView);\r
 \r
-         bool ChangeCAT1TESTView(int16_t thisView);\r
         bool ClickFunc(int16_t interface);\r
         void ChangeView(int16_t hideView, int16_t showView);\r
         UIScrollView *GetSystemScrollView(int ViewId);\r
@@ -110,6 +111,7 @@ namespace OHOS
         testcat1View *test_cat1_view{nullptr};\r
         testbuttonView *test_KEY_view{nullptr};\r
         testMagicView *test_MG_view{nullptr};\r
+        testhrsenson1View *test_hr_view{nullptr};\r
 \r
         testmakephoneView *test_MP_view{nullptr};\r
 \r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testhrsenson.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testhrsenson.h
new file mode 100644 (file)
index 0000000..0e7cb67
--- /dev/null
@@ -0,0 +1,95 @@
+#ifndef TEST_HRSENSON_VIEW_H
+#define TEST_HRSENSON_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label.h"
+#include "components/ui_button.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_button_ext.h"
+
+//#include "cmsis_os.h"
+#include <iostream>
+namespace OHOS
+{
+        
+    class testhrsenson1View
+    {
+
+    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; // 断行模式。
+        };
+
+
+        struct cat1_msg
+        {
+            char * imei;
+            int sim;
+            char * oper;
+            uint8_t signal;
+        };
+
+        struct cat1_Ver
+        {
+            char * modem_version;  
+            char * cat1appver;
+        };
+
+
+       
+        
+        testhrsenson1View();
+        virtual ~testhrsenson1View();
+        static testhrsenson1View *GetInstance(void);
+        void gray_test(bool);
+        void leeklight_test(bool);
+        UIScrollView *testhrsensonInitIView(void);
+        void ClearAll(void);
+        void setgrayvalue(int,int,int);
+        void setlightvalue(int g,int r,int ir);
+    private:
+        UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener);
+        UILabel *InitLabel(LabelConfig &labelConfig);
+        bool tesScat1ScrollViewcrollViewinit(void);
+        UIScrollView *testhrsensonScrollView{nullptr};
+        UILabel *label_1_cat1msg_1=NULL;
+        // UILabel *label_1_cat1msg_oper{nullptr};
+        // UILabel *label_1_cat1msg_sim{nullptr};
+        // UILabel *label_1_cat1msg_signal{nullptr}; 
+        UILabelButtonExt* button_1{NULL};
+        UILabelButtonExt* button_2{NULL};
+        UILabel *label_hrsenson_value_vison{nullptr};
+        bool initViewStatus{false};
+    };
+}
+#endif
\ No newline at end of file
index b69ead3..c98ba2c 100644 (file)
@@ -46,7 +46,7 @@ namespace OHOS
         {CAT1,"cat1button",true},\r
         {BUTTON,"buttonbutton",true},\r
         {MAKEPHONE,"makephonebutton",true},\r
-\r
+        {HRSENSON,"hrsensonbutton",true},\r
         };\r
         // {FACTORYRESETVIEW,"FactoryResetButton",true},\r
         // {SYSTEMLUPGRADE,"systemupgread",true},\r
@@ -201,9 +201,20 @@ namespace OHOS
         if(strcmp(view.GetViewId(),"dial_112") == 0)\r
         { \r
             testcat1View::GetInstance()->dial_112(true);\r
+        } \r
+\r
+        if(strcmp(view.GetViewId(),"gray_card") == 0)\r
+        { \r
+\r
+            testhrsenson1View::GetInstance()->gray_test(true);\r
         }\r
-       \r
 \r
+        \r
+        if(strcmp(view.GetViewId(),"leeklight") == 0)\r
+        { \r
+\r
+            testhrsenson1View::GetInstance()->leeklight_test(true);\r
+        }\r
 \r
         return false;\r
     }\r
index adcd719..996d907 100644 (file)
@@ -30,6 +30,7 @@ namespace OHOS
         {CAT1,"cat1button","CAT1", &testView::ChangeCAT1TESTView},\r
         {BUTTON,"buttonbutton","button" ,&testView::ChangKEYTESTView},\r
         {MAKEPHONE,"makephonebutton","makephone" ,&testView::ChangeMPTESTView},\r
+        {HRSENSON,"hrsensonbutton","hrsenson" ,&testView::ChangeHRTESTView},\r
         // {FACTORYRESETVIEW,"FactoryResetButton","恢复出厂", &testView::ChangeSystemAboutView},\r
         // {SYSTEMLUPGRADE,"systemupgread","系统升级",&testView::ChangeSystemAboutView},\r
         // {TEST,"testButton","测试模式", &testView::ChangeSystemAboutView},\r
@@ -415,6 +416,23 @@ namespace OHOS
         return true;\r
     }\r
 \r
+    bool testView::ChangeHRTESTView(int16_t thisView)\r
+    {\r
+        if (SystemScrollView[thisView] == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+            test_hr_view = new testhrsenson1View();\r
+            if (test_hr_view == nullptr)\r
+            {\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+                return false;\r
+            }\r
+            SystemScrollView[thisView] = test_hr_view->testhrsensonInitIView();\r
+            RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+        }\r
+        return true;\r
+    }\r
+\r
     UIScrollView *testView::GetSystemScrollView(int ViewId)\r
     {\r
         if (SystemScrollView[ViewId] == nullptr)\r
index b333afd..cf0253a 100644 (file)
@@ -99,12 +99,12 @@ namespace OHOS
 
     static UILabelButtonExt* button{NULL};
    
-    
+    char *phone="112";
     void testcat1View::dial_112(bool falg)
     {
         if(button!=NULL)
         {
-            calldial_event_sendmsg_toUI("112");
+            calldial_event_sendmsg_toUI(phone);
             RootView::GetInstance()->Invalidate();
            
         }
diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testhrsenson.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testhrsenson.cpp
new file mode 100644 (file)
index 0000000..ddd6366
--- /dev/null
@@ -0,0 +1,257 @@
+#include "wearable_log.h"
+#include "custom_utils.h"
+#include "producttest/include/testPresenter.h"
+#include "producttest/include/testhrsenson.h" 
+#include "AlarmClockModel.h"
+#include "cmsis_os2.h"
+#include "cat1_server.h"
+#include "cat1_ctl.h"
+#include "cat1_server_hal.h"
+#include "ppg_service.h"
+namespace OHOS
+{
+
+    static testhrsenson1View *g_pSystemAboutTheWatchView{nullptr};
+
+    testhrsenson1View::testhrsenson1View()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView");
+        g_pSystemAboutTheWatchView = this;
+    }
+
+    testhrsenson1View::~testhrsenson1View()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView");
+        ClearAll();
+        g_pSystemAboutTheWatchView = nullptr;
+    }
+
+    testhrsenson1View *testhrsenson1View::GetInstance()
+    {
+
+        return g_pSystemAboutTheWatchView;
+    }
+
+    void testhrsenson1View::ClearAll()
+    {
+        if (initViewStatus == true)
+        {
+        }
+    }
+    static bool button_falg=true;
+    void testhrsenson1View:: setgrayvalue(int g,int r,int ir)
+    {
+        
+        if(label_hrsenson_value_vison!=NULL)
+        {
+
+            char buf[124]={0};
+            sprintf(buf,"gray:\n green:%d\nred:%d\nir:%d",g,r,ir);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf);
+            label_hrsenson_value_vison->SetText(buf);
+            RootView::GetInstance()->Invalidate();
+            int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST;
+            send_ppg_cmd_msg(md);
+            button_falg=true;
+        }
+        
+    }
+    void testhrsenson1View:: setlightvalue(int g,int r,int ir)
+    {
+        
+        if(label_hrsenson_value_vison!=nullptr)
+        {
+            char buf[124]={0};
+            sprintf(buf,"leaklight:\ngreen:%d\nred:%d\nir:%d",g,r,ir);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf);
+            label_hrsenson_value_vison->SetText(buf);
+            RootView::GetInstance()->Invalidate();
+            int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST;
+            send_ppg_cmd_msg(md);
+             button_falg=true;
+        }
+        
+    }
+
+    UILabelButtonExt *testhrsenson1View::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->SetText(buttonconfig.str);
+        button->SetAlign(TEXT_ALIGNMENT_LEFT);
+        button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y );
+        button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize);
+        UIView:: OnClickListener *touchListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());
+        button->SetOnClickListener(touchListener);
+
+        // UIView::OnDragListener *drgListener = static_cast<UIView::OnDragListener *>(testPresenter::GetInstance());
+        // button->SetOnDragListener(drgListener);
+
+        // button->SetDraggable(false);
+        return button;
+    }
+    static bool speakfalg=false;
+   
+
+
+    void testhrsenson1View::gray_test(bool falg)
+    {
+        if(button_1!=NULL)
+        {
+            int8_t md = PPG_SERVICE_CMD_TYPE_DO_GRAYCARD_TEST;
+            send_ppg_cmd_msg(md);
+            button_falg=false;
+        }  
+    }
+
+    void testhrsenson1View::leeklight_test(bool falg)
+    {
+        if(button_2!=NULL)
+        {
+            int8_t md = PPG_SERVICE_CMD_TYPE_DO_LEAKLIGHT_TEST;
+            send_ppg_cmd_msg(md);
+             button_falg=false;
+        }  
+    }
+
+     UILabel *testhrsenson1View::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, labelConfig.fontSize);
+        label->SetAlign(TEXT_ALIGNMENT_LEFT);
+        return label;
+    }
+
+
+
+
+    
+    bool testhrsenson1View::tesScat1ScrollViewcrollViewinit(void)
+    {
+
+        testhrsensonScrollView = new UIScrollView();
+        if (testhrsensonScrollView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testhrsensonScrollView new fail!");
+            return false;
+        }
+        testhrsensonScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        testhrsensonScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        testhrsensonScrollView->SetStyle(STYLE_BORDER_RADIUS, 0);
+        testhrsensonScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+        testhrsensonScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue);
+
+        LabelConfig  Config = {
+            .left = 50,
+            .top = 70,
+            .width = 60,
+            .height = 35,
+            .fontSize = 30,
+            .lineHeigh = 35,
+            .text = "green:\nred:\nir:",
+            .lineBreakMode = UILabel::LINE_BREAK_ADAPT,
+        };
+        label_hrsenson_value_vison= InitLabel(Config);
+        if (label_hrsenson_value_vison == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!");
+            return false;
+        }
+        testhrsensonScrollView->Add(label_hrsenson_value_vison);
+
+
+
+
+        // uapi_cat1_power_on(1);
+        // uapi_cat1_reset(0);
+
+        // cat1_getsignal();
+        // cat1_getver();
+        /* -------------------------------------------------------------------------- */
+        ButtonConfig_ext_t buttonconfig;
+        buttonconfig.x = 100;
+        buttonconfig.y = 300;
+        buttonconfig.w = 180;
+        buttonconfig.h = 116;
+        buttonconfig.label_x=40;
+        buttonconfig.label_y=0;
+        buttonconfig.Fontsize=30;
+        buttonconfig.ViewId="gray_card";
+        buttonconfig.str="gray_card";
+        buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;
+        button_1=SetTheButton_ext(buttonconfig);
+        testhrsensonScrollView->Add(button_1);
+
+
+
+        buttonconfig.x = 300;
+        buttonconfig.ViewId="leeklight";
+        buttonconfig.str="light";
+        button_2=SetTheButton_ext(buttonconfig);
+        testhrsensonScrollView->Add(button_2);
+
+        // buttonconfig.x = 100;
+        // buttonconfig.y = 300;
+        // buttonconfig.w = 200;
+        // buttonconfig.h = 116;
+        // buttonconfig.label_x=40;
+        // buttonconfig.label_y=0;
+        // buttonconfig.Fontsize=30; 
+        // buttonconfig.ViewId="DOWN_KEY";
+        // buttonconfig.str="DOWN_KEY";
+        // buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;
+        // button[1]=SetTheButton_ext(buttonconfig);
+        // testhrsensonScrollView->Add(button[1]);
+        
+        // UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(testPresenter::GetInstance());
+        // if (draglistener == nullptr)
+        // {
+        //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");
+        //     return false;
+        // }
+        // testhrsensonScrollView->SetOnDragListener(draglistener);
+
+        
+
+
+
+        testhrsensonScrollView->SetTouchable(true);
+        testhrsensonScrollView->SetDraggable(false);
+
+        int8_t md = PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST;
+        send_ppg_cmd_msg(md); 
+
+        return true;
+    }
+
+    UIScrollView *testhrsenson1View::testhrsensonInitIView()
+    {
+        if (!tesScat1ScrollViewcrollViewinit())
+        {
+            return nullptr;
+        }
+        return testhrsensonScrollView;
+    }
+}
\ No newline at end of file
index ba31535..642c0a7 100755 (executable)
@@ -35,6 +35,7 @@
 #include "cat1_server.h"
 #include "testchanging.h"
 #include "testcat1.h" 
+#include "testhrsenson.h" 
 namespace OHOS {
 
 #ifdef __cplusplus
@@ -246,12 +247,51 @@ void MsgCenterNotifyCardhProc(const Topic topic, Request* req)
 {
     unused(topic);
     unused(req);
+    //req->data;
+    //green,red,ir
+    int green,red,ir;
+    char* str= (char *)req->data;
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",str);
+    char *tokbuf=NULL;
+    tokbuf=strtok(str,",");
+    green=atoi(tokbuf);
+    tokbuf=strtok(NULL,",");
+    red=atoi(tokbuf);   
+    tokbuf=strtok(NULL,"\0");
+    ir=atoi(tokbuf);
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d,%d,%d",green,red,ir);
+
+    testhrsenson1View * t= testhrsenson1View::GetInstance();
+    if(t!=NULL)
+    {
+        t->setgrayvalue(green,red,ir);
+    }
+
 }
 
 void MsgCenterNotifyleaklighthProc(const Topic topic, Request* req)
 {
     unused(topic);
     unused(req);
+    //req->data;
+    //green,red,ir
+    int green,red,ir;
+    char* str= (char *)req->data;
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",str);
+    char *tokbuf=NULL;
+    tokbuf=strtok(str,",");
+    green=atoi(tokbuf);
+    tokbuf=strtok(NULL,",");
+    red=atoi(tokbuf);   
+    tokbuf=strtok(NULL,"\0");
+    ir=atoi(tokbuf);
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d,%d,%d",green,red,ir);
+
+    testhrsenson1View * t= testhrsenson1View::GetInstance();
+    if(t!=NULL)
+    {
+        t->setlightvalue(green,red,ir);
+    }
 }
 
 //穿戴状态