From c7dbea4434f3db528bc8dbb0f3acb1207ef2f69b Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Tue, 18 Jun 2024 20:22:17 +0800 Subject: [PATCH] =?utf8?q?=E6=95=B4=E6=9C=BA=E4=BA=A7=E6=B5=8B=E4=BF=AE?= =?utf8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/fd230app/CMakeLists.txt | 3 +- .../nativeui/bluetooth/src/BluetoothModel.cpp | 19 ++- .../fd230app/nativeui/goal/src/goalview.cpp | 2 + .../producttest/include/testPresenter.h | 7 +- .../producttest/include/testSEChipTest.h | 53 ++++++ .../nativeui/producttest/include/testView.h | 6 +- .../nativeui/producttest/include/testbt.h | 4 +- .../nativeui/producttest/include/testbutton.h | 6 +- .../producttest/src/testPresenter.cpp | 25 ++- .../producttest/src/testSEChipTest.cpp | 153 ++++++++++++++++++ .../nativeui/producttest/src/testView.cpp | 36 ++++- .../nativeui/producttest/src/testbt.cpp | 62 ++++++- .../nativeui/producttest/src/testbutton.cpp | 105 ++++++++++-- .../nativeui/producttest/src/testgsenson.cpp | 2 +- .../peripheral/config/include/ConfigModel.h | 10 +- .../chips/brandy/pm/include/pm_definition.h | 1 + code/sdk/middleware/chips/brandy/pm/pm.c | 1 + 17 files changed, 452 insertions(+), 43 deletions(-) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testSEChipTest.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testSEChipTest.cpp diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 3ad24a088..48ee3ce14 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -651,7 +651,8 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testgsenson.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testold.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testbt.cpp - + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testSEChipTest.cpp + #每日目标 ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalmodel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalview.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp index a28693f58..2dd3fc9d7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp @@ -47,6 +47,12 @@ void BluetoothModel::SetBluetoothCalleridStatus(int16_t value) { callerid = value; } +static bool Productfalg=false; + +// void BluetoothModel::SetProductfalg(bool falg) +// { +// callerid = value; +// } int BluetoothModel::GetBluetoothCalleridStatus(void) { @@ -134,9 +140,10 @@ void BluetoothModel::SetScansCaseRssi(const bd_addr_t *bdAddr, int rssi) for (auto it = btScansDevicesList_.begin(); it != btScansDevicesList_.end(); it++) { if ((it->addr[0] == bdAddr->addr[0]) && (it->addr[1] == bdAddr->addr[1]) && (it->addr[2] == bdAddr->addr[2]) && (it->addr[3] == bdAddr->addr[3]) - && (it->addr[4] == bdAddr->addr[4]) && (it->addr[5] == bdAddr->addr[5])) { + && (it->addr[4] == bdAddr->addr[4]) && (it->addr[5] == bdAddr->addr[5])) + { it->temp = rssi; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "btScansDevicesList_ rssi:%d deviceName:%s", it->temp, it->deviceName); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "btScansDevicesList_ rssi:%d deviceName:%s", it->temp, it->deviceName); } } } @@ -475,18 +482,18 @@ extern "C" { void BtGapReadRemoteRssiEventCallback(const bd_addr_t *bdAddr, int rssi, int status) { UNUSED(status); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BtGapReadRemoteRssiEventCallback addr: %02x%02x%02x%02x%02x%02x", + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BtGapReadRemoteRssiEventCallback addr: %02x%02x%02x%02x%02x%02x", bdAddr->addr[5], bdAddr->addr[4], bdAddr->addr[3], /* mac下标 0 1 2 3 4 5 */ bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0]); /* mac下标 0 1 2 3 4 5 */ BluetoothModel::GetInstance()->SetScansCaseRssi(bdAddr, rssi); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bt BtGapReadRemoteRssiEventCallback SetSortCaseRssi: %d status: %d", rssi, status); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt BtGapReadRemoteRssiEventCallback SetSortCaseRssi: %d status: %d", rssi, status); } // 回调:发现状态变化上报/扫描结束 void BtGapDiscoveryStateChangedCallback(int status) { UNUSED(status); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bt BtGapDiscoveryStateChangedCallback %d", status); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt BtGapDiscoveryStateChangedCallback %d", status); } static void ChangeScanView() @@ -530,6 +537,7 @@ void BluetoothModel::BtGapDiscoveryResultCallbakHandle(const bd_addr_t &bdAddr) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_discovery_result_callback getNameRet(bool): %d nameLen: %d name:%s", getNameRet, nameLen, caseInfo.deviceName); + if (nameLen == 0) { // 过滤未扫描到名字的设备 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "nameLen == 0 return"); return; @@ -541,6 +549,7 @@ void BluetoothModel::BtGapDiscoveryResultCallbakHandle(const bd_addr_t &bdAddr) } bool ret = gap_read_remote_rssi_value(&bdAddr); // 获取rssi WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_read_remote_rssi_value ret = %d", ret); + BluetoothEarPhoneView *bluetoothEarPhoneView = BluetoothEarPhoneView::GetInstance(); if (bluetoothEarPhoneView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothEarPhoneView nullptr"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp index 387ddd721..8313af38e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp @@ -49,6 +49,8 @@ namespace OHOS goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal()); circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue()); + Invalidate(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalViewrefresh Invalidat "); RootView::GetInstance()->Invalidate(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h index be9a3220f..5e14ddb52 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h @@ -35,12 +35,12 @@ namespace OHOS HRSENSON, GSENSON, BTTEST, + SEChipTest, OLDTEST, DEEPSLEEP, shutdown, TEST_1, - MAX_TESTVIEWID, } TEST_VIEW; @@ -50,7 +50,8 @@ namespace OHOS public UIView::OnClickListener, public UIView::OnDragListener, public UIView::OnTouchListener, - public RootView::OnKeyActListener + public RootView::OnKeyActListener, + public UIView::OnRotateListener { public: @@ -71,6 +72,8 @@ namespace OHOS bool OnDragEnd(UIView &view, const DragEvent &event) override; bool OnPress(UIView &view, const PressEvent &event); bool OnKeyAct(UIView &view, const KeyEvent &event); + bool OnRotate(UIView& view, const RotateEvent& event); + bool OnRotateEnd(UIView& view, const RotateEvent& event); //bool OnChange(int) override; private: testModel *systemModel; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testSEChipTest.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testSEChipTest.h new file mode 100644 index 000000000..e3a946dbe --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testSEChipTest.h @@ -0,0 +1,53 @@ +#ifndef TEST_SECCHIP_VIEW_H +#define TEST_SECCHIP_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_image_view.h" +#include "producttest/include/testabout.h" +#include "components/ui_label_button_ext.h" +#include +namespace OHOS +{ + class testSEChipView + { + + public: + testSEChipView(); + virtual ~testSEChipView(); + static testSEChipView *GetInstance(void); + struct LabelConfig + { + int16_t left; + int16_t top; + int16_t width; + int16_t height; + int16_t fontSize; // 字体大小 + int16_t lineHeigh; // 行高 + std::string text; // 文本 + uint8_t lineBreakMode; // 断行模式。 + }; + UIScrollView *SEChipInitIView(void); + void ClearAll(void); + UILabel *InitLabel(LabelConfig &labelConfig); + + + private: + UIScrollView *testSEChipScrollView{nullptr}; + + bool SEChipInitIview(void); + + UILabel *chipinfo_label{nullptr}; + + UILabel *IIC_label{nullptr}; + + UILabelButtonExt* labelButton_next = nullptr; + UILabel *Title{nullptr}; // 标题 + + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h index facb9a174..06c7b1af4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h @@ -26,8 +26,8 @@ #include "producttest/include/testhrsenson.h" #include "producttest/include/testgsenson.h" #include "producttest/include/testold.h" - #include "producttest/include/testbt.h" +#include "producttest/include/testSEChipTest.h" namespace OHOS { @@ -87,8 +87,8 @@ namespace OHOS bool ChangeCAT1TESTView(int16_t thisView); bool ChangeGTESTView(int16_t thisView); bool ChangeoldTESTView(int16_t thisView); - bool ChangeBTTESTView(int16_t thisView); + bool ChangeSEChipTESTView(int16_t thisView); bool ClickFunc(int16_t interface); void ChangeView(int16_t hideView, int16_t showView); @@ -124,6 +124,8 @@ namespace OHOS testoldView *test_old_view{nullptr}; testBTView *test_BT_view{nullptr}; + testSEChipView *test_SEChip_view{nullptr}; + UILabelButtonExt *button[20]={NULL}; bool initViewStatus{false}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbt.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbt.h index 93764dc20..69df1cf9e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbt.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbt.h @@ -36,8 +36,6 @@ namespace OHOS int Fontsize; }; - - struct LabelConfig { @@ -73,7 +71,7 @@ namespace OHOS UILabelButtonExt* labelButton_next = nullptr; UILabel *label_BR_SCAN[5]{nullptr}; - + bool initViewStatus{false}; UILabel *Title{nullptr}; // 标题 diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h index be5fee9da..dbf28d8f4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h @@ -40,6 +40,9 @@ namespace OHOS virtual ~testbuttonView(); static testbuttonView *GetInstance(void); void Changbutton(int,bool); + void Changbutton(bool); + void Changbutton(int16_t); + UIScrollView *testBUTTONInitIView(void); void ClearAll(void); @@ -48,7 +51,8 @@ namespace OHOS bool testBUTTONScrollViewcrollViewinit(void); UIScrollView *testBUTTONScrollView{nullptr}; UILabelButtonExt* labelButton_next = nullptr; - UILabelButtonExt* button[2]{NULL}; + UILabelButtonExt* button[3]{nullptr}; + UILabel *label_crown{nullptr}; UILabel *Title{nullptr}; // 标题 bool initViewStatus{false}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp index d2f747f09..2c77354c3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp @@ -50,8 +50,10 @@ namespace OHOS {BUTTON,"buttonbutton", "microphonebutton_next",true}, {MICROPHONE,"microphonebutton", "hrsensonbutton_next",true}, {HRSENSON,"hrsensonbutton", "gsensonbutton_next",true}, - {GSENSON,"gsensonbutton","xxxx" ,true}, - {BTTEST,"BTbutton","xxxx",true}, + {GSENSON,"gsensonbutton","BTbutton_next" ,true}, + {BTTEST,"BTbutton","SEChipTestbutton_next",true}, + {SEChipTest,"SEChipTestbutton","xxxx" ,true}, + {OLDTEST,"oldtestbutton","oldtestexit",true}, {DEEPSLEEP,"deepsleep","xxxxxxxxx",true}, {shutdown,"shutdown","xxxxxxxxx",true}, @@ -187,7 +189,7 @@ namespace OHOS if(strcmp(view.GetViewId(),"xxxx") == 0) { //testSPEAKView::GetInstance()->Changspeak(true); - testView::GetInstance()->ChangeView(GSENSON,TESTVIEW); + testView::GetInstance()->ChangeView(SEChipTest,TESTVIEW); return true; } @@ -309,6 +311,23 @@ namespace OHOS return true; } + bool testPresenter::OnRotate(UIView &view, const RotateEvent &event) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "testPresenter::OnRotate %d",event.GetRotate()); + testbuttonView::GetInstance()->Changbutton(event.GetRotate()); + + testbuttonView::GetInstance()->Changbutton(true); + return true; + } + + bool testPresenter::OnRotateEnd(UIView &view, const RotateEvent &event) + { + UNUSED(view); + UNUSED(event); + testbuttonView::GetInstance()->Changbutton(false); + return true; + } + // 该拖拽是用来处理系统视图(slice)的左滑退出事件和子视图的左滑退出到系统视图区分开 diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testSEChipTest.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testSEChipTest.cpp new file mode 100644 index 000000000..3a0cabee4 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testSEChipTest.cpp @@ -0,0 +1,153 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testSEChipTest.h" +#include "ConfigModel.h" + + +namespace OHOS +{ + + static testSEChipView g_pSystemAboutTheWatchView; + + testSEChipView::testSEChipView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + //g_pSystemAboutTheWatchView = this; + } + + testSEChipView::~testSEChipView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + //g_pSystemAboutTheWatchView = nullptr; + } + + testSEChipView *testSEChipView::GetInstance() + { + + return &g_pSystemAboutTheWatchView; + } + + void testSEChipView::ClearAll() + { + + } + + UILabel *testSEChipView::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.c_str()); // 内容 + label->SetLineBreakMode(labelConfig.lineBreakMode); // 断行模式。 + label->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_TOP); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelConfig.fontSize); + return label; + } + + bool testSEChipView::SEChipInitIview(void) + { + testSEChipScrollView = new UIScrollView(); + if (testSEChipScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testSEChipScrollView new fail!"); + return false; + } + testSEChipScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testSEChipScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testSEChipScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294); + testSEChipScrollView->SetScrollBlankSize(0); + testSEChipScrollView->SetReboundSize(0); + testSEChipScrollView->SetDirection(1); + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testSEChipScrollView->SetOnDragListener(draglistener); + testSEChipScrollView->SetTouchable(true); + + testSEChipScrollView->SetDraggable(true); + return true; + } + + UIScrollView *testSEChipView::SEChipInitIView() + { + if (!SEChipInitIview()) + { + return nullptr; + } + + char chipinfo[64] = {0}; + uapi_cywee_get_chipinfo(chipinfo,sizeof(chipinfo)); + + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s ",chipinfo); + + /* -------------------------------------------------------------------------- */ + char buf[128]={0}; + + sprintf_s(buf,128,"chipinfo:%s\n",chipinfo); + LabelConfig Config = { + .left = 33, + .top = 150, + .width = 380, + .height = 44, + .fontSize = 30, + .lineHeigh = 0, + .text = buf, + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + chipinfo_label = InitLabel(Config); + if (chipinfo_label == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::IMELTitle new fail!"); + return nullptr; + } + testSEChipScrollView->Add(chipinfo_label); + + if(custom_i2c_test()==ERRCODE_SUCC) + { + sprintf_s(buf,128,"IIC true\n"); + } + else + { + sprintf_s(buf,128,"IIC false\n"); + } + + Config = { + .left = 33, + .top = 250, + .width = 380, + .height = 44, + .fontSize = 30, + .lineHeigh = 0, + .text = buf, + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + IIC_label = InitLabel(Config); + if (IIC_label == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::IMELTitle new fail!"); + return nullptr; + } + testSEChipScrollView->Add(IIC_label); + + + + labelButton_next= testAboutView::GetInstance()->init_button_next(267,300,"xxxx"); + testSEChipScrollView->Add(labelButton_next); + + Title= testAboutView::GetInstance()->init_title(142,40,"SEChip_TEST"); + testSEChipScrollView->Add(Title); + /* -------------------------------------------------------------------------- */ + + return testSEChipScrollView; + } +} \ No newline at end of file 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 bdba67b04..1c2aa5399 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp @@ -31,8 +31,10 @@ namespace OHOS {MICROPHONE,"microphonebutton","microphone" ,&testView::ChangeMPTESTView}, {HRSENSON,"hrsensonbutton","hrsensor" ,&testView::ChangeHRTESTView}, {GSENSON,"gsensonbutton","gsensor" ,&testView::ChangeGTESTView}, + {BTTEST,"BTbutton","BR" ,&testView::ChangeBTTESTView}, + + {SEChipTest,"SEChipTestbutton","SEChipTest" ,&testView::ChangeSEChipTESTView}, - {BTTEST,"BTbutton","BT" ,&testView::ChangeBTTESTView}, {OLDTEST,"oldtestbutton","aging" ,&testView::ChangeoldTESTView}, {DEEPSLEEP,"deepsleep","CloseBTCat1&Sleep" ,&testView::ChangeoldTESTView}, @@ -548,7 +550,7 @@ namespace OHOS return true; } - bool testView::ChangeBTTESTView(int16_t thisView) + bool testView::ChangeBTTESTView(int16_t thisView) { if (SystemScrollView[thisView] == nullptr) { @@ -565,6 +567,26 @@ namespace OHOS return true; } + + bool testView::ChangeSEChipTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_SEChip_view = new testSEChipView(); + if (test_SEChip_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_SEChip_view->SEChipInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + + UIScrollView *testView::GetSystemScrollView(int ViewId) { if (SystemScrollView[ViewId] == nullptr) @@ -703,7 +725,13 @@ namespace OHOS test_BT_view = nullptr; SystemScrollView[hideView]=nullptr; break; - + case SEChipTest: + RootView::GetInstance()->Remove(SystemScrollView[hideView]); + delete test_SEChip_view; + test_SEChip_view = nullptr; + SystemScrollView[hideView]=nullptr; + break; + default: break; } @@ -723,7 +751,7 @@ namespace OHOS { display_api->turn_on_screen(); } - display_api->set_screen_set_keepon_timeout(-1); + display_api->set_auto_timeout_function(false); } void testView::OnSetUpView() diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp index faf54d392..25645b279 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbt.cpp @@ -12,6 +12,21 @@ #include "bts_le_gap.h" #include "bleService.h" #include "BluetoothModel.h" +#ifdef __cplusplus +#if __cplusplus +extern "C" +{ +#endif +#endif + #include "pm_veto.h" + #include "pm.h" +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + + namespace OHOS { @@ -79,6 +94,14 @@ namespace OHOS } } + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST); + if (cnt == 1) { + uapi_pm_remove_sleep_veto(PM_ID_P_TEST); + } else { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_cat1 vote\r\n"); + } + + delete testBTScrollView; testBTScrollView=nullptr; } @@ -257,7 +280,26 @@ namespace OHOS RootView::GetInstance()->Invalidate(); return true; } - +// void uapi_cat1_remove_cat1_vote(void) +// { +// uint8_t cnt = pm_veto_get_id_cnt(PM_ID_CAT1); +// if (cnt == 1) { +// uapi_pm_remove_sleep_veto(PM_ID_CAT1); +// } else { +// // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has delete pm_id_cat1 vote\r\n"); +// } +// // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"\r\nCAT1 SERVICE MCU SLEEP SUCCESS\r\n"); +// } +// void uapi_cat1_add_cat1_vote(void) +// { +// uint8_t cnt = pm_veto_get_id_cnt(PM_ID_CAT1); +// if (cnt == 0) { +// uapi_pm_add_sleep_veto(PM_ID_CAT1); +// } else { +// // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_cat1 vote\r\n"); +// } +// // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"\r\nCAT1 SERVICE MCU WAKEUP SUCCESS\r\n"); +// } bool testBTView::testBTScrollViewcrollViewinit(void) { @@ -284,7 +326,7 @@ namespace OHOS .width = 400, .height = 44, .fontSize = 30, - .lineHeigh = 35, + .lineHeigh = 0, .text = "", .lineBreakMode = UILabel::LINE_BREAK_WRAP, }; @@ -292,7 +334,7 @@ namespace OHOS for(int i=0 ;i<5;i++) { - Config.top+=120; + Config.top+=180; label_BR_SCAN[i]= InitLabel(Config); testBTScrollView->Add(label_BR_SCAN[i]); } @@ -323,7 +365,7 @@ namespace OHOS - labelButton_next= testAboutView::GetInstance()->init_button_next(270,80,"buttonbutton_next"); + labelButton_next= testAboutView::GetInstance()->init_button_next(270,80,"SEChipTestbutton_next"); testBTScrollView->Add(labelButton_next); Title= testAboutView::GetInstance()->init_title(165,45,"BT_TEST"); @@ -343,6 +385,18 @@ namespace OHOS BR_TEST_timer = NULL; return false; } + + discovery_falg=false; + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_P_TEST); + if (cnt == 0) { + uapi_pm_add_sleep_veto(PM_ID_P_TEST); + } else { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"CAT1 SERVICE MCU has got pm_id_cat1 vote\r\n"); + } + + + + return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp index 6494868dd..f565b3b19 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp @@ -34,6 +34,7 @@ namespace OHOS if(testBUTTONScrollView) { testBUTTONScrollView->RemoveAll(); + testBUTTONScrollView->ClearFocus(); if(button[0]) { @@ -45,6 +46,11 @@ namespace OHOS delete button[1]; button[1]=nullptr; } + if(button[2]) + { + delete button[2]; + button[2]=nullptr; + } if(labelButton_next) { @@ -109,12 +115,12 @@ namespace OHOS if(falg==true) { button[0]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); - button[0]->SetText("UP_KEY::press"); + button[0]->SetText("UP_KEY::\npress"); } else { button[0]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); - button[0]->SetText("UP_KEY::raise"); + button[0]->SetText("UP_KEY::\nraise"); } @@ -125,12 +131,12 @@ namespace OHOS if(falg==true) { button[1]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); - button[1]->SetText("UP_KEY::press"); + button[1]->SetText("DOWN_KEY::\npress"); } else { button[1]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); - button[1]->SetText("UP_KEY::raise"); + button[1]->SetText("DOWN_KEY::\nraise"); } } @@ -141,6 +147,36 @@ namespace OHOS } + + void testbuttonView::Changbutton(bool falg) + { + if(falg) + { + button[2]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); + button[2]->SetText("crown::spin"); + + } + else + { + button[2]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); + button[2]->SetText("crown::raise"); + } + RootView::GetInstance()->Invalidate(); + + } + + void testbuttonView::Changbutton(int16_t falg) + { + char buf[8]={0}; + sprintf(buf,"%d",falg); + + label_crown->SetText(buf); + + RootView::GetInstance()->Invalidate(); + + } + + bool testbuttonView::testBUTTONScrollViewcrollViewinit(void) @@ -157,40 +193,79 @@ namespace OHOS testBUTTONScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); testBUTTONScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); testBUTTONScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); - + + /* -------------------------------------------------------------------------- */ + + if (label_crown == nullptr) { + label_crown = new UILabel(); + } + label_crown->SetPosition(321, 98); // widget's left position and top position + label_crown->Resize(200, 60); // widget's width and height + label_crown->SetViewId("label3");// Set style + label_crown->SetStyle(STYLE_TEXT_FONT, 50); + + // Set additional property + label_crown->SetText("0"); + label_crown->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + label_crown->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label_crown->SetRollSpeed(0); + label_crown->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 50); + testBUTTONScrollView->Add(label_crown); /* -------------------------------------------------------------------------- */ ButtonConfig_ext_t buttonconfig; - buttonconfig.x = 100; + buttonconfig.x = 80; buttonconfig.y = 100; - buttonconfig.w = 250; - buttonconfig.h = 116; + buttonconfig.w = 200; + buttonconfig.h = 80; buttonconfig.label_x=40; buttonconfig.label_y=0; - buttonconfig.Fontsize=30; + buttonconfig.Fontsize=25; buttonconfig.ViewId="UP_KEY::"; buttonconfig.str="UP_KEY"; buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; button[0]=SetTheButton_ext(buttonconfig); testBUTTONScrollView->Add(button[0]); - buttonconfig.x = 100; - buttonconfig.y = 300; - buttonconfig.w = 250; - buttonconfig.h = 116; + buttonconfig.x = 80; + buttonconfig.y = 200; + buttonconfig.w = 200; + buttonconfig.h = 80; buttonconfig.label_x=40; buttonconfig.label_y=0; - buttonconfig.Fontsize=30; + buttonconfig.Fontsize=25; buttonconfig.ViewId="DOWN_KEY::"; buttonconfig.str="DOWN_KEY"; buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; button[1]=SetTheButton_ext(buttonconfig); testBUTTONScrollView->Add(button[1]); + buttonconfig.x = 80; + buttonconfig.y = 300; + buttonconfig.w = 200; + buttonconfig.h = 80; + buttonconfig.label_x=40; + buttonconfig.label_y=0; + buttonconfig.Fontsize=25; + buttonconfig.ViewId="crown::"; + buttonconfig.str="crown::"; + buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + button[2]=SetTheButton_ext(buttonconfig); + testBUTTONScrollView->Add(button[2]); + + + RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::testPresenter::GetInstance(); RootView::GetInstance()->SetOnKeyActListener(keyactListener); + UIView::OnRotateListener *RotateListener = static_cast(testPresenter::GetInstance()); + testBUTTONScrollView->SetOnRotateListener(RotateListener); + // // 增加表冠控制 + testBUTTONScrollView->SetRotateFactor(2); + testBUTTONScrollView->RequestFocus(); + + // UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); // if (draglistener == nullptr) // { @@ -199,7 +274,7 @@ namespace OHOS // } // testcat1ScrollView->SetOnDragListener(draglistener); - labelButton_next= testAboutView::GetInstance()->init_button_next(267,220,"microphonebutton_next"); + labelButton_next= testAboutView::GetInstance()->init_button_next(300,220,"microphonebutton_next"); testBUTTONScrollView->Add(labelButton_next); Title= testAboutView::GetInstance()->init_title(165,45,"KEY_TEST"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp index 4b72fa42a..385c0dc28 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testgsenson.cpp @@ -215,7 +215,7 @@ namespace OHOS testGsonsonScrollView->Add(x); /* -------------------------------------------------------------------------- */ - labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"xxxx"); + labelButton_next= testAboutView::GetInstance()->init_button_next(167,378,"BTbutton_next"); testGsonsonScrollView->Add(labelButton_next); diff --git a/code/sdk/drivers/peripheral/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h index c274a3baa..9c2839660 100644 --- a/code/sdk/drivers/peripheral/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -1,6 +1,6 @@ #ifndef _CONFIG_MODEL_H_ #define _CONFIG_MODEL_H_ - +#include #include #include #include @@ -95,6 +95,10 @@ namespace OHOS CONFIGMODEL_ITEM_SEDENTARY_INTERVAL,//久坐提醒时间间隔(单位小时) CONFIGMODEL_ITEM_SEDENTARY_REMINDERTIME,//久坐提醒时间段 + //手表密码 + CONFIGMODEL_ITEM_PASSWORD, + CONFIGMODEL_ITEM_PASSWORD_SWITCH, + CONFIGMODEL_ITEM_SIM_ICCID,//SIM卡的ICCID CONFIGMODEL_ITEM_TELECOM_DMP_TIMESEC,//注册时间戳 @@ -309,7 +313,9 @@ namespace OHOS {ConfigDataType::DATATYPE_INT, "sleep_remide", "0" }, // CONFIGMODEL_ITEM_SLEEP_REMIND,//提前20分钟提醒开关 {ConfigDataType::DATATYPE_BOOL, "sedentary_switch", "false" }, // CONFIGMODEL_ITEM_SEDENTARY_SWITCH,//久坐提醒开关 {ConfigDataType::DATATYPE_INT, "sedentary_interval", "1" }, // CONFIGMODEL_ITEM_SEDENTARY_INTERVAL,//久坐提醒时间间隔 - {ConfigDataType::DATATYPE_INT, "sedentary_reminderTime", "0" }, // CONFIGMODEL_ITEM_SEDENTARY_REMINDERTIME,//久坐提醒时间段 前16位是开始时间 前8 为小时 后8为分钟 后16位为结束时间规则同前 例: 1600 0B00 11点开始到 22点结束 + {ConfigDataType::DATATYPE_INT, "sedentary_reminderTime", "0" }, // CONFIGMODEL_ITEM_SEDENTARY_REMINDERTIME,//久坐提醒时间段 前16位是开始时间 前8 为小时 后8为分钟 后16位为结束时间规则同前 例: 1600 0B00 11点开始到 22点结束 + {ConfigDataType::DATATYPE_STRING, "password", "000000" }, //CONFIGMODEL_ITEM_PASSWORD //手表密码 CONFIGMODEL_ITEM_SWITCH + {ConfigDataType::DATATYPE_INT, "passwordswich", "0" },//CONFIGMODEL_ITEM_PASSWORD_SWITCH 手表密码开关 0关 1开 {ConfigDataType::DATATYPE_STRING, "sim_iccid", "" },//CONFIGMODEL_ITEM_SIM_ICCID cat1的iccid {ConfigDataType::DATATYPE_STRING, "telecom_regist_timesec", "" },//CONFIGMODEL_ITEM_TELECOM_DMP_TIMESEC {ConfigDataType::DATATYPE_INT, "dmp_factory_status", "0" },//CONFIGMODEL_ITEM_DMP_FACTORY_STATUS默认是0 diff --git a/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h b/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h index f38b4b82b..fafe30770 100755 --- a/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h +++ b/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h @@ -45,6 +45,7 @@ typedef enum { PM_ID_MOTOR,//新增,马达 PM_ID_GSENSOR,//新增,加速计 PM_ID_CAT1,//Cat1 communication + PM_ID_P_TEST,//产测 PM_ID_MAX, } pm_id_t; diff --git a/code/sdk/middleware/chips/brandy/pm/pm.c b/code/sdk/middleware/chips/brandy/pm/pm.c index 55c841f22..8dbe186db 100755 --- a/code/sdk/middleware/chips/brandy/pm/pm.c +++ b/code/sdk/middleware/chips/brandy/pm/pm.c @@ -234,6 +234,7 @@ const char* pm_id_name_arr[] ={ "PM_ID_MOTOR",//新增,马达 "PM_ID_GSENSOR",//新增,加速计 "PM_ID_CAT1",//Cat1 communication + "PM_ID_P_TEST", "PM_ID_MAX" }; -- 2.17.1