--- /dev/null
+#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 <iostream>
+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
#if defined(SUPPORT_GNSS)\r
{GPSTEST,"GPSTestbutton","GPSTest","GPSTestbutton_next" ,&testView::ChangeGPSTESTView,true},\r
#endif\r
+ {PRESSURETEST,"pressureTestbutton","pressureTest","pressureTestbutton_next" ,&testView::ChangepressureTestTESTView,true},\r
#ifdef AGINGTEST\r
{OLDTEST,"oldtestbutton","aging" ,"oldtestexit",&testView::ChangeoldTESTView,true},\r
#endif\r
return true;\r
}\r
\r
+ bool testView::ChangepressureTestTESTView(int16_t thisView)\r
+ {\r
+\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");\r
+ test_pressure_view = new testpressureView();\r
+ if (test_pressure_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_pressure_view->testpressureInitIView((uint8_t)thisView);\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+\r
+ return true;\r
+ }\r
+\r
+\r
\r
#ifdef SUPPORT_A5133_SERVICE\r
bool testView::ChangeA5133TESTView(int16_t thisView)\r
SystemScrollView[hideView]=nullptr;\r
break;\r
#endif\r
+ case PRESSURETEST:\r
+ RootView::GetInstance()->Remove(SystemScrollView[hideView]);\r
+ delete test_pressure_view; \r
+ test_pressure_view = nullptr;\r
+ SystemScrollView[hideView]=nullptr;\r
+ break;\r
+\r
default:\r
break;\r
}\r
--- /dev/null
+#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<UIView::OnClickListener *>(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<UIView::OnDragListener *>(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