${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testSEChipTest.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testModel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testPing.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testGPS.cpp
+
#每日目标
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalmodel.cpp
--- /dev/null
+#ifndef TEST_GPS__VIEW_H
+#define TEST_GPS__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
+{
+ #define GPS_CLOSE_CANCEL_BUTTON "gps_close"
+ #define GPS_OPEN_CONFIRM_BUTTON "gps_open"
+
+ class testGPSView
+ {
+
+ 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; // 断行模式。
+ };
+
+
+
+
+ testGPSView();
+ virtual ~testGPSView();
+ static testGPSView *GetInstance(void);
+
+ UIScrollView *testGPSInitIView(uint8_t);
+ void gpsdataTimerCallBack(void);
+
+ void ClearAll(void);
+ private:
+ UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener);
+ UILabel *InitLabel(LabelConfig &labelConfig);
+ bool testGPSScrollViewcrollViewinit(uint8_t);
+ UIScrollView *testGPSScrollView{nullptr};
+ UILabel *label_1_GPS_MSG=NULL;
+ UILabel *label_1_GPS_on_or_off{nullptr};
+ UILabelButtonExt* GPSbutton[2]{nullptr};
+
+ UILabelButtonExt* labelButton_next = nullptr;
+ bool initViewStatus{false};
+ UILabel *Title{nullptr}; // 标题
+
+ };
+}
+#endif
\ No newline at end of file
CHAR,\r
SPEAK,\r
MOTOR,\r
+#ifdef SUPPORT_CAT1_MODEM\r
CAT1,\r
+#endif\r
BUTTON,\r
MICROPHONE,\r
HRSENSON,\r
BTTEST,\r
SEChipTest,\r
PingTest,\r
+\r
+ GPSTEST,\r
OLDTEST,\r
DEEPSLEEP,\r
\r
#include "producttest/include/testbt.h"\r
#include "producttest/include/testSEChipTest.h"\r
#include "producttest/include/testPing.h"\r
+#include "producttest/include/testGPS.h"\r
+\r
#ifdef SUPPORT_A5133_SERVICE\r
#include "producttest/include/testA5133.h"\r
#endif\r
bool ChangeBTTESTView(int16_t thisView);\r
bool ChangeSEChipTESTView(int16_t thisView);\r
bool ChangePingTESTView(int16_t thisView);\r
+ bool ChangeGPSTESTView(int16_t thisView);\r
#ifdef SUPPORT_A5133_SERVICE\r
bool ChangeA5133TESTView(int16_t thisView);\r
#endif\r
testCHANINGView *test_charging_view{nullptr};\r
testSPEAKView *test_speak_view{nullptr};\r
testMOTORView *test_motor_view{nullptr};\r
- testcat1View *test_cat1_view{nullptr};\r
+ #ifdef SUPPORT_CAT1_MODEM\r
+ testcat1View *test_cat1_view{nullptr};\r
+ #endif\r
testbuttonView *test_KEY_view{nullptr};\r
testMagicView *test_MG_view{nullptr};\r
testhrsenson1View *test_hr_view{nullptr};\r
\r
testSEChipView *test_SEChip_view{nullptr};\r
testPingView *test_Ping_view{nullptr};\r
+ testGPSView *test_GPS_view{nullptr};\r
\r
#ifdef SUPPORT_A5133_SERVICE\r
testA5133View *test_A5133_view{nullptr};\r
--- /dev/null
+#include "wearable_log.h"
+#include "custom_utils.h"
+#include "producttest/include/testPresenter.h"
+// #include "producttest/include/testcat1.h"
+#include "AlarmClockModel.h"
+#include "cmsis_os2.h"
+#include "NMEA0183.h"
+// code/sdk/zhihui/services/gnss/inc/.h
+
+#include "producttest/include/testView.h"
+#include "producttest/include/testGPS.h"
+#include "gnss_sample.h"
+#include "graphic_service.h"
+namespace OHOS
+{
+
+ static testGPSView *g_pSystemAboutTheWatchView{nullptr};
+
+ testGPSView::testGPSView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView");
+ g_pSystemAboutTheWatchView = this;
+ }
+
+ testGPSView::~testGPSView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testGPSView::~testGPSView");
+ ClearAll();
+ //g_pSystemAboutTheWatchView = nullptr;
+ }
+
+ testGPSView *testGPSView::GetInstance()
+ {
+
+ return g_pSystemAboutTheWatchView;
+ }
+ static osTimerId_t GPS_TEST_timer=NULL;
+
+ void testGPSView::ClearAll()
+ {
+ if(testGPSScrollView)
+ {
+ testGPSScrollView->RemoveAll();
+
+ if (GPS_TEST_timer != NULL) {
+ osTimerStop(GPS_TEST_timer);
+ osTimerDelete(GPS_TEST_timer);
+ GPS_TEST_timer = NULL;
+ }
+ if(labelButton_next)
+ {
+ delete labelButton_next;
+ labelButton_next=nullptr;
+ }
+ if(label_1_GPS_MSG)
+ {
+ delete label_1_GPS_MSG;
+ label_1_GPS_MSG=nullptr;
+ }
+
+ if(label_1_GPS_on_or_off)
+ {
+ delete label_1_GPS_on_or_off;
+ label_1_GPS_on_or_off=nullptr;
+ }
+
+ if(Title)
+ {
+ delete Title;
+ Title=nullptr;
+ }
+
+ if(GPSbutton[0])
+ {
+ delete GPSbutton[0];
+ GPSbutton[0]=nullptr;
+ }
+
+ if(GPSbutton[0])
+ {
+ delete GPSbutton[1];
+ GPSbutton[1]=nullptr;
+ }
+
+
+
+ delete testGPSScrollView;
+ testGPSScrollView=nullptr;
+ }
+ }
+
+ UILabelButtonExt *testGPSView::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 *testGPSView::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;
+ }
+
+ static char msgtmp[1024]={0};
+
+ void testGPSView:: gpsdataTimerCallBack(void)
+ {
+ if (label_1_GPS_MSG != nullptr) {
+
+ gps_data_t * gpsdata=getGPSGlobaldata();
+ gps_data_t gpsd={0};
+ if (gpsdata->last_gps_time_ms>0)
+ {
+ memcpy(&gpsd,gpsdata,sizeof(gps_data_t));
+ }
+ memset_s(msgtmp,sizeof(msgtmp),0,sizeof(msgtmp));
+ dump_location_data_to_buf(&gpsd,msgtmp,sizeof(msgtmp));
+ label_1_GPS_MSG->SetText(msgtmp);
+
+ if (getGnssServerStat()==1)
+ {
+ label_1_GPS_on_or_off->SetText("GPS已开启");
+ }else{
+ label_1_GPS_on_or_off->SetText("GPS已关闭");
+ }
+ }
+ }
+
+ void gpsdataTimerCallBackproc()
+ {
+ GraphicService::GetInstance()->PostGraphicEvent(std::bind(&testGPSView::gpsdataTimerCallBack,testGPSView::GetInstance()));
+ }
+
+
+ bool testGPSView::testGPSScrollViewcrollViewinit(uint8_t id)
+ {
+
+ testGPSScrollView = new UIScrollView();
+ if (testGPSScrollView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testGPSScrollView new fail!");
+ return false;
+ }
+ testGPSScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ testGPSScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ testGPSScrollView->SetStyle(STYLE_BORDER_RADIUS, 0);
+ testGPSScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ testGPSScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue);
+
+ LabelConfig Config = {
+ .left = 50,
+ .top = 70,
+ .width = 60,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .text = "",
+ .lineBreakMode = UILabel::LINE_BREAK_ADAPT,
+ };
+ label_1_GPS_MSG= InitLabel(Config);
+ if (label_1_GPS_MSG == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!");
+ return false;
+ }
+ testGPSScrollView->Add(label_1_GPS_MSG);
+
+ Config = {
+ .left = 50,
+ .top = 320,
+ .width = 350,
+ .height = 35,
+ .fontSize = 30,
+ .lineHeigh = 35,
+ .text = "",
+ .lineBreakMode = UILabel::LINE_BREAK_WRAP,
+ };
+ label_1_GPS_on_or_off= InitLabel(Config);
+ if (label_1_GPS_on_or_off == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!");
+ return false;
+ }
+ testGPSScrollView->Add(label_1_GPS_on_or_off);
+
+
+ ButtonConfig_ext_t buttonconfig;
+ buttonconfig.x = 20;
+ buttonconfig.y = 380;
+ buttonconfig.w = 180;
+ buttonconfig.h = 96;
+ buttonconfig.label_x=40;
+ buttonconfig.label_y=0;
+ buttonconfig.Fontsize=30;
+ buttonconfig.ViewId=GPS_OPEN_CONFIRM_BUTTON;
+ buttonconfig.str=GPS_OPEN_CONFIRM_BUTTON;
+ buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;
+ GPSbutton[0]=SetTheButton_ext(buttonconfig);
+ testGPSScrollView->Add( GPSbutton[0]);
+ //testcat1ScrollView->Add(button);
+
+ buttonconfig.x = 220;
+ buttonconfig.y = 380;
+ buttonconfig.w = 180;
+ buttonconfig.h = 96;
+ buttonconfig.label_x=40;
+ buttonconfig.label_y=0;
+ buttonconfig.Fontsize=30;
+ buttonconfig.ViewId=GPS_CLOSE_CANCEL_BUTTON;
+ buttonconfig.str=GPS_CLOSE_CANCEL_BUTTON;
+ buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;
+ GPSbutton[1]=SetTheButton_ext(buttonconfig);
+ testGPSScrollView->Add( GPSbutton[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;
+ }
+ testGPSScrollView->SetOnDragListener(draglistener);
+
+
+ labelButton_next= testAboutView::GetInstance()->init_button_next(267,320,Test_ViewMapper_t[id].viewid_str_next);
+ testGPSScrollView->Add(labelButton_next);
+
+ Title= testAboutView::GetInstance()->init_title(165,45,"GPS_TEST");
+ testGPSScrollView->Add(Title);
+
+
+ testGPSScrollView->SetTouchable(true);
+ testGPSScrollView->SetDraggable(true);
+ uint32_t tick;
+ osStatus_t retTimer;
+ GPS_TEST_timer = osTimerNew((osTimerFunc_t)gpsdataTimerCallBackproc, osTimerPeriodic, NULL, NULL);
+ tick =2000;// osMs2Tick(1000);
+ retTimer = osTimerStart(GPS_TEST_timer, tick);
+ if (retTimer != osOK && GPS_TEST_timer != NULL) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
+ osTimerDelete(GPS_TEST_timer);
+ GPS_TEST_timer = NULL;
+ return false;
+ }
+ return true;
+ }
+
+ UIScrollView *testGPSView::testGPSInitIView(uint8_t id)
+ {
+ if (!testGPSScrollViewcrollViewinit(id))
+ {
+ return nullptr;
+ }
+ return testGPSScrollView;
+ }
+}
+
#include "cywee_service.h"\r
#include "factorytest_protocol.h"\r
#include "custom_runtime.h"\r
+#include "gnss_ctl.h"\r
\r
namespace OHOS\r
{\r
\r
testA5133View::GetInstance()->a5133_receive_callback();\r
}\r
+\r
+ \r
+\r
+\r
#endif\r
+ if (strcmp(view.GetViewId(), GPS_OPEN_CONFIRM_BUTTON) == 0)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GPS On OnClick");\r
+ gnss_start();\r
+ \r
+ }\r
+\r
+\r
+ if (strcmp(view.GetViewId(), GPS_CLOSE_CANCEL_BUTTON) == 0)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GPS On OnClick");\r
+ gnss_stop();\r
+ }\r
+\r
return false;\r
}\r
\r
#include "cat1_ctl.h"\r
#include "cat1_server_hal.h"\r
#endif\r
+\r
#include "custom_utils.h"\r
#include "custom_runtime.h"\r
namespace OHOS\r
{LUMINANCE,"luminanceButton","luminance","luminanceButton_next", &testView::ChangLUMTESTView,true},\r
{CHAR,"chargingButton","bat&charger","chargingButton_next",&testView::ChangchargingTESTView,true},\r
{SPEAK,"speakButton","speak","speakButton_next" ,&testView::ChangspeakTESTView,true},\r
+\r
{MOTOR,"motorButton","motor","motorButton_next" ,&testView::ChangmotorTESTView,true},\r
+ #ifdef SUPPORT_CAT1_MODEM\r
{CAT1,"cat1button","CAT1", "cat1button_next",&testView::ChangeCAT1TESTView,true},\r
+ #endif\r
{BUTTON,"buttonbutton","button" ,"buttonbutton_next",&testView::ChangKEYTESTView,true},\r
{MICROPHONE,"microphonebutton","microphone", "microphonebutton_next",&testView::ChangeMPTESTView,true},\r
{HRSENSON,"hrsensonbutton","hrsensor", "hrsensonbutton_next",&testView::ChangeHRTESTView,true},\r
{BTTEST,"BTbutton","BT" ,"BTbutton_next",&testView::ChangeBTTESTView,true},\r
{SEChipTest,"SEChipTestbutton","SEChipTest","SEChipTestbutton_next" ,&testView::ChangeSEChipTESTView,true},\r
{PingTest,"PingTestbutton","PingTest","PingTestbutton_next" ,&testView::ChangePingTESTView,true},\r
+\r
+ {GPSTEST,"GPSTestbutton","GPSTest","GPSTestbutton_next" ,&testView::ChangeGPSTESTView,true},\r
+\r
{OLDTEST,"oldtestbutton","aging" ,"oldtestexit",&testView::ChangeoldTESTView,true},\r
{DEEPSLEEP,"deepsleep","DeepSleepCurrent","xxxxxxxxx" ,&testView::ChangeoldTESTView,true},\r
{shutdown,"shutdown","shutdown", "xxxxxxxxx",&testView::ChangeoldTESTView,true},\r
#ifdef SUPPORT_A5133_SERVICE\r
{RF5133,"RF5133","RF5133", "xxxxxxxxx",&testView::ChangeA5133TESTView,true},\r
#endif\r
- // {SYSTEMLUPGRADE,"systemupgread","系统升级",&testView::ChangeSystemAboutView},\r
- // {TEST,"testButton","测试模式", &testView::ChangeSystemAboutView},\r
- \r
- // {ABOUTTHEWATCHVIEW, &SystemView::ChangeSystemAboutView},\r
- // {SUPERVISEVIEW, &SystemView::ChangeSystemSuperviseView},\r
- // {SYSTEMLANGUAGEVIEW, &SystemView::ChangeSystemLanguageView},\r
- // {FACTORYRESETVIEW, &SystemView::ChangeSystemFactoryResetView},\r
+\r
};\r
\r
testView::testView()\r
if (initViewStatus == true)\r
{\r
SystemScrollView[TESTVIEW]->RemoveAll();\r
- // UIView::OnDragListener *draglistener = SystemScrollView[SYSTEMVIEW]->GetOnDragListener();\r
- // if (draglistener != nullptr)\r
- // {\r
- // delete draglistener;\r
- // draglistener = nullptr;\r
- // }\r
-\r
int funcSize = sizeof(Test_ViewMapper_t) / sizeof(Test_ViewMapper_t[TESTVIEW]);\r
for (int i = 0; i < funcSize; i++)\r
{\r
delete test_motor_view;//7\r
test_motor_view = nullptr;\r
}\r
+#ifdef SUPPORT_CAT1_MODEM\r
if(test_cat1_view)\r
{\r
delete test_cat1_view;//8\r
test_cat1_view = nullptr;\r
}\r
+#endif\r
+\r
if(test_KEY_view)\r
{\r
delete test_KEY_view;//9\r
}\r
SystemScrollView[TESTVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
SystemScrollView[TESTVIEW]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+SystemScrollView[TESTVIEW]->SetStyle(STYLE_BORDER_RADIUS, 0);\r
+ \r
SystemScrollView[TESTVIEW]->SetScrollBlankSize(35);\r
SystemScrollView[TESTVIEW]->SetReboundSize(50);\r
SystemScrollView[TESTVIEW]->SetDirection(1);\r
return true;\r
}\r
\r
+ \r
+ bool testView::ChangeGPSTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSEChipTESTView");\r
+ test_GPS_view = new testGPSView();\r
+ if (test_GPS_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_GPS_view->testGPSInitIView((uint8_t)thisView);\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+\r
#ifdef SUPPORT_A5133_SERVICE\r
bool testView::ChangeA5133TESTView(int16_t thisView)\r
{\r
test_motor_view = nullptr;\r
SystemScrollView[hideView]=nullptr;\r
break;\r
+#ifdef SUPPORT_CAT1_MODEM\r
case CAT1:\r
RootView::GetInstance()->Remove(SystemScrollView[hideView]);\r
delete test_cat1_view; \r
test_cat1_view = nullptr;\r
SystemScrollView[hideView]=nullptr;\r
break;\r
+#endif\r
case BUTTON:\r
RootView::GetInstance()->Remove(SystemScrollView[hideView]);\r
delete test_KEY_view; \r
delete test_Ping_view; \r
test_Ping_view = nullptr;\r
SystemScrollView[hideView]=nullptr;\r
+ break;\r
+ case GPSTEST:\r
+ RootView::GetInstance()->Remove(SystemScrollView[hideView]);\r
+ delete test_GPS_view; \r
+ test_GPS_view = nullptr;\r
+ SystemScrollView[hideView]=nullptr;\r
break; \r
#ifdef SUPPORT_A5133_SERVICE\r
case RF5133:\r