From cd9897c1391e7ebb440181625d67676dd14d84a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=83=A1=E4=BC=A0=E5=86=9B?= <1224667075@qq.com> Date: Sat, 22 Jun 2024 02:11:24 +0000 Subject: [PATCH] Merge #354 into sdk602patch0521 from refs/changes/354/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 胡传军 * refs/changes/354/head: (5 commits squashed) - 目标历史数据修改 - Merge branch 'sdk602patch0521' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0521 - 优化cywee数据存储函数名 - 合并 - 产测UI修改 Signed-off-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/354 --- .../producttest/include/testchanging.h | 2 + .../nativeui/producttest/src/testView.cpp | 17 +- .../nativeui/producttest/src/testabout.cpp | 380 +++++------------- .../nativeui/producttest/src/testcat1.cpp | 36 +- .../nativeui/producttest/src/testchanging.cpp | 21 + 5 files changed, 153 insertions(+), 303 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h index 15985e4ac..87c392ff8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h @@ -48,6 +48,8 @@ namespace OHOS UIScrollView *testCHANINGScrollView{nullptr}; bool initViewStatus{false}; UILabel *Title{nullptr}; // 标题 + UILabel *charnge_label{nullptr}; // 标题 + UILabelButtonExt* labelButton_next = nullptr; }; } 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 3a9fca544..4436d9cca 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp @@ -2,7 +2,10 @@ #include "producttest/include/testPresenter.h" #include "power_display_service.h" #include "wearable_log.h" - +#include "cat1_server.h" +#include "cat1_ctl.h" +#include "cat1_server_hal.h" +#include "custom_utils.h" namespace OHOS { @@ -25,7 +28,7 @@ namespace OHOS {TP,"TPButton","TP", &testView::ChangeTPTESTView}, {MAGETIC,"MAGETICButton","Magetic", &testView::ChangeMGTESTView}, {LUMINANCE,"luminanceButton","luminance", &testView::ChangLUMTESTView}, - {CHAR,"chargingButton","charging", &testView::ChangchargingTESTView}, + {CHAR,"chargingButton","bat&charger", &testView::ChangchargingTESTView}, {SPEAK,"speakButton","speak", &testView::ChangspeakTESTView}, {MOTOR,"motorButton","motor", &testView::ChangmotorTESTView}, {CAT1,"cat1button","CAT1", &testView::ChangeCAT1TESTView}, @@ -33,13 +36,13 @@ namespace OHOS {MICROPHONE,"microphonebutton","microphone" ,&testView::ChangeMPTESTView}, {HRSENSON,"hrsensonbutton","hrsensor" ,&testView::ChangeHRTESTView}, {GSENSON,"gsensonbutton","gsensor" ,&testView::ChangeGTESTView}, - {BTTEST,"BTbutton","BR" ,&testView::ChangeBTTESTView}, + {BTTEST,"BTbutton","BT" ,&testView::ChangeBTTESTView}, {SEChipTest,"SEChipTestbutton","SEChipTest" ,&testView::ChangeSEChipTESTView}, {OLDTEST,"oldtestbutton","aging" ,&testView::ChangeoldTESTView}, - {DEEPSLEEP,"deepsleep","CloseBTCat1&Sleep" ,&testView::ChangeoldTESTView}, + {DEEPSLEEP,"deepsleep","DeepSleepCurrent" ,&testView::ChangeoldTESTView}, {shutdown,"shutdown","shutdown" ,&testView::ChangeoldTESTView}, // {FACTORYRESETVIEW,"FactoryResetButton","恢复出厂", &testView::ChangeSystemAboutView}, @@ -745,6 +748,7 @@ namespace OHOS void testView::OnStart() { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnStart>>>>>>>>>>>>>"); View::OnStart(); //InitIView(); initView_ext(43,120,380,100,120,"/user/res/SETTING_NEXT.bin"); @@ -754,6 +758,11 @@ namespace OHOS display_api->turn_on_screen(); } display_api->set_auto_timeout_function(false); + + uapi_cat1_power_on(1); + uapi_cat1_reset(0); + + start_custom_ble_service(); } void testView::OnSetUpView() 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 b81514d04..5427d1731 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp @@ -46,7 +46,7 @@ namespace OHOS static constexpr uint16_t LABEL_W = 400; static constexpr uint16_t LABEL_H = 40; static constexpr uint16_t LABEL_FONTSIZE = 30; - static constexpr uint16_t LABEL_LINEHEIGHT = 35; + static constexpr uint16_t LABEL_LINEHEIGHT = 0; static testAboutView g_pSystemAboutTheWatchView; @@ -72,55 +72,49 @@ namespace OHOS void testAboutView::ClearAll() { - if (initViewStatus == true) - { + if(testAboutTheWatchScrollView) + { testAboutTheWatchScrollView->RemoveAll(); - delete SystemAboutTheWatchTitle; - SystemAboutTheWatchTitle = nullptr; - - delete WatchNameTitle; - WatchNameTitle = nullptr; - delete WatchName; - WatchName = nullptr; - - delete FirmwareVersionTitle; - FirmwareVersionTitle = nullptr; - delete FirmwareVersion; - FirmwareVersion = nullptr; - - delete BluetoothNameTitle; - BluetoothNameTitle = nullptr; - delete BluetoothName; - BluetoothName = nullptr; - - delete BluetoothAddressTitle; - BluetoothAddressTitle = nullptr; - delete BluetoothAddress; - BluetoothAddress = nullptr; - - delete Network4GTitle; - Network4GTitle = nullptr; - delete Network4G; - Network4G = nullptr; - - delete PyVerTitle; - PyVerTitle = nullptr; - delete PyVer; - PyVer = nullptr; - - delete IMELTitle; - IMELTitle = nullptr; - delete IMEL; - IMEL = nullptr; - - delete FONTTitle; - FONTTitle = nullptr; - delete FONT; - FONT = nullptr; + if(SystemAboutTheWatchTitle) + { + delete SystemAboutTheWatchTitle; + SystemAboutTheWatchTitle = nullptr; + } + + if(FirmwareVersion) + { + delete FirmwareVersion; + FirmwareVersion = nullptr; + } + + if(BluetoothAddress) + { + delete BluetoothAddress; + BluetoothAddress = nullptr; + } + if(Network4G) + { + delete Network4G; + Network4G = nullptr; + } + + if(PyVer) + { + delete PyVer; + PyVer = nullptr; + } + + if(IMEL) + { + delete IMEL; + IMEL = nullptr; + } + delete testAboutTheWatchScrollView; testAboutTheWatchScrollView = nullptr; - } + } + } @@ -212,7 +206,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); return false; } - testAboutTheWatchScrollView->SetOnDragListener(draglistener); + testAboutTheWatchScrollView->SetOnDragListener(draglistener); testAboutTheWatchScrollView->SetTouchable(true); testAboutTheWatchScrollView->SetDraggable(true); @@ -226,93 +220,49 @@ namespace OHOS return nullptr; } /* -------------------------------------------------------------------------- */ - LabelConfig Config = { - .left = SYSTEM_ABOUT_THEWATCH_TITLE_X, - .top = SYSTEM_ABOUT_THEWATCH_TITLE_Y, - .width = SYSTEM_ABOUT_THEWATCH_TITLE_W, - .height = SYSTEM_ABOUT_THEWATCH_TITLE_H, - .fontSize = SYSTEM_ABOUT_THEWATCH_TITLE_FONTSIZE, - .lineHeigh = SYSTEM_ABOUT_THEWATCH_TITLE_LINEHEIGHT, - .text = "关于", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - SystemAboutTheWatchTitle = InitLabel(Config); - if (SystemAboutTheWatchTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchTitle new fail!"); - return nullptr; - } + + SystemAboutTheWatchTitle = init_title(142,60,"ABOUT_WATCH"); + testAboutTheWatchScrollView->Add(SystemAboutTheWatchTitle); /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_NAME_POS_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "手表名称", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - WatchNameTitle = InitLabel(Config); - if (WatchNameTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::WatchNameTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(WatchNameTitle); + /* -------------------------------------------------------------------------- */ - Config = { - .left = LABEL_X, - .top = WATCH_NAME_VALUE_POS_TOP, - .width = LABEL_W, - .height = LABEL_H, - .fontSize = LABEL_FONTSIZE, - .lineHeigh = LABEL_LINEHEIGHT, - .text = "Watch Soar", - .lineBreakMode = UILabel::LINE_BREAK_WRAP, - }; - WatchName = InitLabel(Config); - if (WatchName == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::WatchName new fail!"); - return nullptr; - } - WatchName->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); - testAboutTheWatchScrollView->Add(WatchName); - /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_FIRMWARE_POS_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "固件版本", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - FirmwareVersionTitle = InitLabel(Config); - if (FirmwareVersionTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FirmwareVersionTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(FirmwareVersionTitle); + // Config = { + // .left = TITLE_LABEL_X, + // .top = WATCH_FIRMWARE_POS_TOP, + // .width = TITLE_LABEL_W, + // .height = TITLE_LABEL_H, + // .fontSize = TITLE_LABEL_FONTSIZE, + // .lineHeigh = TITLE_LABEL_LINEHEIGHT, + // .text = "固件版本", + // .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, + // }; + // FirmwareVersionTitle = InitLabel(Config); + // if (FirmwareVersionTitle == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FirmwareVersionTitle new fail!"); + // return nullptr; + // } + // testAboutTheWatchScrollView->Add(FirmwareVersionTitle); /* -------------------------------------------------------------------------- */ + #define offest 40 char version_buf[128] = {0}; uint32_t version_len = 128; uapi_get_buildversion((uint8_t *)version_buf, version_len); - Config = { + char version_buf_[128] = {0}; + sprintf_s(version_buf_,128,"ver:%s",version_buf); + LabelConfig Config = { .left = LABEL_X, - .top = WATCH_FIRMWARE_VALUE_POS_TOP, + .top = 110, .width = LABEL_W, .height = LABEL_H, .fontSize = LABEL_FONTSIZE, .lineHeigh = LABEL_LINEHEIGHT, - .text = (char *)version_buf, + .text = (char *)version_buf_, .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; FirmwareVersion = InitLabel(Config); + if (FirmwareVersion == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FirmwareVersion new fail!"); @@ -321,76 +271,21 @@ namespace OHOS FirmwareVersion->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); testAboutTheWatchScrollView->Add(FirmwareVersion); /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_BT_NAME_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "蓝牙名称", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - BluetoothNameTitle = InitLabel(Config); - if (BluetoothNameTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::BluetoothNameTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(BluetoothNameTitle); + + /* -------------------------------------------------------------------------- */ - uint8_t ble_name[LABEL_FONTSIZE] = {0}; - uint32_t ble_name_len = sizeof(ble_name); - errcode_t ret = uapi_get_nv_btname(ble_name, &ble_name_len); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get btname %s ,ret 0x%X\n", ble_name, ret); - - Config = { - .left = LABEL_X, - .top = WATCH_BT_NAME_VALUE_TOP, - .width = LABEL_W, - .height = LABEL_H, - .fontSize = LABEL_FONTSIZE, - .lineHeigh = LABEL_LINEHEIGHT, - .text = (char *)ble_name, - .lineBreakMode = UILabel::LINE_BREAK_WRAP, - }; - BluetoothName = InitLabel(Config); - if (BluetoothName == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::BluetoothName new fail!"); - return nullptr; - } - BluetoothName->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); - testAboutTheWatchScrollView->Add(BluetoothName); - /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_BT_ADDR_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "蓝牙地址", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - BluetoothAddressTitle = InitLabel(Config); - if (BluetoothAddressTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::BluetoothAddressTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(BluetoothAddressTitle); + /* -------------------------------------------------------------------------- */ uint8_t btaddr[6] = {0}; uint8_t btaddr_str[64] = {0}; uint32_t len = 6; - ret = uapi_get_nv_btaddr((uint8_t *)btaddr, &len); - sprintf((char *)btaddr_str, "%02X:%02X:%02X:%02X:%02X:%02X", btaddr[0], btaddr[1], btaddr[2], btaddr[3], btaddr[4], btaddr[5]); + errcode_t ret = uapi_get_nv_btaddr((uint8_t *)btaddr, &len); + sprintf((char *)btaddr_str, "蓝牙地址:%02X:%02X:%02X:%02X:%02X:%02X", btaddr[0], btaddr[1], btaddr[2], btaddr[3], btaddr[4], btaddr[5]); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get btaddr %s , ret 0x%X\n", btaddr_str, ret); Config = { .left = LABEL_X, - .top = WATCH_BT_ADDR_VALUE_TOP, + .top = 150+offest, .width = LABEL_W, .height = LABEL_H, .fontSize = LABEL_FONTSIZE, @@ -407,69 +302,20 @@ namespace OHOS BluetoothAddress->SetTextColor(Color::GetColorFromRGBA(0x88, 0x88, 0x88, 0xff)); testAboutTheWatchScrollView->Add(BluetoothAddress); /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_MODEM_VERSION_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "4G Modem", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - Network4GTitle = InitLabel(Config); - if (Network4GTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::Network4GTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(Network4GTitle); - /* -------------------------------------------------------------------------- */ - Config = { - .left = LABEL_X, - .top = WATCH_MODEM_VERSION_VALUE_TOP, - .width = LABEL_W, - .height = LABEL_H, - .fontSize = LABEL_FONTSIZE - 2, - .lineHeigh = LABEL_LINEHEIGHT, - .text = ConfigModel::GetInstance()->GetmoderVer(), - .lineBreakMode = UILabel::LINE_BREAK_WRAP, - }; - Network4G = InitLabel(Config); - if (Network4G == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::Network4G new fail!"); - return nullptr; - } - Network4G->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); - testAboutTheWatchScrollView->Add(Network4G); + /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_MODEM_APP_VERSION_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "pyVer", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - PyVerTitle = InitLabel(Config); - if (PyVerTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::PyVerTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(PyVerTitle); + char GetpyVer_buf[256] = {0}; + sprintf_s(GetpyVer_buf,256,"PY:%s",ConfigModel::GetInstance()->GetpyVer().c_str()); + /* -------------------------------------------------------------------------- */ Config = { .left = LABEL_X, - .top = WATCH_MODEM_APP_VERSION_VALUE_TOP, + .top = 190+offest, .width = LABEL_W, .height = LABEL_H, .fontSize = LABEL_FONTSIZE, .lineHeigh = LABEL_LINEHEIGHT, - .text = ConfigModel::GetInstance()->GetpyVer(), + .text = GetpyVer_buf, .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; PyVer = InitLabel(Config); @@ -480,33 +326,19 @@ namespace OHOS } PyVer->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); testAboutTheWatchScrollView->Add(PyVer); - /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_IMEI_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "IMEI", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - IMELTitle = InitLabel(Config); - if (IMELTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::IMELTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(IMELTitle); + + char Getimei_buf[256] = {0}; + sprintf_s(Getimei_buf,256,"IMEI:%s",ConfigModel::GetInstance()->Getimei().c_str()); + /* -------------------------------------------------------------------------- */ Config = { .left = LABEL_X, - .top = WATCH_IMEI_VALUE_TOP, + .top = 230+offest, .width = LABEL_W, .height = LABEL_H, .fontSize = LABEL_FONTSIZE, .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = ConfigModel::GetInstance()->Getimei(), + .text =Getimei_buf, //ConfigModel::GetInstance()->Getimei(), .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; IMEL = InitLabel(Config); @@ -518,46 +350,32 @@ namespace OHOS IMEL->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); testAboutTheWatchScrollView->Add(IMEL); /* -------------------------------------------------------------------------- */ - Config = { - .left = TITLE_LABEL_X, - .top = WATCH_FONT_TOP, - .width = TITLE_LABEL_W, - .height = TITLE_LABEL_H, - .fontSize = TITLE_LABEL_FONTSIZE, - .lineHeigh = TITLE_LABEL_LINEHEIGHT, - .text = "FONTS", - .lineBreakMode = UILabel::LINE_BREAK_MARQUEE, - }; - FONTTitle = InitLabel(Config); - if (FONTTitle == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FONTTitle new fail!"); - return nullptr; - } - testAboutTheWatchScrollView->Add(FONTTitle); + char GetmoderVer_buf[256] = {0}; + sprintf_s(GetmoderVer_buf,256,"4G:%s",ConfigModel::GetInstance()->GetmoderVer().c_str()); /* -------------------------------------------------------------------------- */ Config = { .left = LABEL_X, - .top = WATCH_FONT_VALUE_TOP, + .top = 270+offest, .width = LABEL_W, .height = LABEL_H, - .fontSize = LABEL_FONTSIZE, + .fontSize = LABEL_FONTSIZE - 2, .lineHeigh = LABEL_LINEHEIGHT, - .text = "HarmonyOS Sans", + .text = GetmoderVer_buf, .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; - FONT = InitLabel(Config); - if (FONT == nullptr) + Network4G = InitLabel(Config); + if (Network4G == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::FONT new fail!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::Network4G new fail!"); return nullptr; } - FONT->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); - testAboutTheWatchScrollView->Add(FONT); + Network4G->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(Network4G); + /* -------------------------------------------------------------------------- */ initViewStatus = true; - labelButton_next =init_button_next(165, WATCH_ABOUT_NEXT_BUTTON_TOP,"LCDButton_next"); + labelButton_next =init_button_next(165,400,"LCDButton_next"); testAboutTheWatchScrollView->Add(labelButton_next); return testAboutTheWatchScrollView; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp index a06b85374..0991f1443 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp @@ -45,11 +45,11 @@ namespace OHOS Gsenson_TEST_timer = NULL; return ; } - if(button) - { - delete button; - button=nullptr; - } + // if(button) + // { + // delete button; + // button=nullptr; + // } if(labelButton_next) { delete labelButton_next; @@ -280,19 +280,19 @@ namespace OHOS cat1_getsignal(); cat1_getver(); /* -------------------------------------------------------------------------- */ - ButtonConfig_ext_t buttonconfig; - buttonconfig.x = 100; - buttonconfig.y = 350; - buttonconfig.w = 180; - buttonconfig.h = 96; - buttonconfig.label_x=40; - buttonconfig.label_y=0; - buttonconfig.Fontsize=30; - buttonconfig.ViewId="dial_112"; - buttonconfig.str="dial"; - buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; - button=SetTheButton_ext(buttonconfig); - testcat1ScrollView->Add(button); + // ButtonConfig_ext_t buttonconfig; + // buttonconfig.x = 100; + // buttonconfig.y = 350; + // buttonconfig.w = 180; + // buttonconfig.h = 96; + // buttonconfig.label_x=40; + // buttonconfig.label_y=0; + // buttonconfig.Fontsize=30; + // buttonconfig.ViewId="dial_112"; + // buttonconfig.str="dial"; + // buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + // button=SetTheButton_ext(buttonconfig); + // //testcat1ScrollView->Add(button); UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); if (draglistener == nullptr) diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp index 018a34c75..adc5f1ba0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp @@ -2,6 +2,7 @@ #include "custom_utils.h" #include "producttest/include/testPresenter.h" #include "producttest/include/testchanging.h" +#include "battery_hal.h" #include "cmsis_os2.h" #ifdef __cplusplus @@ -62,6 +63,12 @@ namespace OHOS delete Title; Title=nullptr; } + if(charnge_label) + { + delete charnge_label; + charnge_label=nullptr; + } + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST); if (cnt == 1) { uapi_pm_remove_sleep_veto(PM_ID_P_TEST); @@ -184,6 +191,20 @@ namespace OHOS Title= testAboutView::GetInstance()->init_title(120,45,"CHANING_TEST"); testCHANINGScrollView->Add(Title); + + float voltage = 0.0F; + uint8_t power = 0; + power = battery_get_voltage(&voltage); + + char battery_buf[32]={0}; + + sprintf_s(battery_buf,32,"power:%d\nvoltage:%.2f",power,voltage); + + charnge_label= testAboutView::GetInstance()->init_title(100,250,battery_buf); + testCHANINGScrollView->Add(charnge_label); + + + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST); if (cnt == 0) { uapi_pm_add_sleep_veto(PM_ID_P_TEST); -- 2.17.1