From d320bc59ca372c6702c511db5ca52eed5ca58871 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 16 Mar 2024 13:00:40 +0800 Subject: [PATCH] =?utf8?q?=E4=BA=A7=E6=B5=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/fd230app/CMakeLists.txt | 16 + .../nativelauncher/include/AppViewIDs.h | 2 + .../nativelauncher/include/NativeLauncher.h | 2 + .../nativelauncher/src/NativeLauncher.cpp | 22 +- .../nativeui/alarm/include/AlarmClockModel.h | 2 + .../nativeui/alarm/src/AlarmClockModel.cpp | 45 +- .../nativeui/producttest/include/testLCD.h | 31 ++ .../nativeui/producttest/include/testModel.h | 20 + .../producttest/include/testPresenter.h | 71 +++ .../nativeui/producttest/include/testTP.h | 43 ++ .../nativeui/producttest/include/testView.h | 120 ++++ .../nativeui/producttest/include/testabout.h | 54 ++ .../nativeui/producttest/include/testbutton.h | 52 ++ .../nativeui/producttest/include/testcat1.h | 94 ++++ .../producttest/include/testchanging.h | 51 ++ .../producttest/include/testluminance.h | 38 ++ .../producttest/include/testmagnetic.h | 51 ++ .../producttest/include/testmakephone.h | 53 ++ .../nativeui/producttest/include/testmotor.h | 52 ++ .../nativeui/producttest/include/testspeak.h | 52 ++ .../nativeui/producttest/src/testLCD.cpp | 119 ++++ .../nativeui/producttest/src/testModel.cpp | 12 + .../producttest/src/testPresenter.cpp | 261 +++++++++ .../nativeui/producttest/src/testTP.cpp | 152 ++++++ .../nativeui/producttest/src/testView.cpp | 511 ++++++++++++++++++ .../nativeui/producttest/src/testabout.cpp | 372 +++++++++++++ .../nativeui/producttest/src/testbutton.cpp | 192 +++++++ .../nativeui/producttest/src/testcat1.cpp | 270 +++++++++ .../nativeui/producttest/src/testchanging.cpp | 147 +++++ .../producttest/src/testluminance.cpp | 105 ++++ .../nativeui/producttest/src/testmagnetic.cpp | 179 ++++++ .../producttest/src/testmakephone.cpp | 188 +++++++ .../nativeui/producttest/src/testmotor.cpp | 171 ++++++ .../nativeui/producttest/src/testspeak.cpp | 204 +++++++ .../nativeui/alarm/include/AlarmClockModel.h | 3 + .../service/msg_center/CMakeLists.txt | 4 + .../msg_center/src/msg_center_customer.cpp | 46 ++ .../slip/cat1Service/cat1_server.cpp | 15 +- .../slip/cat1Service/cat1_server_hal.cpp | 13 + .../slip/cat1Service/cat1_server_hal.h | 2 +- 40 files changed, 3830 insertions(+), 7 deletions(-) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testModel.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmagnetic.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmakephone.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testModel.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmakephone.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 66a9a9f4d..a511f9d76 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -45,6 +45,8 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/uisample/uitest/framework/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heart_blood/health_service/ + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/include + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include/AlipayList ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include/AlipayTrans @@ -398,6 +400,20 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneCallupPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/src/PhoneRingPresenter.cpp + + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testPresenter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testabout.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testLCD.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testTP.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testmagnetic.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testluminance.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testchanging.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testspeak.cpp + ${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 ) if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES) set(SOURCES diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h index 3696585a0..24278fc09 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h @@ -76,6 +76,8 @@ typedef enum : uint16_t VIEW_PHONECALLING, // 来电 VIEW_PHONECALLUP, // 通话界面 VIEW_PHONEDIR, // 电话簿 + + VIEW_TEST, //测试 /* -------------------------------------------------------------------------- */ #ifdef SUPPORT_ALIPAY_SEC VIEW_MAIN_ALIPAY, diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h index e70e7807c..cd218a5c2 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h @@ -67,6 +67,8 @@ namespace OHOS void InitPhoneCallupSlice(void); void InitPhoneRingSlice(void); + + void InittestSlice(void); private: void InitAllNativeSlices(void); diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index e3879fdd8..745ba60ef 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -129,6 +129,10 @@ #include "phone/include/PhoneRingView.h" #include "phone/include/PhoneRingPresenter.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testView.h" + + #ifdef SUPPORT_ALIPAY_SEC #include "AlipayMainView.h" #include "AlipayPresenter.h" @@ -187,6 +191,9 @@ namespace OHOS {VIEW_PHONECALLING, &NativeLauncher::InitPhoneCallingSlice}, {VIEW_PHONECALLUP, &NativeLauncher::InitPhoneCallupSlice}, {VIEW_PHONERING, &NativeLauncher::InitPhoneRingSlice}, + + {VIEW_TEST, &NativeLauncher::InittestSlice}, + #ifdef SUPPORT_ALIPAY_SEC {VIEW_MAIN_ALIPAY, &NativeLauncher::InitMainAlipaySlice}, #endif @@ -213,7 +220,9 @@ namespace OHOS {VIEW_CONNECT_PHONE, "ConnectPhoneView"}, {VIEW_PHONE, "phoneview"}, {VIEW_INDOORWALK, "IndoorWalkView"}, - {VIEW_SHUTDOWN_OR_REBOOT, "RebootView"}}; + {VIEW_SHUTDOWN_OR_REBOOT, "RebootView"}, + {VIEW_TEST, "testView"} + }; NativeLauncher::NativeLauncher() {} NativeLauncher::~NativeLauncher() {} @@ -743,5 +752,16 @@ void NativeLauncher::InitPhoneRingSlice(void) NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONERING, phoneringview); } +void NativeLauncher::InittestSlice(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitestSlice"); + SliceProxy *testview = new AbilitySliceProxy; + if (testview == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneringview"); + return; + } + NativeAbility::GetInstance().AddSliceProxy(VIEW_TEST, testview); +} } diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h index 074df441b..09e6a9a83 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/include/AlarmClockModel.h @@ -115,7 +115,9 @@ public: void AlarmGetClockNum(void); int AlarmPlayerStat(); int AlarmPlayerInit(void); + int AlarmPlayerInit_BY_fir_name(char *); int AlarmPlayerStart(); + int testPlayerStart(char *); int AlarmPlayerStop(); private: void SetAlarmId(uint8_t id); diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index 47df62321..32eb5323b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -758,12 +758,12 @@ int AlarmClockModel::AlarmPlayerInit(void) { // 本地播放文件路径和状态 sliceId = (char *)"alarm.mp3"; // 播放音乐的文件名 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerInit start!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit start!"); std::string strSongName = sliceId; std::string pureName = strSongName.substr(0, strSongName.rfind(".")); // 播放音乐的路径需要引用.号 const char *songName = pureName.c_str(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerInit, url:%s ", sliceId); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit, url:%s ", sliceId); std::string strSrcMusic(APP_MUSIC_PATH); std::string tempStr("/"); std::string strName = sliceId; @@ -780,7 +780,38 @@ int AlarmClockModel::AlarmPlayerInit(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playerCallback new fail"); return OHOS_FAILURE; } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerInit end!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit end!"); + return OHOS_SUCCESS; +} + + +int AlarmClockModel::AlarmPlayerInit_BY_fir_name(char *str) +{ + // 本地播放文件路径和状态 + sliceId = str; // 播放音乐的文件名 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit start!"); + + std::string strSongName = sliceId; + std::string pureName = strSongName.substr(0, strSongName.rfind(".")); // 播放音乐的路径需要引用.号 + const char *songName = pureName.c_str(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit, url:%s ", sliceId); + std::string strSrcMusic(APP_MUSIC_PATH); + std::string tempStr("/"); + std::string strName = sliceId; + uri =strName; + // 创建 AM + + playerCtr = std::make_shared(); + if (playerCtr.get() == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playerCtr new fail"); + return OHOS_FAILURE; + } + playerCallback = std::make_shared(); + if (playerCallback.get() == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playerCallback new fail"); + return OHOS_FAILURE; + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit end!"); return OHOS_SUCCESS; } @@ -810,6 +841,14 @@ int AlarmClockModel::AlarmPlayerStart(void) return OHOS_SUCCESS; } + +int AlarmClockModel::testPlayerStart(char *str) +{ + AlarmPlayerInit_BY_fir_name(str); + AlarmPlayerStat(); + return OHOS_SUCCESS; +} + void AlarmPlayerCallbackImpl::OnPlaybackComplete() { GraphicService::GetInstance()->PostGraphicEvent( diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h new file mode 100644 index 000000000..1f8f77953 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testLCD.h @@ -0,0 +1,31 @@ +#ifndef TEST_LCD_VIEW_H +#define TEST_LCD_VIEW_H + +#include "BaseView.h" +#include "View.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label.h" +#include "components/ui_image_view.h" +#include "producttest/include/testLCD.h" +//#include "cmsis_os.h" +#include +namespace OHOS +{ + class testLCDView + { + + public: + testLCDView(); + virtual ~testLCDView(); + static testLCDView *GetInstance(void); + + UIScrollView *testLCDInitIView(void); + void ClearAll(void); + void set_LCD_color(); + private: + bool testLCDScrollViewcrollViewinit(void); + UIScrollView *testLCDScrollView{nullptr}; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testModel.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testModel.h new file mode 100644 index 000000000..4c9de3567 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testModel.h @@ -0,0 +1,20 @@ +#ifndef TEST_MODEL_H +#define TEST_MODEL_H + +namespace OHOS +{ + class testModel + { + public: + static testModel *GetInstance(void); + + private: + testModel() = default; + ~testModel(){} + testModel(const testModel &) = delete; + testModel &operator=(const testModel &) = delete; + + }; +} + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h new file mode 100644 index 000000000..994e54606 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testPresenter.h @@ -0,0 +1,71 @@ + +#ifndef TEST_PRESENTER_H +#define TEST_PRESENTER_H + +#include "Presenter.h" +#include "testView.h" +#include "testTP.h" +#include "producttest/include/testluminance.h" +#include "producttest/include/testspeak.h" +#include "producttest/include/testModel.h" +#include "components/ui_radio_button.h" +#include "producttest/include/testmotor.h" +#include "producttest/include/testbutton.h" +#include "producttest/include/testmakephone.h" +#include "producttest/include/testcat1.h" +#include "common/key_code.h" +namespace OHOS +{ + typedef enum + { + TESTVIEW = 0, // 系统视图(slice) + VISON, + LCD, + TP, + MAGETIC, + LUMINANCE, + CHAR, + SPEAK, + MOTOR, + CAT1, + BUTTON, + MAKEPHONE, + TEST_1, + + MAX_TESTVIEWID, + } TEST_VIEW; + + + class testView; + class testPresenter : public Presenter, + public UIView::OnClickListener, + public UIView::OnDragListener, + public UIView::OnTouchListener, + public RootView::OnKeyActListener + + { + public: + testPresenter(); + virtual ~testPresenter(); + + void OnStart() override; + + void OnResume() override; + void OnStop() override; + + static testPresenter *GetInstance(); + + private: + // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; + bool OnClick(UIView &view, const ClickEvent &event) override; + bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView &view, const DragEvent &event) override; + bool OnPress(UIView &view, const PressEvent &event); + bool OnKeyAct(UIView &view, const KeyEvent &event); + //bool OnChange(int) override; + private: + testModel *systemModel; + }; +} // namespace OHOS + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h new file mode 100644 index 000000000..f6d26d67a --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testTP.h @@ -0,0 +1,43 @@ +#ifndef TEST_TP_VIEW_H +#define TEST_TP_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 "producttest/include/testTP.h" +#include "producttest/include/testPresenter.h" +//#include "cmsis_os.h" +#include +namespace OHOS +{ + class testTPView + { + + public: + struct ButtonConfig_ext_t + { + int x; + int y; + int w; + int h; + const char *ViewId; + }; + + testTPView(); + virtual ~testTPView(); + static testTPView *GetInstance(void); + void ChangeViewcolor(int,int); + + UIScrollView *testTPInitIView(void); + void ClearAll(void); + private: + UIButton *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnTouchListener *clickListener); + bool testTPScrollViewcrollViewinit(void); + UIScrollView *testTPScrollView{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 new file mode 100644 index 000000000..78242fe8c --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testView.h @@ -0,0 +1,120 @@ +#ifndef TEST_VIEW_H +#define TEST_VIEW_H + +#include "BaseView.h" +#include "View.h" + +#include "components/ui_view_group.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label.h" +#include "components/ui_image_view.h" +#include "components/ui_button.h" +#include "components/ui_label_button_ext.h" + +#include "producttest/include/testabout.h" +#include "producttest/include/testLCD.h" +#include "producttest/include/testTP.h" +#include "producttest/include/testluminance.h" +#include "producttest/include/testchanging.h" +#include "producttest/include/testspeak.h" +#include "producttest/include/testmotor.h" +#include "producttest/include/testbutton.h" +#include "producttest/include/testmagnetic.h" +#include "producttest/include/testmakephone.h" +#include "producttest/include/testcat1.h" + +namespace OHOS +{ + + class testPresenter; + class testView : public View + { + + public: + testView(); + virtual ~testView(); + static testView *GetInstance(void); + + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; + struct ButtonConfig + { + int x; + int y; + int w; + int h; + const char *ViewId; + const char *ImageSrc; + }; + 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; + + }; + + bool ChangeSystemView(int16_t thisView); + bool ChangeSystemAboutView(int16_t thisView); + bool ChangeLCDTESTView(int16_t thisView); + bool ChangeTPTESTView(int16_t thisView); + bool ChangLUMTESTView(int16_t thisView); + bool ChangchargingTESTView(int16_t thisView); + bool ChangspeakTESTView(int16_t thisView); + bool ChangmotorTESTView(int16_t thisView); + bool ChangKEYTESTView(int16_t thisView); + bool ChangeMGTESTView(int16_t thisView); + bool ChangeMPTESTView(int16_t thisView); + + bool ChangeCAT1TESTView(int16_t thisView); + bool ClickFunc(int16_t interface); + void ChangeView(int16_t hideView, int16_t showView); + UIScrollView *GetSystemScrollView(int ViewId); + + private: + void InitIView(void); + void initView_ext(int x,int y,int w,int h,int interval,const char *imagsrc); + void ClearAll(void); + bool SetTheSystemScrollView(void); + bool SetTheTitle(void); + UIButton *SetTheButton(ButtonConfig &buttonconfig, UIView::OnClickListener *clickListener); + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &ButtonConfig_ext, UIView::OnClickListener *clickListener); + + testAboutView *test_about_view; + UIScrollView *SystemScrollView[20]{nullptr}; + UILabel *SystemLabel{nullptr}; // 标题 + UIButton *AboutTheWatchButton{nullptr}; + UIButton *SuperviseButton = {nullptr}; + UIButton *SystemLanguageButton = {nullptr}; + UIButton *FactoryResetButton{nullptr}; + UILabelButtonExt *SystemUpgradeButtonExt{nullptr}; + + testLCDView *test_LCD_view{nullptr}; + testTPView *test_TP_view{nullptr}; + testLUMView *test_lum_view{nullptr}; + testCHANINGView *test_charging_view{nullptr}; + testSPEAKView *test_speak_view{nullptr}; + testMOTORView *test_motor_view{nullptr}; + testcat1View *test_cat1_view{nullptr}; + testbuttonView *test_KEY_view{nullptr}; + testMagicView *test_MG_view{nullptr}; + + testmakephoneView *test_MP_view{nullptr}; + + bool initViewStatus{false}; + }; +} // namespace OHOS + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h new file mode 100644 index 000000000..868b248b8 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testabout.h @@ -0,0 +1,54 @@ +#ifndef TEST_ABOUT_VIEW_H +#define TEST_ABOUT_VIEW_H + +#include "BaseView.h" +#include "View.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label.h" +#include "components/ui_image_view.h" +#include "producttest/include/testabout.h" +#include +namespace OHOS +{ + class testAboutView + { + + public: + testAboutView(); + virtual ~testAboutView(); + static testAboutView *GetInstance(void); + 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; // 断行模式。 + }; + UIScrollView *SystemAbouTheWatchtInitIView(void); + void ClearAll(void); + UILabel *InitLabel(LabelConfig &labelConfig); + + private: + bool testAboutTheWatchScrollViewinit(void); + UIScrollView *testAboutTheWatchScrollView{nullptr}; + UILabel *SystemAboutTheWatchTitle{nullptr}; // “关于” + UILabel *WatchNameTitle{nullptr}; // “手表名称” + UILabel *WatchName{nullptr}; + UILabel *FirmwareVersionTitle{nullptr}; // "固件版本" + UILabel *FirmwareVersion{nullptr}; + UILabel *AlgorithmVersionTitle{nullptr}; // “算法版本” + UILabel *AlgorithmVersion{nullptr}; + UILabel *BluetoothAddressTitle{nullptr}; // “蓝牙地址” + UILabel *BluetoothAddress{nullptr}; + UILabel *LANAddressTitle{nullptr}; // “局域网地址” + UILabel *LANAddress = nullptr; + UILabel *FONTTitle = nullptr; + UILabel *FONT = nullptr; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h new file mode 100644 index 000000000..84cca2e10 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testbutton.h @@ -0,0 +1,52 @@ +#ifndef TEST_BUTTON_VIEW_H +#define TEST_BUTTON_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 "producttest/include/testPresenter.h" +//#include "cmsis_os.h" +#include +namespace OHOS +{ + class testbuttonView + { + + 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; + + }; + + testbuttonView(); + virtual ~testbuttonView(); + static testbuttonView *GetInstance(void); + void Changbutton(int,bool); + + UIScrollView *testBUTTONInitIView(void); + void ClearAll(void); + private: + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); + bool testBUTTONScrollViewcrollViewinit(void); + UIScrollView *testBUTTONScrollView{nullptr}; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h new file mode 100644 index 000000000..e840bb11f --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testcat1.h @@ -0,0 +1,94 @@ +#ifndef TEST_CAT1_VIEW_H +#define TEST_CAT1_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 +namespace OHOS +{ + + class testcat1View + { + + 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; + }; + + + + + testcat1View(); + virtual ~testcat1View(); + static testcat1View *GetInstance(void); + void dial_112(bool); + + UIScrollView *testcat1InitIView(void); + void ClearAll(void); + void setcat1msg(cat1_msg); + void setcat1vermsg(cat1_Ver); + private: + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); + UILabel *InitLabel(LabelConfig &labelConfig); + bool tesScat1ScrollViewcrollViewinit(void); + UIScrollView *testcat1ScrollView{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}; + + UILabel *label_1_cat1vison{nullptr}; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h new file mode 100644 index 000000000..16c6d9864 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testchanging.h @@ -0,0 +1,51 @@ +#ifndef TEST_CHANGING_VIEW_H +#define TEST_CHANGING_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 +namespace OHOS +{ + class testCHANINGView + { + + 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; + + }; + + testCHANINGView(); + virtual ~testCHANINGView(); + static testCHANINGView *GetInstance(void); + void ChangeViewcolor(bool); + + UIScrollView *testCHANINGInitIView(void); + void ClearAll(void); + private: + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); + bool testCHANINGScrollViewcrollViewinit(void); + UIScrollView *testCHANINGScrollView{nullptr}; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h new file mode 100644 index 000000000..554953a2b --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testluminance.h @@ -0,0 +1,38 @@ +#ifndef TEST_LUMINANCE_VIEW_H +#define TEST_LUMINANCE_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 "producttest/include/testTP.h" +#include "producttest/include/testPresenter.h" +#include "components/ui_slider.h" +//#include "cmsis_os.h" +#include +namespace OHOS +{ + class testLUMView + { + + public: + + testLUMView(); + virtual ~testLUMView(); + static testLUMView *GetInstance(void); + int get_slider_value() + { + return BrightnessControlViewSlider->GetValue(); + } + UIScrollView *testLUMInitIView(void); + void ClearAll(void); + private: + bool testLUMScrollViewcrollViewinit(void); + UIScrollView *testLUMScrollView{nullptr}; + bool initViewStatus{false}; + UISlider *BrightnessControlViewSlider = nullptr; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmagnetic.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmagnetic.h new file mode 100644 index 000000000..7188c9350 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmagnetic.h @@ -0,0 +1,51 @@ +#ifndef TEST_MG_VIEW_H +#define TEST_MG_VIEW_H + +#include "BaseView.h" +#include "View.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label.h" +#include "components/ui_image_view.h" +#include "producttest/include/testmagnetic.h" +#include "CompassModel.h" +//#include "cmsis_os.h" +#include + +namespace OHOS +{ + class testMagicView + { + + public: + + 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; // 断行模式。 + }; + + testMagicView(); + virtual ~testMagicView(); + static testMagicView *GetInstance(void); + + UIScrollView *testmagicInitIView(void); + void ClearAll(void); + void set_data(); + private: + bool testmagicScrollViewcrollViewinit(void); + UILabel *InitLabel(LabelConfig &labelConfig); + UIScrollView *testmagicScrollView{nullptr}; + bool initViewStatus{false}; + UILabel *title{nullptr}; // “关于” + UILabel *x{nullptr}; // “手表名称” + UILabel *y{nullptr}; + UILabel *z{nullptr}; // "固件版本" + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmakephone.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmakephone.h new file mode 100644 index 000000000..707385e3c --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmakephone.h @@ -0,0 +1,53 @@ +#ifndef TEST_MAKPHONE_VIEW_H +#define TEST_MAKPHONE_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 "producttest/include/testPresenter.h" +#include "record/include/RecordingModel.h" +//#include "cmsis_os.h" +#include +namespace OHOS +{ + class testmakephoneView + { + + 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; + + }; + + testmakephoneView(); + virtual ~testmakephoneView(); + static testmakephoneView *GetInstance(void); + void buttoncallback(); + + UIScrollView *testmakephoneInitIView(void); + void ClearAll(void); + private: + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); + bool testphoneScrollViewcrollViewinit(void); + UIScrollView *testmakephoneScrollView{nullptr}; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h new file mode 100644 index 000000000..f1699035a --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmotor.h @@ -0,0 +1,52 @@ +#ifndef TEST_MOTOR_VIEW_H +#define TEST_MOTOR_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 "producttest/include/testPresenter.h" +//#include "cmsis_os.h" +#include +namespace OHOS +{ + class testMOTORView + { + + 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; + + }; + + testMOTORView(); + virtual ~testMOTORView(); + static testMOTORView *GetInstance(void); + void Changstatr(bool); + + UIScrollView *testMOTORInitIView(void); + void ClearAll(void); + private: + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); + bool testMOTORScrollViewcrollViewinit(void); + UIScrollView *tesMOTORScrollView{nullptr}; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h new file mode 100644 index 000000000..e31decfbb --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testspeak.h @@ -0,0 +1,52 @@ +#ifndef TEST_SPEAK_VIEW_H +#define TEST_SPEAK_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 "producttest/include/testPresenter.h" +//#include "cmsis_os.h" +#include +namespace OHOS +{ + class testSPEAKView + { + + 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; + + }; + + testSPEAKView(); + virtual ~testSPEAKView(); + static testSPEAKView *GetInstance(void); + void Changspeak(bool); + + UIScrollView *testSPEAKInitIView(void); + void ClearAll(void); + private: + UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &buttonconfig);//, UIView::OnTouchListener *clickListener); + bool tesSPEAKScrollViewcrollViewinit(void); + UIScrollView *testSOEAKScrollView{nullptr}; + bool initViewStatus{false}; + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp new file mode 100644 index 000000000..e4fe65fc7 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp @@ -0,0 +1,119 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testLCD.h" + +#include "cmsis_os2.h" + +namespace OHOS +{ + + static testLCDView *g_pSystemAboutTheWatchView{nullptr}; + + testLCDView::testLCDView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testLCDView::~testLCDView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testLCDView *testLCDView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testLCDView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + void colorTimerCallBack(int data) + { + testLCDView::GetInstance()->set_LCD_color(); + } + uint8_t LCD_TEST_FALG=0; + void testLCDView :: set_LCD_color(void) + { + switch (LCD_TEST_FALG) + { + case 0: + testLCDScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); + break; + case 1: + testLCDScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); + break; + case 3: + testLCDScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Yellow().full); + break; + default: + break; + } + RootView::GetInstance()->Invalidate(); + LCD_TEST_FALG++; + + } + + static osTimerId_t MG_TEST_timer=NULL; + bool testLCDView::testLCDScrollViewcrollViewinit(void) + { + uint32_t tick; + osStatus_t retTimer; + + testLCDScrollView = new UIScrollView(); + if (testLCDScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testLCDScrollView new fail!"); + return false; + } + testLCDScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testLCDScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testLCDScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294); + + testLCDScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + LCD_TEST_FALG=0; + + MG_TEST_timer = osTimerNew((osTimerFunc_t)colorTimerCallBack, osTimerPeriodic, NULL, NULL); + tick =1000;// osMs2Tick(1000); + retTimer = osTimerStart(MG_TEST_timer, tick); + if (retTimer != osOK && MG_TEST_timer != NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); + osTimerDelete(MG_TEST_timer); + MG_TEST_timer = NULL; + return false; + } + + testLCDScrollView->SetScrollBlankSize(35); + testLCDScrollView->SetReboundSize(50); + testLCDScrollView->SetDirection(1); + //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); + // if (draglistener == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + // return false; + // } + // testLCDScrollView->SetOnDragListener(draglistener); + testLCDScrollView->SetTouchable(true); + testLCDScrollView->SetDraggable(false); + + + return true; + } + + UIScrollView *testLCDView::testLCDInitIView() + { + if (!testLCDScrollViewcrollViewinit()) + { + return nullptr; + } + return testLCDScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testModel.cpp new file mode 100644 index 000000000..c653ac12c --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testModel.cpp @@ -0,0 +1,12 @@ +#include "producttest/include/testModel.h" + +namespace OHOS +{ + + testModel *testModel::GetInstance(void) + { + static testModel instance; + return &instance; + } + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp new file mode 100644 index 000000000..b69ead38c --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testPresenter.cpp @@ -0,0 +1,261 @@ +#include "AppViewIDs.h" +#include "NativeAbility.h" +#include "graphic_math.h" +#include "string.h" +#include "producttest/include/testPresenter.h" +#include "font/font_global_manager.h" +#include "font/ui_font.h" +#include "language/LanguageInit.h" +#include "../../../../../../drivers/peripheral/utils/custom_utils.h" +#include "power_display_service.h" +#include "components/ui_slider.h" + +#include "audio_capture_wrapper.h" +namespace OHOS +{ + + + + static char* view_id_str[]= + { + "TP_1", "TP_2", "TP_3", "TP_4", + "TP_5", "TP_6", "TP_7", "TP_8", + "TP_9","TP_10", "TP_11", "TP_12", + "TP_13","TP_14", "TP_15", "TP_16", + }; + + struct TEST_ext_p + { + const int16_t viewId; + char *viewid_str; + bool enable_falg; + }; + + + // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与MainStopWatchView类中的特定成员函数指针进行了绑定。 + static TEST_ext_p ViewMapper_t[] = + { + {VISON,"AboutTheWatchButton",true}, + {LCD,"SuperviseButton",true}, + {TP,"SystemLanguageButton",true}, + {MAGETIC,"MAGETICButton",true}, + {LUMINANCE,"luminanceButton",true}, + {CHAR,"chargingButton",true}, + {SPEAK,"speakButton",true}, + {MOTOR,"motorButton",true}, + {CAT1,"cat1button",true}, + {BUTTON,"buttonbutton",true}, + {MAKEPHONE,"makephonebutton",true}, + + }; + // {FACTORYRESETVIEW,"FactoryResetButton",true}, + // {SYSTEMLUPGRADE,"systemupgread",true}, + // {TEST,"testButton",true}}; + + // {ABOUTTHEWATCHVIEW, &SystemView::ChangeSystemAboutView}, + // {SUPERVISEVIEW, &SystemView::ChangeSystemSuperviseView}, + // {SYSTEMLANGUAGEVIEW, &SystemView::ChangeSystemLanguageView}, + + // 当前Presenter属性实例化的内存指针 + static testPresenter *g_pSystemPresenter = nullptr; + + testPresenter::testPresenter() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::SystemPresenter"); + g_pSystemPresenter = this; + //systemModel = testModel::GetInstance(); + } + + testPresenter::~testPresenter() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::~SystemPresenter"); + g_pSystemPresenter = nullptr; + } + + testPresenter *testPresenter::GetInstance() + { + + return g_pSystemPresenter; + } + + void testPresenter::OnStart() + { + + Presenter::OnStart(); + } + + bool testPresenter::OnPress(UIView &view, const PressEvent &event) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::"); + // for(int i=0;i<16;i++) + // // { + // // if(strcmp(view.GetViewId(),view_id_str[i]) == 0) + // // { + // // testTPView::GetInstance()->ChangeViewcolor(i); + + // // } + // } + return true; + + } + + void testPresenter::OnResume(void) + { + + Presenter::OnResume(); + } + + void testPresenter::OnStop(void) + { + + Presenter::OnStop(); + } + + bool testPresenter::OnDrag(UIView &view, const DragEvent &event) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::"); + if(strcmp(view.GetViewId(),"BrightnessControl") == 0 || strcmp(view.GetViewId(),"Brightnesview") == 0 ) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxx::"); + uint8_t value= testLUMView::GetInstance()->get_slider_value(); + + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + + if (display_api->set_brightness(value) != ERRCODE_SUCC) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChangeBrightness: set_brightness fail!"); + return false; + } + + } + + + if(strcmp(view.GetViewId(),"TP_test") == 0) + { + testTPView::GetInstance()->ChangeViewcolor(event.GetLastPoint().x,event.GetLastPoint().y); + + } + return true; + } + + bool testPresenter::OnDragEnd(UIView &view, const DragEvent &event) + { + testView *p_SystemView = testView::GetInstance(); + + if(strcmp(view.GetViewId(),"TP_test") == 0 || strcmp(view.GetViewId(),"BrightnessControl") == 0) + { + return true; + } + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) + { + for (int i = 1; i < MAX_TESTVIEWID; i++) + { + if (p_SystemView->GetSystemScrollView(i) != nullptr && p_SystemView->GetSystemScrollView(i)->IsVisible() == true) + { + p_SystemView->ChangeView(i, TESTVIEW); + break; + } + } + return true; + } + return false; + } + + // 该点击回调主要用于在系统视图界面进行跳转视图 + bool testPresenter::OnClick(UIView &view, const ClickEvent &event) + { + testView *p_SystemView = testView::GetInstance(); + int len=sizeof(ViewMapper_t)/sizeof(TEST_ext_p); + //int len=5; + // 根据控件id查找是哪个控件触发了点击回调 + + for(int i=0;iChangeView(TESTVIEW, ViewMapper_t[i].viewId); + return true; + } + } + + if(strcmp(view.GetViewId(),"speak_play") == 0) + { + testSPEAKView::GetInstance()->Changspeak(true); + } + else if (strcmp(view.GetViewId(),"speak_puase") == 0) + { + testSPEAKView::GetInstance()->Changspeak(false); + } + + if(strcmp(view.GetViewId(),"MOTOR_play") == 0) + { + testMOTORView::GetInstance()->Changstatr(true); + } + + if(strcmp(view.GetViewId(),"testmakephoneView") == 0) + { + testmakephoneView::GetInstance()->buttoncallback(); + } + + if(strcmp(view.GetViewId(),"dial_112") == 0) + { + testcat1View::GetInstance()->dial_112(true); + } + + + + return false; + } + + bool testPresenter::OnKeyAct(UIView &view, const KeyEvent &event) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnKeyAct"); + uint8_t keyID = event.GetKeyId(); + uint8_t keystate=event.GetState(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ":xxxxxxx:%d",keyID); + // 如果是power键就返回上一级 + if (keyID == 41 ) + { + if(keystate) + testbuttonView::GetInstance()-> Changbutton(0,true); + else + testbuttonView::GetInstance()-> Changbutton(0,false); + + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + } + if (keyID == 0) + { + if(keystate) + testbuttonView::GetInstance()-> Changbutton(1,true); + else + testbuttonView::GetInstance()-> Changbutton(1,false); + + + // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + } + return true; + } + + // 该拖拽是用来处理系统视图(slice)的左滑退出事件和子视图的左滑退出到系统视图区分开 + + + /// @brief 简体中文单选按钮被选中 + /// @param void + /// @return true 表示选中 ,false 表示未选中 + + + /// @brief 英语单选按钮被选中 + /// @param void + /// @return true 表示选中 ,false 表示未选中 + + + /* -------------------------------------------------------------------------- */ + // 获取语言类 + //language *g_planguage = new language; + /* -------------------------------------------------------------------------- */ + // 用来监听语言切换 + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp new file mode 100644 index 000000000..360eb6041 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testTP.cpp @@ -0,0 +1,152 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testTP.h" + +#include "cmsis_os2.h" + +namespace OHOS +{ + + static testTPView *g_pSystemAboutTheWatchView{nullptr}; + + testTPView::testTPView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testTPView::~testTPView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testTPView *testTPView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testTPView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + UIButton *testTPView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnTouchListener *clickListener) + { + 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, 0xff191919); + 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->SetOnTouchListener(clickListener); + + // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); + // button->SetOnDragListener(drgListener); + + // button->SetDraggable(false); + return button; + } + + + + static UIButton* button[16]={NULL}; + char* viewid_str[]= + { + "TP_1", "TP_2", "TP_3", "TP_4", + "TP_5", "TP_6", "TP_7", "TP_8", + "TP_9","TP_10", "TP_11", "TP_12", + "TP_13","TP_14", "TP_15", "TP_16", + }; + + void testTPView::ChangeViewcolor(int x,int y) + { + for(int i=0;i<4;i++) + { + for(int j=0;j<4;j++) + { + if(x>116*j && x<116*(j+1) && y >116*i && y<116*(i+1)) + { + button[i*4+j]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Green().full); + RootView::GetInstance()->Invalidate(); + + } + } + } + } + + bool testTPView::testTPScrollViewcrollViewinit(void) + { + + testTPScrollView = new UIScrollView(); + if (testTPScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testTPScrollView new fail!"); + return false; + } + testTPScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testTPScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + //testTPScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + testTPScrollView->SetViewId("TP_test"); + testTPScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testTPScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Black().full); + + + UIView::OnTouchListener *touchListener = static_cast(testPresenter::GetInstance()); + /* -------------------------------------------------------------------------- */ + ButtonConfig_ext_t buttonconfig; + buttonconfig.x = 0; + buttonconfig.y = 0; + buttonconfig.w = 116; + buttonconfig.h = 116; + for (int i = 0; i < 4; i++) + { + for(int j=0;j<4;j++) + { + + buttonconfig.ViewId = viewid_str[i*4+j]; + buttonconfig.x=116*j; + button[i*4+j] = SetTheButton_ext(buttonconfig, touchListener); + testTPScrollView->Add(button[i*4+j]); + } + buttonconfig.y+=116; + } + + + + + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testTPScrollView->SetOnDragListener(draglistener); + testTPScrollView->SetTouchable(true); + testTPScrollView->SetDraggable(true); + + + return true; + } + + UIScrollView *testTPView::testTPInitIView() + { + if (!testTPScrollViewcrollViewinit()) + { + return nullptr; + } + return testTPScrollView; + } +} \ 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 new file mode 100644 index 000000000..adcd71960 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testView.cpp @@ -0,0 +1,511 @@ +#include "producttest/include/testView.h" +#include "producttest/include/testPresenter.h" + +#include "wearable_log.h" +namespace OHOS +{ + + static testView *g_pSystemView{nullptr}; + + struct test_ext + { + const int16_t viewId; + char *viewid_str; + char *Labe_str; + bool (testView::*func)(int16_t thisView); + }; + static UILabelButtonExt *button[10]={NULL}; + + + // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与MainStopWatchView类中的特定成员函数指针进行了绑定。 + static test_ext ViewMapper_t[] = { + {VISON,"AboutTheWatchButton","Verison",&testView::ChangeSystemAboutView}, + {LCD,"SuperviseButton","LCD",&testView::ChangeLCDTESTView}, + {TP,"SystemLanguageButton","TP", &testView::ChangeTPTESTView}, + {MAGETIC,"MAGETICButton","Magetic", &testView::ChangeMGTESTView}, + {LUMINANCE,"luminanceButton","luminance", &testView::ChangLUMTESTView}, + {CHAR,"chargingButton","charging", &testView::ChangchargingTESTView}, + {SPEAK,"speakButton","speak", &testView::ChangspeakTESTView}, + {MOTOR,"motorButton","motor", &testView::ChangmotorTESTView}, + {CAT1,"cat1button","CAT1", &testView::ChangeCAT1TESTView}, + {BUTTON,"buttonbutton","button" ,&testView::ChangKEYTESTView}, + {MAKEPHONE,"makephonebutton","makephone" ,&testView::ChangeMPTESTView}, + // {FACTORYRESETVIEW,"FactoryResetButton","恢复出厂", &testView::ChangeSystemAboutView}, + // {SYSTEMLUPGRADE,"systemupgread","系统升级",&testView::ChangeSystemAboutView}, + // {TEST,"testButton","测试模式", &testView::ChangeSystemAboutView}, + + // {ABOUTTHEWATCHVIEW, &SystemView::ChangeSystemAboutView}, + // {SUPERVISEVIEW, &SystemView::ChangeSystemSuperviseView}, + // {SYSTEMLANGUAGEVIEW, &SystemView::ChangeSystemLanguageView}, + // {FACTORYRESETVIEW, &SystemView::ChangeSystemFactoryResetView}, + }; + + testView::testView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemView"); + g_pSystemView = this; + } + + testView::~testView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::~SystemView"); + ClearAll(); + g_pSystemView = nullptr; + } + + testView *testView::GetInstance() + { + return g_pSystemView; + } + + void testView::ClearAll() + { + if (initViewStatus == true) + { + // SystemScrollView[SYSTEMVIEW]->RemoveAll(); + // UIView::OnDragListener *draglistener = SystemScrollView[SYSTEMVIEW]->GetOnDragListener(); + // if (draglistener != nullptr) + // { + // delete draglistener; + // draglistener = nullptr; + // } + // delete p_SystemAboutTheWatchView; + // p_SystemAboutTheWatchView = nullptr; + // delete p_SystemSuperviseView; + // p_SystemSuperviseView = nullptr; + // delete p_SystemLanguageView; + // p_SystemLanguageView = nullptr; + // delete p_SystemFactoryResetView; + // p_SystemFactoryResetView = nullptr; + // delete SystemLabel; + // SystemLabel = nullptr; + // delete AboutTheWatchButton; + // AboutTheWatchButton = nullptr; + // delete SuperviseButton; + // SuperviseButton = nullptr; + // delete SystemLanguageButton; + // SystemLanguageButton = nullptr; + // delete FactoryResetButton; + // FactoryResetButton = nullptr; + + // delete SystemScrollView[SYSTEMVIEW]; + // SystemScrollView[SYSTEMVIEW] = nullptr; + } + } + + /// @brief 设置SystemScrollView + /// @param void + /// @return true 设置成功,false 失败 + bool testView::SetTheSystemScrollView(void) + { + SystemScrollView[TESTVIEW] = new UIScrollView(); + if (SystemScrollView[TESTVIEW] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemScrollView new fail!"); + return false; + } + SystemScrollView[TESTVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + SystemScrollView[TESTVIEW]->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + SystemScrollView[TESTVIEW]->SetScrollBlankSize(35); + SystemScrollView[TESTVIEW]->SetReboundSize(50); + SystemScrollView[TESTVIEW]->SetDirection(1); + //UIView::OnDragListener *draglistener = static_cast(new SystemViewOnDragListener()); + // if (draglistener == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + // return false; + // } + //SystemScrollView[TESTVIEW]->SetOnDragListener(draglistener); + SystemScrollView[TESTVIEW]->SetTouchable(true); + SystemScrollView[TESTVIEW]->SetDraggable(true); + return true; + } + + /// @brief 设置标题 + /// @param void + /// @return true 设置成功,false 失败 + bool testView::SetTheTitle(void) + { + SystemLabel = new UILabel(); + if (SystemLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLabel new fail!"); + return false; + } + SystemLabel->SetPosition(203, 52); + SystemLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + SystemLabel->SetStyle(STYLE_TEXT_FONT, 30); + SystemLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + SystemLabel->SetText("GNT TEST"); + SystemLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + SystemLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + SystemLabel->SetRollSpeed(6); + SystemLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + return true; + } + + /// @brief 设置按钮 + /// @param button + /// @return true 设置成功,false 失败 + + UILabelButtonExt *testView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener) + { + 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, 0xff191919); + button->SetImageSrc(buttonconfig.ImageSrc, buttonconfig.ImageSrc); + button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + button->SetOnClickListener(clickListener); + + 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); + //button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + + button->SetImagePosition(326, 37); + return button; + } + + + + void testView::initView_ext(int x,int y,int w,int h,int interval,const char *imagsrc) + { + if (!SetTheSystemScrollView()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheSystemScrollView() fail!"); + return; + } + if (!SetTheTitle()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheTitle() fail!"); + return; + } + /* -------------------------------------------------------------------------- */ + UIView::OnClickListener *clickListener = static_cast(testPresenter::GetInstance()); + /* -------------------------------------------------------------------------- */ + ButtonConfig_ext_t buttonconfig; + buttonconfig.x = x; + buttonconfig.y = y; + buttonconfig.w = w; + buttonconfig.h = h; + + int len =sizeof(ViewMapper_t)/sizeof(test_ext); + + for(int i=0;iAdd(SystemScrollView[thisView]); + } + return true; + } + + // 1.跳转到关于手表 + bool testView::ChangeSystemAboutView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_about_view = new testAboutView(); + if (test_about_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_about_view->SystemAbouTheWatchtInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangeLCDTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_LCD_view = new testLCDView(); + if (test_LCD_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_LCD_view->testLCDInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangeTPTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_TP_view = new testTPView(); + if (test_TP_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_TP_view->testTPInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangeMGTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_MG_view = new testMagicView(); + if (test_MG_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_MG_view->testmagicInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangLUMTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_lum_view = new testLUMView(); + if (test_lum_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_lum_view->testLUMInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangchargingTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_charging_view = new testCHANINGView(); + if (test_charging_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_charging_view->testCHANINGInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangspeakTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_speak_view = new testSPEAKView(); + if (test_speak_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_speak_view->testSPEAKInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangmotorTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_motor_view = new testMOTORView(); + if (test_motor_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_motor_view->testMOTORInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangeCAT1TESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_cat1_view = new testcat1View(); + if (test_cat1_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_cat1_view->testcat1InitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangKEYTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_KEY_view = new testbuttonView(); + if (test_KEY_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_KEY_view->testBUTTONInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + bool testView::ChangeMPTESTView(int16_t thisView) + { + if (SystemScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView"); + test_MP_view = new testmakephoneView(); + if (test_MP_view == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView); + return false; + } + SystemScrollView[thisView] = test_MP_view->testmakephoneInitIView(); + RootView::GetInstance()->Add(SystemScrollView[thisView]); + } + return true; + } + + UIScrollView *testView::GetSystemScrollView(int ViewId) + { + if (SystemScrollView[ViewId] == nullptr) + { + return nullptr; + } + return SystemScrollView[ViewId]; + } + + /* -------------------------------------------------------------------------- */ + // 1.MainStopWatchViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。 + + // 3.根据传入的interface参数执行相应视图ID关联的成员函数。 + bool testView::ClickFunc(int16_t interface) + { + int funcSize = sizeof(ViewMapper_t) / sizeof(ViewMapper_t[TESTVIEW]); + for (int i = 0; i < funcSize; i++) + { + if (interface == ViewMapper_t[i].viewId) + { + bool jug = (this->*(ViewMapper_t[i].func))(interface); + if (jug == false) + { + return false; + } + return true; + } + } + return false; + } + + // 4.切换视图 + void testView::ChangeView(int16_t hideView, int16_t showView) + { + if (hideView > MAX_TESTVIEWID) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemViewId Overstep ones bounds"); + return; + } + SystemScrollView[hideView]->SetVisible(false); + ClickFunc(showView); + SystemScrollView[showView]->SetVisible(true); + Draw(); + } + /* -------------------------------------------------------------------------- */ + + void testView::OnStart() + { + View::OnStart(); + //InitIView(); + initView_ext(43,120,380,100,120,"/user/res/SETTING_NEXT.bin"); + } + + void testView::OnSetUpView() + { + View::OnSetUpView(); + if (SystemScrollView[TESTVIEW] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: OnSetUpView has nullptr"); + return; + } + + SystemScrollView[TESTVIEW]->Add(SystemLabel); + + int len =sizeof(ViewMapper_t)/sizeof(test_ext); + + for(int i=0;iAdd(button[i]); + } + // SystemScrollView[SYSTEMVIEW]->Add(SuperviseButton); + // SystemScrollView[SYSTEMVIEW]->Add(SystemLanguageButton); + // SystemScrollView[SYSTEMVIEW]->Add(FactoryResetButton); + // SystemScrollView[SYSTEMVIEW]->Add(SystemUpgradeButtonExt); + + RootView::GetInstance()->Add(SystemScrollView[TESTVIEW]); + Draw(); + } + + void testView::OnTearDownView() + { + + View::OnTearDownView(); + return; + } + + void testView::OnStop() + { + + View::OnStop(); + RootView::GetInstance()->RemoveAll(); + return; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp new file mode 100644 index 000000000..05438c178 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp @@ -0,0 +1,372 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testabout.h" +namespace OHOS +{ + + static testAboutView *g_pSystemAboutTheWatchView{nullptr}; + + testAboutView::testAboutView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testAboutView::~testAboutView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testAboutView *testAboutView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testAboutView::ClearAll() + { + if (initViewStatus == true) + { + testAboutTheWatchScrollView->RemoveAll(); + delete SystemAboutTheWatchTitle; + SystemAboutTheWatchTitle = nullptr; + delete WatchNameTitle; + WatchNameTitle = nullptr; + delete WatchName; + WatchName = nullptr; + delete FirmwareVersionTitle; + FirmwareVersionTitle = nullptr; + delete FirmwareVersion; + FirmwareVersion = nullptr; + delete AlgorithmVersionTitle; + AlgorithmVersionTitle = nullptr; + delete AlgorithmVersion; + AlgorithmVersion = nullptr; + delete BluetoothAddressTitle; + BluetoothAddressTitle = nullptr; + delete BluetoothAddress; + BluetoothAddress = nullptr; + delete LANAddressTitle; + LANAddressTitle = nullptr; + delete LANAddress; + LANAddress = nullptr; + delete FONTTitle; + FONTTitle = nullptr; + delete FONT; + FONT = nullptr; + delete testAboutTheWatchScrollView; + testAboutTheWatchScrollView = nullptr; + } + } + + UILabel *testAboutView::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); + return label; + } + + bool testAboutView::testAboutTheWatchScrollViewinit(void) + { + testAboutTheWatchScrollView = new UIScrollView(); + if (testAboutTheWatchScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testAboutTheWatchScrollView new fail!"); + return false; + } + testAboutTheWatchScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testAboutTheWatchScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testAboutTheWatchScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294); + testAboutTheWatchScrollView->SetScrollBlankSize(0); + testAboutTheWatchScrollView->SetReboundSize(0); + testAboutTheWatchScrollView->SetDirection(1); + //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); + // if (draglistener == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + // return false; + // } + // testAboutTheWatchScrollView->SetOnDragListener(draglistener); + testAboutTheWatchScrollView->SetTouchable(true); + testAboutTheWatchScrollView->SetDraggable(true); + return true; + } + + UIScrollView *testAboutView::SystemAbouTheWatchtInitIView() + { + if (!testAboutTheWatchScrollViewinit()) + { + return nullptr; + } + /* -------------------------------------------------------------------------- */ + LabelConfig Config = { + .left = 203, + .top = 52, + .width = 60, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "关于", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + SystemAboutTheWatchTitle = InitLabel(Config); + if (SystemAboutTheWatchTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(SystemAboutTheWatchTitle); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 173, + .top = 160, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "手表名称", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + WatchNameTitle = InitLabel(Config); + if (WatchNameTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchNameTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(WatchNameTitle); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 37, + .top = 216, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = "Watch Soar", + .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + }; + WatchName = InitLabel(Config); + if (WatchName == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchName new fail!"); + return nullptr; + } + WatchName->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(WatchName); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 173, + .top = 305, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "固件版本", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + FirmwareVersionTitle = InitLabel(Config); + if (FirmwareVersionTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FirmwareVersionTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(FirmwareVersionTitle); + /* -------------------------------------------------------------------------- */ + char version_buf[128]={0}; + uint32_t version_len=128; + uapi_get_buildversion((uint8_t*)version_buf,version_len); + Config = { + .left = 37, + .top = 341, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = (char*)version_buf, + .lineBreakMode = UILabel::LINE_BREAK_WRAP, + }; + FirmwareVersion = InitLabel(Config); + if (FirmwareVersion == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FirmwareVersion new fail!"); + return nullptr; + } + FirmwareVersion->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(FirmwareVersion); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 173, + .top = 450, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "算法版本", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + AlgorithmVersionTitle = InitLabel(Config); + if (AlgorithmVersionTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::AlgorithmVersionTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(AlgorithmVersionTitle); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 37, + .top = 506, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = "V02.03.01 OTA88", + .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + }; + AlgorithmVersion = InitLabel(Config); + if (AlgorithmVersion == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::AlgorithmVersion new fail!"); + return nullptr; + } + AlgorithmVersion->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(AlgorithmVersion); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 173, + .top = 595, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "蓝牙地址", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + BluetoothAddressTitle = InitLabel(Config); + if (BluetoothAddressTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BluetoothAddressTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(BluetoothAddressTitle); + /* -------------------------------------------------------------------------- */ + uint8_t btaddr[64]={0}; + uint32_t len = 64; + errcode_t ret = uapi_get_btaddr((uint8_t*)btaddr,&len); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"get btaddr %s , ret 0x%X\n",btaddr,ret); + Config = { + .left = 37, + .top = 651, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = (char*)btaddr, + .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + }; + + + BluetoothAddress = InitLabel(Config); + if (BluetoothAddress == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BluetoothAddress new fail!"); + return nullptr; + } + BluetoothAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(BluetoothAddress); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 173, + .top = 740, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "蓝牙名称", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + LANAddressTitle = InitLabel(Config); + if (LANAddressTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddressTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(LANAddressTitle); + /* -------------------------------------------------------------------------- */ + + uint8_t ble_name[20] = {0}; + uint32_t ble_name_len ; + ret = uapi_get_btname(ble_name, &ble_name_len); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"get btname %s ,ret 0x%X\n",ble_name,ret); + + Config = { + .left = 37, + .top = 796, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = (char*)ble_name, + .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + }; + LANAddress = InitLabel(Config); + if (LANAddress == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::BTNAME new fail!"); + return nullptr; + } + LANAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(LANAddress); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 173, + .top = 885, + .width = 120, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "FONTS", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + FONTTitle = InitLabel(Config); + if (FONTTitle == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::FONTTitle new fail!"); + return nullptr; + } + testAboutTheWatchScrollView->Add(FONTTitle); + /* -------------------------------------------------------------------------- */ + Config = { + .left = 37, + .top = 941, + .width = 400, + .height = 30, + .fontSize = 26, + .lineHeigh = 30, + .text = "HarmonyOS Sans", + .lineBreakMode = UILabel::LINE_BREAK_ELLIPSIS, + }; + LANAddress = InitLabel(Config); + if (LANAddress == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::LANAddress new fail!"); + return nullptr; + } + LANAddress->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x87)); + testAboutTheWatchScrollView->Add(LANAddress); + initViewStatus = true; + return testAboutTheWatchScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp new file mode 100644 index 000000000..855b055d0 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testbutton.cpp @@ -0,0 +1,192 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testbutton.h" +#include "AlarmClockModel.h" +#include "cmsis_os2.h" + +namespace OHOS +{ + + static testbuttonView *g_pSystemAboutTheWatchView{nullptr}; + + testbuttonView::testbuttonView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testbuttonView::~testbuttonView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testbuttonView *testbuttonView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testbuttonView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + UILabelButtonExt *testbuttonView::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(false); + + 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(testPresenter::GetInstance()); + // button->SetOnClickListener(touchListener); + + // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); + // button->SetOnDragListener(drgListener); + + // button->SetDraggable(false); + return button; + } + + + static UILabelButtonExt* button[2]{NULL}; + + void testbuttonView::Changbutton(int i,bool falg) + { + if(button!=NULL) + { + + if(i==0) + { + //开始 + if(falg==true) + { + button[0]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); + button[0]->SetText("UP_KEY::press"); + } + else + { + button[0]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); + button[0]->SetText("UP_KEY::raise"); + + } + + } + if(i==1) + { + + if(falg==true) + { + button[1]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); + button[1]->SetText("UP_KEY::press"); + } + else + { + button[1]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); + button[1]->SetText("UP_KEY::raise"); + + } + } + + RootView::GetInstance()->Invalidate(); + + } + + } + + + + bool testbuttonView::testBUTTONScrollViewcrollViewinit(void) + { + + testBUTTONScrollView = new UIScrollView(); + if (testBUTTONScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testcat1ScrollView new fail!"); + return false; + } + testBUTTONScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testBUTTONScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testBUTTONScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + testBUTTONScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testBUTTONScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); + + + + /* -------------------------------------------------------------------------- */ + ButtonConfig_ext_t buttonconfig; + buttonconfig.x = 100; + buttonconfig.y = 100; + buttonconfig.w = 250; + buttonconfig.h = 116; + buttonconfig.label_x=40; + buttonconfig.label_y=0; + buttonconfig.Fontsize=30; + 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.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); + testBUTTONScrollView->Add(button[1]); + + RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::testPresenter::GetInstance(); + RootView::GetInstance()->SetOnKeyActListener(keyactListener); + + // UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + // if (draglistener == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + // return false; + // } + // testcat1ScrollView->SetOnDragListener(draglistener); + + + + + + testBUTTONScrollView->SetTouchable(true); + testBUTTONScrollView->SetDraggable(false); + + + return true; + } + + UIScrollView *testbuttonView::testBUTTONInitIView() + { + if (!testBUTTONScrollViewcrollViewinit()) + { + return nullptr; + } + return testBUTTONScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp new file mode 100644 index 000000000..b333afdfb --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp @@ -0,0 +1,270 @@ +#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 "cat1_server.h" +#include "cat1_ctl.h" +#include "cat1_server_hal.h" +namespace OHOS +{ + + static testcat1View *g_pSystemAboutTheWatchView{nullptr}; + + testcat1View::testcat1View() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testcat1View::~testcat1View() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testcat1View *testcat1View::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testcat1View::ClearAll() + { + if (initViewStatus == true) + { + } + } + void testcat1View:: setcat1msg(cat1_msg t) + { + + if(label_1_cat1msg_1!=NULL) + { + + char buf[124]={0}; + sprintf(buf,"imei:%s\noper:%s\nsigni:%d\nsim:%d",t.imei,t.oper, t.signal,t.sim); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf); + label_1_cat1msg_1->SetText(buf); + RootView::GetInstance()->Invalidate(); + } + + } + void testcat1View:: setcat1vermsg(cat1_Ver t) + { + + if(label_1_cat1msg_1!=nullptr) + { + char buf[124]={0}; + sprintf(buf,"aoover:%s\nmodem_ver:%s\n",t.cat1appver,t.modem_version); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf); + label_1_cat1vison->SetText(buf); + RootView::GetInstance()->Invalidate(); + } + + } + + UILabelButtonExt *testcat1View::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(testPresenter::GetInstance()); + button->SetOnClickListener(touchListener); + + // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); + // button->SetOnDragListener(drgListener); + + // button->SetDraggable(false); + return button; + } + static bool speakfalg=false; + + + static UILabelButtonExt* button{NULL}; + + + void testcat1View::dial_112(bool falg) + { + if(button!=NULL) + { + calldial_event_sendmsg_toUI("112"); + RootView::GetInstance()->Invalidate(); + + } + + } + + + UILabel *testcat1View::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 testcat1View::tesScat1ScrollViewcrollViewinit(void) + { + + testcat1ScrollView = new UIScrollView(); + if (testcat1ScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testcat1ScrollView new fail!"); + return false; + } + testcat1ScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testcat1ScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testcat1ScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + testcat1ScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + testcat1ScrollView->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_cat1msg_1= InitLabel(Config); + if (label_1_cat1msg_1 == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return false; + } + testcat1ScrollView->Add(label_1_cat1msg_1); + + Config = { + .left = 50, + .top = 200, + .width = 60, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + label_1_cat1vison= InitLabel(Config); + if (label_1_cat1vison == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return false; + } + testcat1ScrollView->Add(label_1_cat1vison); + + Config = { + .left = 50, + .top = 200, + .width = 60, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + label_1_cat1vison= InitLabel(Config); + if (label_1_cat1vison == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return false; + } + testcat1ScrollView->Add(label_1_cat1vison); + + + + 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 = 200; + buttonconfig.h = 116; + 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.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); + // testcat1ScrollView->Add(button[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; + // } + // testcat1ScrollView->SetOnDragListener(draglistener); + + + + + + testcat1ScrollView->SetTouchable(true); + testcat1ScrollView->SetDraggable(false); + + + return true; + } + + UIScrollView *testcat1View::testcat1InitIView() + { + if (!tesScat1ScrollViewcrollViewinit()) + { + return nullptr; + } + return testcat1ScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp new file mode 100644 index 000000000..ba212f367 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testchanging.cpp @@ -0,0 +1,147 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testchanging.h" + +#include "cmsis_os2.h" + +namespace OHOS +{ + + static testCHANINGView *g_pSystemAboutTheWatchView{nullptr}; + + testCHANINGView::testCHANINGView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testCHANINGView::~testCHANINGView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testCHANINGView *testCHANINGView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testCHANINGView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + UILabelButtonExt *testCHANINGView::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(false); + + button->SetText("usb::stat"); + button->SetAlign(TEXT_ALIGNMENT_LEFT); + button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y ); + button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize); + //button->SetOnTouchListener(clickListener); + + // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); + // button->SetOnDragListener(drgListener); + + // button->SetDraggable(false); + return button; + } + + + + static UILabelButtonExt* button{NULL}; + + + void testCHANINGView::ChangeViewcolor(bool falg) + { + if(button!=NULL) + { + if(falg==true) + { + button->SetStyle(STYLE_BACKGROUND_COLOR, Color::Red().full); + button->SetText("usb::0"); + } + else + { + button->SetStyle(STYLE_BACKGROUND_COLOR, Color::Blue().full); + button->SetText("usb::1"); + } + RootView::GetInstance()->Invalidate(); + + } + + } + + bool testCHANINGView::testCHANINGScrollViewcrollViewinit(void) + { + + testCHANINGScrollView = new UIScrollView(); + if (testCHANINGScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testCHANINGScrollView new fail!"); + return false; + } + testCHANINGScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testCHANINGScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testCHANINGScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + testCHANINGScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testCHANINGScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); + + + UIView::OnTouchListener *touchListener = static_cast(testPresenter::GetInstance()); + /* -------------------------------------------------------------------------- */ + ButtonConfig_ext_t buttonconfig; + buttonconfig.x = 100; + buttonconfig.y = 100; + buttonconfig.w = 200; + buttonconfig.h = 116; + buttonconfig.label_x=40; + buttonconfig.label_y=0; + buttonconfig.Fontsize=30; + buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + button=SetTheButton_ext(buttonconfig); + + testCHANINGScrollView->Add(button); + + + // UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + // if (draglistener == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + // return false; + // } + // testCHANINGScrollView->SetOnDragListener(draglistener); + testCHANINGScrollView->SetTouchable(true); + testCHANINGScrollView->SetDraggable(false); + + + return true; + } + + UIScrollView *testCHANINGView::testCHANINGInitIView() + { + if (!testCHANINGScrollViewcrollViewinit()) + { + return nullptr; + } + return testCHANINGScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp new file mode 100644 index 000000000..9b17e0c87 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testluminance.cpp @@ -0,0 +1,105 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testluminance.h" +#include "config/include/ConfigModel.h" +#include "cmsis_os2.h" + +namespace OHOS +{ + + static testLUMView *g_pSystemAboutTheWatchView{nullptr}; + + testLUMView::testLUMView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testLUMView::~testLUMView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testLUMView *testLUMView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testLUMView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + + + bool testLUMView::testLUMScrollViewcrollViewinit(void) + { + + testLUMScrollView = new UIScrollView(); + if (testLUMScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testLUMScrollView new fail!"); + return false; + } + testLUMScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testLUMScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + //testLUMScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + //testLUMScrollView->SetViewId("TP_test"); + testLUMScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + testLUMScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Black().full); + testLUMScrollView->SetViewId("Brightnesview"); + + BrightnessControlViewSlider = new UISlider(); + if (BrightnessControlViewSlider == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BrightnessControlViewSlider new fail"); + return false; + } + BrightnessControlViewSlider->SetSliderColor(Color::Gray(), Color::Silver()); + BrightnessControlViewSlider->SetPosition(167, 77, 130, 310); + BrightnessControlViewSlider->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP); + BrightnessControlViewSlider->SetViewId("BrightnessControl"); + BrightnessControlViewSlider->SetRange(0xff, 51); + + BrightnessControlViewSlider->SetStyle(STYLE_BORDER_RADIUS, 100); + BrightnessControlViewSlider->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + BrightnessControlViewSlider->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + BrightnessControlViewSlider->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + BrightnessControlViewSlider->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff); + BrightnessControlViewSlider->SetDraggable(true); + ConfigModel *p_ConfigModel = ConfigModel::GetInstance(); + unsigned int value = p_ConfigModel->GetScreenBrightnessValue(); + + BrightnessControlViewSlider->SetValue(value); + + testLUMScrollView->Add(BrightnessControlViewSlider); + + UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + if (draglistener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + return false; + } + testLUMScrollView->SetOnDragListener(draglistener); + testLUMScrollView->SetTouchable(true); + testLUMScrollView->SetDraggable(true); + + + return true; + } + + UIScrollView *testLUMView::testLUMInitIView() + { + if (!testLUMScrollViewcrollViewinit()) + { + return nullptr; + } + return testLUMScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp new file mode 100644 index 000000000..55053e62d --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmagnetic.cpp @@ -0,0 +1,179 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testmagnetic.h" +#include "mag_service.h" +#include "cmsis_os2.h" + +namespace OHOS +{ + + static testMagicView *g_pSystemAboutTheWatchView{nullptr}; + + testMagicView::testMagicView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testMagicView::~testMagicView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testMagicView *testMagicView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testMagicView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + static void mgdataTimerCallBack(int data) + { + testMagicView::GetInstance()->set_data(); + } + uint8_t MG_TEST_FALG=0; + void testMagicView ::set_data(void) + { + + MG_TEST_FALG++; + uint16_t angle_value= (int16_t)mag_service_get_fAzimuth(); + char buf[16]={0}; + sprintf(buf,"angle:%d",angle_value); + x->SetText(buf); + RootView::GetInstance()->Invalidate(); + + if(MG_TEST_FALG>10) + CompassModel::GetInstance()->CloseCompassSensor(); + } + + UILabel *testMagicView::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); + return label; + } + + + osTimerId_t magneyic_TEST_timer=NULL; + bool testMagicView::testmagicScrollViewcrollViewinit(void) + { + uint32_t tick; + osStatus_t retTimer; + + CompassModel::GetInstance()->OpenCompassSensor(); + + testmagicScrollView = new UIScrollView(); + if (testmagicScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testmagicScrollView new fail!"); + return false; + } + testmagicScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testmagicScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testmagicScrollView->SetStyle(STYLE_BORDER_RADIUS, 1294); + + testmagicScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + MG_TEST_FALG=0; + + magneyic_TEST_timer = osTimerNew((osTimerFunc_t)mgdataTimerCallBack, osTimerPeriodic, NULL, NULL); + tick =1000;// osMs2Tick(1000); + retTimer = osTimerStart(magneyic_TEST_timer, tick); + if (retTimer != osOK && magneyic_TEST_timer != NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer); + osTimerDelete(magneyic_TEST_timer); + magneyic_TEST_timer = NULL; + return false; + } + + testmagicScrollView->SetScrollBlankSize(0); + testmagicScrollView->SetReboundSize(0); + testmagicScrollView->SetDirection(1); + //UIView::OnDragListener *draglistener = static_cast(SystemPresenter::GetInstance()); + // if (draglistener == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + // return false; + // } + // testmagicScrollView->SetOnDragListener(draglistener); + + LabelConfig Config = { + .left = 203, + .top = 52, + .width = 60, + .height = 35, + .fontSize = 30, + .lineHeigh = 35, + .text = "磁力测试", + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + title = InitLabel(Config); + if (title == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemAboutTheWatchTitle new fail!"); + return false; + } + testmagicScrollView->Add(title); + /* -------------------------------------------------------------------------- */ + uint16_t angle_value= (int16_t)mag_service_get_fAzimuth(); + char buf[16]={0}; + sprintf(buf,"angle:%d",angle_value); + Config = { + .left = 173, + .top = 160, + .width = 120, + .height = 35, + .fontSize = 50, + .lineHeigh = 35, + .text = buf, + .lineBreakMode = UILabel::LINE_BREAK_ADAPT, + }; + + x = InitLabel(Config); + if (x == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::WatchNameTitle new fail!"); + return false; + } + testmagicScrollView->Add(x); + /* -------------------------------------------------------------------------- */ + + + + + testmagicScrollView->SetTouchable(true); + testmagicScrollView->SetDraggable(false); + + + + + return true; + } + + UIScrollView *testMagicView::testmagicInitIView() + { + if (!testmagicScrollViewcrollViewinit()) + { + return nullptr; + } + return testmagicScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmakephone.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmakephone.cpp new file mode 100644 index 000000000..085bbf81d --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmakephone.cpp @@ -0,0 +1,188 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testmakephone.h" +#include "AlarmClockModel.h" +#include "cmsis_os2.h" +#include "audio_capture_wrapper.h" +namespace OHOS +{ + + static testmakephoneView *g_pSystemAboutTheWatchView{nullptr}; + + testmakephoneView::testmakephoneView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testmakephoneView::~testmakephoneView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testmakephoneView *testmakephoneView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testmakephoneView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + UILabelButtonExt *testmakephoneView::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(testPresenter::GetInstance()); + button->SetOnClickListener(touchListener); + + // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); + // button->SetOnDragListener(drgListener); + + // button->SetDraggable(false); + return button; + } + + + static UILabelButtonExt* button{NULL}; + uint8_t makphone_falg=0; + static char *Path= "/user/music/test_makephone.mp3"; + void testmakephoneView::buttoncallback() + { + if(button!=NULL) + { + + if(makphone_falg==0) + { + char *args[6] = {0}; + const char *defaultArgs[6] = {"01", "mp3", "16000", "1", "16","/user/music/test_makephone.mp3"}; // 默认参数数组 + + for (int i = 0; i < 6; ++i) + { + args[i] = (char *)malloc(64); // 分配内存 + sprintf(args[i], "%s", defaultArgs[i]); // 设置默认参数值 + } + //args[5] = (char *)malloc(100); // 分配内存 + + // 获取形如:19700101000641格式的日期时间 + + /* ---------------------------------- 开始录音 ---------------------------------- */ + AudioCaptureSample(6, (const char **)args); + button->SetText("stop"); + makphone_falg++; + } + else if(makphone_falg==1) + { + int32_t argc = 1; + uint8_t *argv = (uint8_t*)"stop"; + AudioCaptureSample(argc, (const char **)&argv); + button->SetText("play"); + makphone_falg++; + + FILE *file =fopen("/user/music/test_makephone.mp3","rb"); + if(file==NULL) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ffffffffffffffffsssssss"); + } + fclose(file); + } + else if(makphone_falg==2) + { + + AlarmClockModel::GetInstance()->testPlayerStart(Path); + + } + + + + } + + RootView::GetInstance()->Invalidate(); + } + + + + bool testmakephoneView::testphoneScrollViewcrollViewinit(void) + { + + testmakephoneScrollView = new UIScrollView(); + if (testmakephoneScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testcat1ScrollView new fail!"); + return false; + } + testmakephoneScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testmakephoneScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testmakephoneScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + testmakephoneScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testmakephoneScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); + + + + /* -------------------------------------------------------------------------- */ + ButtonConfig_ext_t buttonconfig; + buttonconfig.x = 200; + buttonconfig.y = 200; + buttonconfig.w = 250; + buttonconfig.h = 116; + buttonconfig.label_x=40; + buttonconfig.label_y=0; + buttonconfig.Fontsize=30; + buttonconfig.ViewId="testmakephoneView"; + buttonconfig.str="statr"; + buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + button=SetTheButton_ext(buttonconfig); + testmakephoneScrollView->Add(button); + makphone_falg=0; + + // UIView::OnDragListener *draglistener = static_cast(testPresenter::GetInstance()); + // if (draglistener == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!"); + // return false; + // } + // testcat1ScrollView->SetOnDragListener(draglistener); + + + + + + testmakephoneScrollView->SetTouchable(true); + testmakephoneScrollView->SetDraggable(false); + + + return true; + } + + UIScrollView *testmakephoneView::testmakephoneInitIView() + { + if (!testphoneScrollViewcrollViewinit()) + { + return nullptr; + } + return testmakephoneScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp new file mode 100644 index 000000000..9a6612590 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmotor.cpp @@ -0,0 +1,171 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testmotor.h" +#include "AlarmClockModel.h" +#include "cmsis_os2.h" +#include "dock/vibrator_manager.h" + + +namespace OHOS +{ + + static testMOTORView *g_pSystemAboutTheWatchView{nullptr}; + + testMOTORView::testMOTORView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testMOTORView::~testMOTORView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testMOTORView *testMOTORView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testMOTORView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + UILabelButtonExt *testMOTORView::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(testPresenter::GetInstance()); + button->SetOnClickListener(touchListener); + + // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); + // button->SetOnDragListener(drgListener); + + // button->SetDraggable(false); + return button; + } + + + + static UILabelButtonExt* button[2]{NULL}; + + static bool motorfalg=false; + void testMOTORView::Changstatr(bool falg) + { + if(button!=NULL) + { + if(falg==true) + { + if(motorfalg!=true) + { + //开始 + VibratorFunc vibratorFunc = VibratorManager::GetInstance()->GetVibratorFunc(); + if (vibratorFunc != nullptr) + { + vibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); + //vibratorFunc(VibratorType::VIBRATOR_TYPE_THREE); + //GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_THREE vibrator"); + // } else { + // vibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); + // //GRAPHIC_LOGI("UIList::MoveChildByOffset calls TYPE_TWO vibrator"); + // } + } + } + } + RootView::GetInstance()->Invalidate(); + + } + + } + + bool testMOTORView::testMOTORScrollViewcrollViewinit(void) + { + + tesMOTORScrollView = new UIScrollView(); + if (tesMOTORScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::tesMOTORScrollView new fail!"); + return false; + } + tesMOTORScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + tesMOTORScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + tesMOTORScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + tesMOTORScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + tesMOTORScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); + + + + /* -------------------------------------------------------------------------- */ + ButtonConfig_ext_t buttonconfig; + buttonconfig.x = 100; + buttonconfig.y = 100; + buttonconfig.w = 200; + buttonconfig.h = 116; + buttonconfig.label_x=40; + buttonconfig.label_y=0; + buttonconfig.Fontsize=30; + buttonconfig.ViewId="MOTOR_play"; + buttonconfig.str="start"; + buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + button[0]=SetTheButton_ext(buttonconfig); + tesMOTORScrollView->Add(button[0]); + + // 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="MOTOR_puase"; + // buttonconfig.str="stop"; + // buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + // button[1]=SetTheButton_ext(buttonconfig); + // tesMOTORScrollView->Add(button[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; + // } + // tesMOTORScrollView->SetOnDragListener(draglistener); + tesMOTORScrollView->SetTouchable(true); + tesMOTORScrollView->SetDraggable(false); + + + return true; + } + + UIScrollView *testMOTORView::testMOTORInitIView() + { + if (!testMOTORScrollViewcrollViewinit()) + { + return nullptr; + } + return tesMOTORScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp new file mode 100644 index 000000000..ee62b0eb4 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testspeak.cpp @@ -0,0 +1,204 @@ +#include "wearable_log.h" +#include "custom_utils.h" +#include "producttest/include/testPresenter.h" +#include "producttest/include/testspeak.h" +#include "AlarmClockModel.h" +#include "cmsis_os2.h" + +namespace OHOS +{ + + static testSPEAKView *g_pSystemAboutTheWatchView{nullptr}; + + testSPEAKView::testSPEAKView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::SystemAboutTheWatchView"); + g_pSystemAboutTheWatchView = this; + } + + testSPEAKView::~testSPEAKView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::~SystemAboutTheWatchView"); + ClearAll(); + g_pSystemAboutTheWatchView = nullptr; + } + + testSPEAKView *testSPEAKView::GetInstance() + { + + return g_pSystemAboutTheWatchView; + } + + void testSPEAKView::ClearAll() + { + if (initViewStatus == true) + { + } + } + + UILabelButtonExt *testSPEAKView::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(testPresenter::GetInstance()); + button->SetOnClickListener(touchListener); + + // UIView::OnDragListener *drgListener = static_cast(testPresenter::GetInstance()); + // button->SetOnDragListener(drgListener); + + // button->SetDraggable(false); + return button; + } + static bool speakfalg=false; + // static osTimerId_t speak_TEST_timer=NULL; + // void speakTimerCallBack(int data) + // { + // // osTimerDelete(speak_TEST_timer); + // // speak_TEST_timer = NULL; + // speakfalg=false; + // AlarmClockModel::GetInstance()->AlarmPlayerStop(); + + // } + + static UILabelButtonExt* button[2]{NULL}; + + + void testSPEAKView::Changspeak(bool falg) + { + if(button!=NULL) + { + if(falg==true) + { + if(speakfalg!=true) + { + //开始 + AlarmClockModel::GetInstance()->AlarmPlayerStart(); + speakfalg=true; + // if(speak_TEST_timer!=NULL) + // osTimerDelete(speak_TEST_timer); + + // speak_TEST_timer = osTimerNew((osTimerFunc_t)speakTimerCallBack, osTimerOnce, NULL, NULL); + + // osTimerStart(speak_TEST_timer, 1000*5); + // if (speak_TEST_timer == NULL) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed!!"); + // osTimerDelete(speak_TEST_timer); + // speak_TEST_timer = NULL; + // } + + } + } + else + { + //AlarmClockModel::GetInstance()->AlarmPlayerStop(); + if(speakfalg!=false) + { + AlarmClockModel::GetInstance()->AlarmPlayerStop(); + speakfalg=false; + // if (speak_TEST_timer != NULL) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, !!"); + // osTimerDelete(speak_TEST_timer); + // speak_TEST_timer = NULL; + // } + + //停止 + } + + } + RootView::GetInstance()->Invalidate(); + + } + + } + + + + bool testSPEAKView::tesSPEAKScrollViewcrollViewinit(void) + { + + testSOEAKScrollView = new UIScrollView(); + if (testSOEAKScrollView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemAboutTheWatchView::testSOEAKScrollView new fail!"); + return false; + } + testSOEAKScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + testSOEAKScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + testSOEAKScrollView->SetStyle(STYLE_BORDER_RADIUS, 0); + testSOEAKScrollView->SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); + testSOEAKScrollView->SetStyle(STYLE_BORDER_COLOR, Color::Yellow().blue); + + + + /* -------------------------------------------------------------------------- */ + ButtonConfig_ext_t buttonconfig; + buttonconfig.x = 100; + buttonconfig.y = 100; + buttonconfig.w = 200; + buttonconfig.h = 116; + buttonconfig.label_x=40; + buttonconfig.label_y=0; + buttonconfig.Fontsize=30; + buttonconfig.ViewId="speak_play"; + buttonconfig.str="play"; + buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + button[0]=SetTheButton_ext(buttonconfig); + testSOEAKScrollView->Add(button[0]); + + 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="speak_puase"; + buttonconfig.str="puase"; + buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT; + button[1]=SetTheButton_ext(buttonconfig); + testSOEAKScrollView->Add(button[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; + // } + // testSOEAKScrollView->SetOnDragListener(draglistener); + + + + + + testSOEAKScrollView->SetTouchable(true); + testSOEAKScrollView->SetDraggable(false); + + + return true; + } + + UIScrollView *testSPEAKView::testSPEAKInitIView() + { + if (!tesSPEAKScrollViewcrollViewinit()) + { + return nullptr; + } + return testSOEAKScrollView; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmClockModel.h b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmClockModel.h index 074df441b..89e6b7180 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmClockModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmClockModel.h @@ -115,7 +115,10 @@ public: void AlarmGetClockNum(void); int AlarmPlayerStat(); int AlarmPlayerInit(void); + int AlarmPlayerInit_BY_fir_name(char *); + int AlarmPlayerStart(); + int testPlayerStart(char *); int AlarmPlayerStop(); private: void SetAlarmId(uint8_t id); diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index 9ac37d862..3373b88f4 100755 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -11,6 +11,9 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include + + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/main/include/dial ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/bloodoxygen/include ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/heartrate/include @@ -101,6 +104,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclockmanage/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarmclocktimerconfig/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/alarm/include + ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/producttest/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/callerlog/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/phoneservice/include ${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/main/include diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 6887ad526..e252f7ff1 100755 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -33,6 +33,8 @@ #include "PhoneService.h" #include "power_display_service.h" #include "cat1_server.h" +#include "testchanging.h" +#include "testcat1.h" namespace OHOS { #ifdef __cplusplus @@ -422,6 +424,50 @@ void MsgCenterNotifyCat1SignalUpdateProc(const Topic topic, Request* req) { unused(topic); unused(req); + + char* str= (char *)req->data; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",str); + char *tokbuf=NULL; + tokbuf=strtok(str,":"); + if(strcmp(tokbuf,"imei")==0) + { + testcat1View ::cat1_msg cat1_msg_T; + tokbuf=strtok(NULL,","); + cat1_msg_T.imei=(char*)malloc(strlen(tokbuf)); + strcpy( cat1_msg_T.imei,tokbuf); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",cat1_msg_T.imei); + tokbuf=strtok(NULL,":"); + tokbuf=strtok(NULL,","); + cat1_msg_T.sim=atoi(tokbuf); + //strcpy( cat1_msg_T.imei,tokbuf); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d",cat1_msg_T.sim); + tokbuf=strtok(NULL,"("); + tokbuf=strtok(NULL,")"); + cat1_msg_T.oper=(char*)malloc(strlen(tokbuf)); + strcpy( cat1_msg_T.oper,tokbuf); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",cat1_msg_T.oper); + tokbuf=strtok(NULL,":"); + tokbuf=strtok(NULL,","); + cat1_msg_T.signal=atoi(tokbuf); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d",cat1_msg_T.signal); + testcat1View::GetInstance()->setcat1msg(cat1_msg_T); + } + else if(strcmp(tokbuf,"pyVer")==0) + { + testcat1View ::cat1_Ver cat1_ver_T; + tokbuf=strtok(NULL,","); + cat1_ver_T.cat1appver=(char*)malloc(strlen(tokbuf)); + strcpy( cat1_ver_T.cat1appver,tokbuf); + + tokbuf=strtok(NULL,","); + tokbuf=strtok(NULL,","); + cat1_ver_T.modem_version=(char*)malloc(strlen(tokbuf)); + strcpy( cat1_ver_T.modem_version,tokbuf); + + testcat1View::GetInstance()->setcat1vermsg(cat1_ver_T); + + } + } void MsgCenterNotifyCat1PowerOffProc(const Topic topic, Request* req) { diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index a835113ee..b19b1827f 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -253,14 +253,22 @@ void test_call_incomming(void) strcpy(msg.buffer,"10086"); cat1_handle_call_incomming(&msg); } - +char networkmsg[124]={0}; int cat1_handle_networ_msg(struct tcp_msg_t *msg) { - char* networkmsg=msg->buffer; + memset(networkmsg,0,124); + strcpy(networkmsg,msg->buffer); + if(msg->head[1]=='0') + { + networkmsg[5]=':'; + } WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_networ_msg %s\n",networkmsg); + cat1_msg_event_sendmsg_toUI(networkmsg); //显示UI 信号 return 1; } + + int cat1_handle_sms(struct tcp_msg_t *msg) { char* smsmsg=msg->buffer; @@ -366,6 +374,9 @@ static int udp_packet_parse(char *rx_buffer, int len) case UDP_MSG_REPLY: printf("UDP_MSG_REPLY reply %s",msg->buffer); + break; + case UDP_CMD_GET_CAT1VER: + index = cat1_handle_networ_msg(msg); break; default: printf("error message: %s\n", rx_buffer); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp index 76a37cbc8..3b5b4c973 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp @@ -107,6 +107,12 @@ static errcode_t callend_event_notify(char* callno) return 0; } +static errcode_t cat1msg_event_notify(char* callno) +{ + CustomEventPublish(TOPIC_EVENT_CAT1_SIGNAL_UPDATE,(uint8_t*)callno,strlen(callno)); + return 0; +} + int callend_event_sendmsg_toUI(char* callno) { /**通过UI事件发送Notify*/ @@ -137,6 +143,13 @@ int calldial_event_sendmsg_toUI(char* callno) return ERRCODE_SUCC; } +int cat1_msg_event_sendmsg_toUI(char* callno) +{ + /**通过UI事件发送Notify*/ + GraphicService::GetInstance()->PostGraphicEvent(std::bind(cat1msg_event_notify, callno)); + return ERRCODE_SUCC; +} + #ifdef __cplusplus } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h index 35d803dba..6cdc82a18 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.h @@ -18,7 +18,7 @@ int incomedcall_event_sendmsg_toUI(char* callno); int callend_event_sendmsg_toUI(char* callno); int incomingcall_event_sendmsg_toUI(char* callno); int calldial_event_sendmsg_toUI(char* callno); - +int cat1_msg_event_sendmsg_toUI(char* callno); #ifdef __cplusplus #if __cplusplus } -- 2.17.1