${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
${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
VIEW_PHONECALLING, // 来电
VIEW_PHONECALLUP, // 通话界面
VIEW_PHONEDIR, // 电话簿
+
+ VIEW_TEST, //测试
/* -------------------------------------------------------------------------- */
#ifdef SUPPORT_ALIPAY_SEC
VIEW_MAIN_ALIPAY,
void InitPhoneCallupSlice(void);
void InitPhoneRingSlice(void);
+
+ void InittestSlice(void);
private:
void InitAllNativeSlices(void);
#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"
{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
{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() {}
NativeAbility::GetInstance().AddSliceProxy(VIEW_PHONERING, phoneringview);
}
+void NativeLauncher::InittestSlice(void)
+{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitestSlice");
+ SliceProxy *testview = new AbilitySliceProxy<testView,testPresenter>;
+ if (testview == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneringview");
+ return;
+ }
+ NativeAbility::GetInstance().AddSliceProxy(VIEW_TEST, testview);
+}
}
void AlarmGetClockNum(void);\r
int AlarmPlayerStat();\r
int AlarmPlayerInit(void);\r
+ int AlarmPlayerInit_BY_fir_name(char *);\r
int AlarmPlayerStart();\r
+ int testPlayerStart(char *);\r
int AlarmPlayerStop();\r
private:\r
void SetAlarmId(uint8_t id);\r
{
// 本地播放文件路径和状态
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;
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<Player>();
+ if (playerCtr.get() == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playerCtr new fail");
+ return OHOS_FAILURE;
+ }
+ playerCallback = std::make_shared<AlarmPlayerCallbackImpl>();
+ 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;
}
return OHOS_SUCCESS;
}
+
+int AlarmClockModel::testPlayerStart(char *str)
+{
+ AlarmPlayerInit_BY_fir_name(str);
+ AlarmPlayerStat();
+ return OHOS_SUCCESS;
+}
+
void AlarmPlayerCallbackImpl::OnPlaybackComplete()
{
GraphicService::GetInstance()->PostGraphicEvent(
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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
--- /dev/null
+\r
+#ifndef TEST_PRESENTER_H\r
+#define TEST_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "testView.h"\r
+#include "testTP.h"\r
+#include "producttest/include/testluminance.h"\r
+#include "producttest/include/testspeak.h" \r
+#include "producttest/include/testModel.h"\r
+#include "components/ui_radio_button.h"\r
+#include "producttest/include/testmotor.h"\r
+#include "producttest/include/testbutton.h" \r
+#include "producttest/include/testmakephone.h"\r
+#include "producttest/include/testcat1.h" \r
+#include "common/key_code.h"\r
+namespace OHOS\r
+{\r
+ typedef enum\r
+ {\r
+ TESTVIEW = 0, // 系统视图(slice)\r
+ VISON,\r
+ LCD,\r
+ TP,\r
+ MAGETIC,\r
+ LUMINANCE,\r
+ CHAR,\r
+ SPEAK,\r
+ MOTOR,\r
+ CAT1,\r
+ BUTTON,\r
+ MAKEPHONE,\r
+ TEST_1,\r
+\r
+ MAX_TESTVIEWID,\r
+ } TEST_VIEW;\r
+\r
+\r
+ class testView;\r
+ class testPresenter : public Presenter<testView>,\r
+ public UIView::OnClickListener,\r
+ public UIView::OnDragListener,\r
+ public UIView::OnTouchListener,\r
+ public RootView::OnKeyActListener\r
+ \r
+ {\r
+ public:\r
+ testPresenter();\r
+ virtual ~testPresenter();\r
+\r
+ void OnStart() override;\r
+ \r
+ void OnResume() override;\r
+ void OnStop() override;\r
+\r
+ static testPresenter *GetInstance();\r
+\r
+ private:\r
+ // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+ bool OnClick(UIView &view, const ClickEvent &event) override;\r
+ bool OnDrag(UIView &view, const DragEvent &event) override;\r
+ bool OnDragEnd(UIView &view, const DragEvent &event) override;\r
+ bool OnPress(UIView &view, const PressEvent &event);\r
+ bool OnKeyAct(UIView &view, const KeyEvent &event);\r
+ //bool OnChange(int) override;\r
+ private:\r
+ testModel *systemModel;\r
+ };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#ifndef TEST_VIEW_H\r
+#define TEST_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_label_button_ext.h"\r
+\r
+#include "producttest/include/testabout.h"\r
+#include "producttest/include/testLCD.h"\r
+#include "producttest/include/testTP.h"\r
+#include "producttest/include/testluminance.h"\r
+#include "producttest/include/testchanging.h"\r
+#include "producttest/include/testspeak.h" \r
+#include "producttest/include/testmotor.h"\r
+#include "producttest/include/testbutton.h"\r
+#include "producttest/include/testmagnetic.h"\r
+#include "producttest/include/testmakephone.h"\r
+#include "producttest/include/testcat1.h" \r
+\r
+namespace OHOS\r
+{\r
+ \r
+ class testPresenter;\r
+ class testView : public View<testPresenter>\r
+ {\r
+\r
+ public:\r
+ testView();\r
+ virtual ~testView();\r
+ static testView *GetInstance(void);\r
+\r
+ void OnStart() override;\r
+ void OnSetUpView() override;\r
+ void OnTearDownView() override;\r
+ void OnStop() override;\r
+ struct ButtonConfig\r
+ {\r
+ int x;\r
+ int y;\r
+ int w;\r
+ int h;\r
+ const char *ViewId;\r
+ const char *ImageSrc;\r
+ };\r
+ struct ButtonConfig_ext_t\r
+ {\r
+ int x;\r
+ int y;\r
+ int w;\r
+ int h;\r
+ const char *str;\r
+ const char *ViewId;\r
+ const char *ImageSrc;\r
+\r
+ //label\r
+ int label_x;\r
+ int label_y;\r
+ uint8_t ALIGN;\r
+ int Fontsize;\r
+ \r
+ };\r
+ \r
+ bool ChangeSystemView(int16_t thisView);\r
+ bool ChangeSystemAboutView(int16_t thisView);\r
+ bool ChangeLCDTESTView(int16_t thisView);\r
+ bool ChangeTPTESTView(int16_t thisView);\r
+ bool ChangLUMTESTView(int16_t thisView);\r
+ bool ChangchargingTESTView(int16_t thisView);\r
+ bool ChangspeakTESTView(int16_t thisView);\r
+ bool ChangmotorTESTView(int16_t thisView);\r
+ bool ChangKEYTESTView(int16_t thisView);\r
+ bool ChangeMGTESTView(int16_t thisView);\r
+ bool ChangeMPTESTView(int16_t thisView);\r
+\r
+ bool ChangeCAT1TESTView(int16_t thisView);\r
+ bool ClickFunc(int16_t interface);\r
+ void ChangeView(int16_t hideView, int16_t showView);\r
+ UIScrollView *GetSystemScrollView(int ViewId);\r
+\r
+ private:\r
+ void InitIView(void);\r
+ void initView_ext(int x,int y,int w,int h,int interval,const char *imagsrc);\r
+ void ClearAll(void);\r
+ bool SetTheSystemScrollView(void);\r
+ bool SetTheTitle(void);\r
+ UIButton *SetTheButton(ButtonConfig &buttonconfig, UIView::OnClickListener *clickListener);\r
+ UILabelButtonExt *SetTheButton_ext(ButtonConfig_ext_t &ButtonConfig_ext, UIView::OnClickListener *clickListener);\r
+ \r
+ testAboutView *test_about_view;\r
+ UIScrollView *SystemScrollView[20]{nullptr};\r
+ UILabel *SystemLabel{nullptr}; // 标题\r
+ UIButton *AboutTheWatchButton{nullptr};\r
+ UIButton *SuperviseButton = {nullptr};\r
+ UIButton *SystemLanguageButton = {nullptr};\r
+ UIButton *FactoryResetButton{nullptr};\r
+ UILabelButtonExt *SystemUpgradeButtonExt{nullptr};\r
+\r
+ testLCDView *test_LCD_view{nullptr};\r
+ testTPView *test_TP_view{nullptr};\r
+ testLUMView *test_lum_view{nullptr};\r
+ testCHANINGView *test_charging_view{nullptr};\r
+ testSPEAKView *test_speak_view{nullptr};\r
+ testMOTORView *test_motor_view{nullptr};\r
+ testcat1View *test_cat1_view{nullptr};\r
+ testbuttonView *test_KEY_view{nullptr};\r
+ testMagicView *test_MG_view{nullptr};\r
+\r
+ testmakephoneView *test_MP_view{nullptr};\r
+\r
+ bool initViewStatus{false};\r
+ };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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 <iostream>
+
+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
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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 <iostream>
+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
--- /dev/null
+#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<UIView::OnDragListener *>(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
--- /dev/null
+#include "producttest/include/testModel.h"
+
+namespace OHOS
+{
+
+ testModel *testModel::GetInstance(void)
+ {
+ static testModel instance;
+ return &instance;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "graphic_math.h"\r
+#include "string.h"\r
+#include "producttest/include/testPresenter.h"\r
+#include "font/font_global_manager.h"\r
+#include "font/ui_font.h"\r
+#include "language/LanguageInit.h"\r
+#include "../../../../../../drivers/peripheral/utils/custom_utils.h"\r
+#include "power_display_service.h"\r
+#include "components/ui_slider.h"\r
+\r
+#include "audio_capture_wrapper.h"\r
+namespace OHOS\r
+{\r
+\r
+ \r
+\r
+ static char* view_id_str[]=\r
+ {\r
+ "TP_1", "TP_2", "TP_3", "TP_4",\r
+ "TP_5", "TP_6", "TP_7", "TP_8", \r
+ "TP_9","TP_10", "TP_11", "TP_12",\r
+ "TP_13","TP_14", "TP_15", "TP_16",\r
+ };\r
+\r
+ struct TEST_ext_p\r
+ {\r
+ const int16_t viewId;\r
+ char *viewid_str;\r
+ bool enable_falg;\r
+ };\r
+ \r
+\r
+ // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与MainStopWatchView类中的特定成员函数指针进行了绑定。\r
+ static TEST_ext_p ViewMapper_t[] = \r
+ {\r
+ {VISON,"AboutTheWatchButton",true},\r
+ {LCD,"SuperviseButton",true},\r
+ {TP,"SystemLanguageButton",true},\r
+ {MAGETIC,"MAGETICButton",true},\r
+ {LUMINANCE,"luminanceButton",true},\r
+ {CHAR,"chargingButton",true},\r
+ {SPEAK,"speakButton",true},\r
+ {MOTOR,"motorButton",true},\r
+ {CAT1,"cat1button",true},\r
+ {BUTTON,"buttonbutton",true},\r
+ {MAKEPHONE,"makephonebutton",true},\r
+\r
+ };\r
+ // {FACTORYRESETVIEW,"FactoryResetButton",true},\r
+ // {SYSTEMLUPGRADE,"systemupgread",true},\r
+ // {TEST,"testButton",true}};\r
+ \r
+ // {ABOUTTHEWATCHVIEW, &SystemView::ChangeSystemAboutView},\r
+ // {SUPERVISEVIEW, &SystemView::ChangeSystemSuperviseView},\r
+ // {SYSTEMLANGUAGEVIEW, &SystemView::ChangeSystemLanguageView},\r
+\r
+ // 当前Presenter属性实例化的内存指针\r
+ static testPresenter *g_pSystemPresenter = nullptr;\r
+\r
+ testPresenter::testPresenter()\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::SystemPresenter");\r
+ g_pSystemPresenter = this;\r
+ //systemModel = testModel::GetInstance();\r
+ }\r
+\r
+ testPresenter::~testPresenter()\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::~SystemPresenter");\r
+ g_pSystemPresenter = nullptr;\r
+ }\r
+\r
+ testPresenter *testPresenter::GetInstance()\r
+ {\r
+\r
+ return g_pSystemPresenter;\r
+ }\r
+ \r
+ void testPresenter::OnStart()\r
+ {\r
+\r
+ Presenter<testView>::OnStart();\r
+ }\r
+\r
+ bool testPresenter::OnPress(UIView &view, const PressEvent &event)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::");\r
+ // for(int i=0;i<16;i++)\r
+ // // {\r
+ // // if(strcmp(view.GetViewId(),view_id_str[i]) == 0)\r
+ // // {\r
+ // // testTPView::GetInstance()->ChangeViewcolor(i);\r
+ \r
+ // // }\r
+ // }\r
+ return true;\r
+\r
+ }\r
+\r
+ void testPresenter::OnResume(void)\r
+ {\r
+\r
+ Presenter<testView>::OnResume();\r
+ }\r
+\r
+ void testPresenter::OnStop(void)\r
+ {\r
+\r
+ Presenter<testView>::OnStop();\r
+ }\r
+\r
+ bool testPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::");\r
+ if(strcmp(view.GetViewId(),"BrightnessControl") == 0 || strcmp(view.GetViewId(),"Brightnesview") == 0 )\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxx::");\r
+ uint8_t value= testLUMView::GetInstance()->get_slider_value();\r
+\r
+ const power_display_svr_api_t *display_api = power_display_svr_get_api();\r
+\r
+ if (display_api->set_brightness(value) != ERRCODE_SUCC)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ChangeBrightness: set_brightness fail!");\r
+ return false;\r
+ }\r
+\r
+ }\r
+ \r
+ \r
+ if(strcmp(view.GetViewId(),"TP_test") == 0)\r
+ {\r
+ testTPView::GetInstance()->ChangeViewcolor(event.GetLastPoint().x,event.GetLastPoint().y);\r
+ \r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
+ {\r
+ testView *p_SystemView = testView::GetInstance();\r
+\r
+ if(strcmp(view.GetViewId(),"TP_test") == 0 || strcmp(view.GetViewId(),"BrightnessControl") == 0)\r
+ {\r
+ return true;\r
+ }\r
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
+ {\r
+ for (int i = 1; i < MAX_TESTVIEWID; i++)\r
+ {\r
+ if (p_SystemView->GetSystemScrollView(i) != nullptr && p_SystemView->GetSystemScrollView(i)->IsVisible() == true)\r
+ {\r
+ p_SystemView->ChangeView(i, TESTVIEW);\r
+ break;\r
+ }\r
+ }\r
+ return true;\r
+ }\r
+ return false;\r
+ }\r
+\r
+ // 该点击回调主要用于在系统视图界面进行跳转视图\r
+ bool testPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+ {\r
+ testView *p_SystemView = testView::GetInstance();\r
+ int len=sizeof(ViewMapper_t)/sizeof(TEST_ext_p);\r
+ //int len=5;\r
+ // 根据控件id查找是哪个控件触发了点击回调\r
+\r
+ for(int i=0;i<len;i++)\r
+ {\r
+ if(strcmp(view.GetViewId(),ViewMapper_t[i].viewid_str) == 0)\r
+ {\r
+ if(ViewMapper_t[i].enable_falg==true)\r
+ testView::GetInstance()->ChangeView(TESTVIEW, ViewMapper_t[i].viewId);\r
+ return true;\r
+ }\r
+ }\r
+\r
+ if(strcmp(view.GetViewId(),"speak_play") == 0)\r
+ { \r
+ testSPEAKView::GetInstance()->Changspeak(true);\r
+ }\r
+ else if (strcmp(view.GetViewId(),"speak_puase") == 0)\r
+ {\r
+ testSPEAKView::GetInstance()->Changspeak(false);\r
+ }\r
+ \r
+ if(strcmp(view.GetViewId(),"MOTOR_play") == 0)\r
+ { \r
+ testMOTORView::GetInstance()->Changstatr(true);\r
+ }\r
+\r
+ if(strcmp(view.GetViewId(),"testmakephoneView") == 0)\r
+ { \r
+ testmakephoneView::GetInstance()->buttoncallback();\r
+ } \r
+\r
+ if(strcmp(view.GetViewId(),"dial_112") == 0)\r
+ { \r
+ testcat1View::GetInstance()->dial_112(true);\r
+ }\r
+ \r
+\r
+\r
+ return false;\r
+ }\r
+\r
+ bool testPresenter::OnKeyAct(UIView &view, const KeyEvent &event)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnKeyAct");\r
+ uint8_t keyID = event.GetKeyId();\r
+ uint8_t keystate=event.GetState();\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, ":xxxxxxx:%d",keyID);\r
+ // 如果是power键就返回上一级\r
+ if (keyID == 41 )\r
+ {\r
+ if(keystate)\r
+ testbuttonView::GetInstance()-> Changbutton(0,true);\r
+ else\r
+ testbuttonView::GetInstance()-> Changbutton(0,false);\r
+ \r
+ // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+ }\r
+ if (keyID == 0)\r
+ {\r
+ if(keystate)\r
+ testbuttonView::GetInstance()-> Changbutton(1,true);\r
+ else\r
+ testbuttonView::GetInstance()-> Changbutton(1,false);\r
+ \r
+ \r
+ // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();\r
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ // 该拖拽是用来处理系统视图(slice)的左滑退出事件和子视图的左滑退出到系统视图区分开\r
+ \r
+\r
+ /// @brief 简体中文单选按钮被选中\r
+ /// @param void\r
+ /// @return true 表示选中 ,false 表示未选中\r
+ \r
+\r
+ /// @brief 英语单选按钮被选中\r
+ /// @param void\r
+ /// @return true 表示选中 ,false 表示未选中\r
+ \r
+\r
+ /* -------------------------------------------------------------------------- */\r
+ // 获取语言类\r
+ //language *g_planguage = new language;\r
+ /* -------------------------------------------------------------------------- */\r
+ // 用来监听语言切换\r
+ \r
+}
\ No newline at end of file
--- /dev/null
+#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<UIView::OnDragListener *>(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<UIView::OnTouchListener *>(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<UIView::OnDragListener *>(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
--- /dev/null
+#include "producttest/include/testView.h"\r
+#include "producttest/include/testPresenter.h"\r
+\r
+#include "wearable_log.h"\r
+namespace OHOS\r
+{\r
+\r
+ static testView *g_pSystemView{nullptr};\r
+\r
+ struct test_ext\r
+ {\r
+ const int16_t viewId;\r
+ char *viewid_str;\r
+ char *Labe_str;\r
+ bool (testView::*func)(int16_t thisView);\r
+ };\r
+ static UILabelButtonExt *button[10]={NULL};\r
+ \r
+\r
+ // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与MainStopWatchView类中的特定成员函数指针进行了绑定。\r
+ static test_ext ViewMapper_t[] = {\r
+ {VISON,"AboutTheWatchButton","Verison",&testView::ChangeSystemAboutView},\r
+ {LCD,"SuperviseButton","LCD",&testView::ChangeLCDTESTView},\r
+ {TP,"SystemLanguageButton","TP", &testView::ChangeTPTESTView},\r
+ {MAGETIC,"MAGETICButton","Magetic", &testView::ChangeMGTESTView},\r
+ {LUMINANCE,"luminanceButton","luminance", &testView::ChangLUMTESTView},\r
+ {CHAR,"chargingButton","charging", &testView::ChangchargingTESTView},\r
+ {SPEAK,"speakButton","speak", &testView::ChangspeakTESTView},\r
+ {MOTOR,"motorButton","motor", &testView::ChangmotorTESTView},\r
+ {CAT1,"cat1button","CAT1", &testView::ChangeCAT1TESTView},\r
+ {BUTTON,"buttonbutton","button" ,&testView::ChangKEYTESTView},\r
+ {MAKEPHONE,"makephonebutton","makephone" ,&testView::ChangeMPTESTView},\r
+ // {FACTORYRESETVIEW,"FactoryResetButton","恢复出厂", &testView::ChangeSystemAboutView},\r
+ // {SYSTEMLUPGRADE,"systemupgread","系统升级",&testView::ChangeSystemAboutView},\r
+ // {TEST,"testButton","测试模式", &testView::ChangeSystemAboutView},\r
+ \r
+ // {ABOUTTHEWATCHVIEW, &SystemView::ChangeSystemAboutView},\r
+ // {SUPERVISEVIEW, &SystemView::ChangeSystemSuperviseView},\r
+ // {SYSTEMLANGUAGEVIEW, &SystemView::ChangeSystemLanguageView},\r
+ // {FACTORYRESETVIEW, &SystemView::ChangeSystemFactoryResetView},\r
+ };\r
+ \r
+ testView::testView()\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemView");\r
+ g_pSystemView = this;\r
+ }\r
+\r
+ testView::~testView()\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::~SystemView");\r
+ ClearAll();\r
+ g_pSystemView = nullptr;\r
+ }\r
+\r
+ testView *testView::GetInstance()\r
+ {\r
+ return g_pSystemView;\r
+ }\r
+\r
+ void testView::ClearAll()\r
+ {\r
+ if (initViewStatus == true)\r
+ {\r
+ // SystemScrollView[SYSTEMVIEW]->RemoveAll();\r
+ // UIView::OnDragListener *draglistener = SystemScrollView[SYSTEMVIEW]->GetOnDragListener();\r
+ // if (draglistener != nullptr)\r
+ // {\r
+ // delete draglistener;\r
+ // draglistener = nullptr;\r
+ // }\r
+ // delete p_SystemAboutTheWatchView;\r
+ // p_SystemAboutTheWatchView = nullptr;\r
+ // delete p_SystemSuperviseView;\r
+ // p_SystemSuperviseView = nullptr;\r
+ // delete p_SystemLanguageView;\r
+ // p_SystemLanguageView = nullptr;\r
+ // delete p_SystemFactoryResetView;\r
+ // p_SystemFactoryResetView = nullptr;\r
+ // delete SystemLabel;\r
+ // SystemLabel = nullptr;\r
+ // delete AboutTheWatchButton;\r
+ // AboutTheWatchButton = nullptr;\r
+ // delete SuperviseButton;\r
+ // SuperviseButton = nullptr;\r
+ // delete SystemLanguageButton;\r
+ // SystemLanguageButton = nullptr;\r
+ // delete FactoryResetButton;\r
+ // FactoryResetButton = nullptr;\r
+\r
+ // delete SystemScrollView[SYSTEMVIEW];\r
+ // SystemScrollView[SYSTEMVIEW] = nullptr;\r
+ }\r
+ }\r
+\r
+ /// @brief 设置SystemScrollView\r
+ /// @param void\r
+ /// @return true 设置成功,false 失败\r
+ bool testView::SetTheSystemScrollView(void)\r
+ {\r
+ SystemScrollView[TESTVIEW] = new UIScrollView();\r
+ if (SystemScrollView[TESTVIEW] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemScrollView new fail!");\r
+ return false;\r
+ }\r
+ SystemScrollView[TESTVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+ SystemScrollView[TESTVIEW]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+ SystemScrollView[TESTVIEW]->SetScrollBlankSize(35);\r
+ SystemScrollView[TESTVIEW]->SetReboundSize(50);\r
+ SystemScrollView[TESTVIEW]->SetDirection(1);\r
+ //UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(new SystemViewOnDragListener());\r
+ // if (draglistener == nullptr)\r
+ // {\r
+ // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::draglistener can not be nullptr!");\r
+ // return false;\r
+ // }\r
+ //SystemScrollView[TESTVIEW]->SetOnDragListener(draglistener);\r
+ SystemScrollView[TESTVIEW]->SetTouchable(true);\r
+ SystemScrollView[TESTVIEW]->SetDraggable(true);\r
+ return true;\r
+ }\r
+\r
+ /// @brief 设置标题\r
+ /// @param void\r
+ /// @return true 设置成功,false 失败\r
+ bool testView::SetTheTitle(void)\r
+ {\r
+ SystemLabel = new UILabel();\r
+ if (SystemLabel == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SystemLabel new fail!");\r
+ return false;\r
+ }\r
+ SystemLabel->SetPosition(203, 52);\r
+ SystemLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+ SystemLabel->SetStyle(STYLE_TEXT_FONT, 30);\r
+ SystemLabel->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+ SystemLabel->SetText("GNT TEST");\r
+ SystemLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+ SystemLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+ SystemLabel->SetRollSpeed(6);\r
+ SystemLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+ return true;\r
+ }\r
+\r
+ /// @brief 设置按钮\r
+ /// @param button\r
+ /// @return true 设置成功,false 失败\r
+ \r
+ UILabelButtonExt *testView::SetTheButton_ext(ButtonConfig_ext_t &buttonconfig, UIView::OnClickListener *clickListener)\r
+ {\r
+ UILabelButtonExt *button = new UILabelButtonExt();\r
+ if (button == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SystemView::SetTheButton: button new fail!");\r
+ return nullptr;\r
+ }\r
+ button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);\r
+ button->SetViewId(buttonconfig.ViewId);\r
+ button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+ button->SetImageSrc(buttonconfig.ImageSrc, buttonconfig.ImageSrc);\r
+ button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+ button->SetOnClickListener(clickListener);\r
+\r
+ button->SetText(buttonconfig.str);\r
+ button->SetAlign(TEXT_ALIGNMENT_LEFT);\r
+ button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y );\r
+ button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, buttonconfig.Fontsize);\r
+ //button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+ button->SetImagePosition(326, 37);\r
+ return button;\r
+ }\r
+\r
+ \r
+\r
+ void testView::initView_ext(int x,int y,int w,int h,int interval,const char *imagsrc)\r
+ {\r
+ if (!SetTheSystemScrollView())\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheSystemScrollView() fail!");\r
+ return;\r
+ }\r
+ if (!SetTheTitle())\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::SetTheTitle() fail!");\r
+ return;\r
+ }\r
+ /* -------------------------------------------------------------------------- */\r
+ UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());\r
+ /* -------------------------------------------------------------------------- */\r
+ ButtonConfig_ext_t buttonconfig;\r
+ buttonconfig.x = x;\r
+ buttonconfig.y = y;\r
+ buttonconfig.w = w;\r
+ buttonconfig.h = h;\r
+\r
+ int len =sizeof(ViewMapper_t)/sizeof(test_ext);\r
+\r
+ for(int i=0;i<len;i++)\r
+ {\r
+ buttonconfig.str=ViewMapper_t[i].Labe_str;\r
+ buttonconfig.ViewId = ViewMapper_t[i].viewid_str;\r
+ buttonconfig.ImageSrc = imagsrc;\r
+ buttonconfig.label_x=40;\r
+ buttonconfig.label_y=0;\r
+ buttonconfig.Fontsize=30;\r
+ buttonconfig.ALIGN=TEXT_ALIGNMENT_LEFT;\r
+ button[i] = SetTheButton_ext(buttonconfig, clickListener);\r
+ buttonconfig.y+=interval;\r
+\r
+ }\r
+ /* -------------------------------------------------------------------------- */\r
+ \r
+ }\r
+\r
+ \r
+ // 0.跳转到系统视图,其他视图都市通过这个视图跳转\r
+ bool testView::ChangeSystemView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemView");\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ // 1.跳转到关于手表\r
+ bool testView::ChangeSystemAboutView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_about_view = new testAboutView();\r
+ if (test_about_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_about_view->SystemAbouTheWatchtInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangeLCDTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_LCD_view = new testLCDView();\r
+ if (test_LCD_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_LCD_view->testLCDInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangeTPTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_TP_view = new testTPView();\r
+ if (test_TP_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_TP_view->testTPInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangeMGTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_MG_view = new testMagicView();\r
+ if (test_MG_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_MG_view->testmagicInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangLUMTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_lum_view = new testLUMView();\r
+ if (test_lum_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_lum_view->testLUMInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+ \r
+ bool testView::ChangchargingTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_charging_view = new testCHANINGView();\r
+ if (test_charging_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_charging_view->testCHANINGInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangspeakTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_speak_view = new testSPEAKView();\r
+ if (test_speak_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_speak_view->testSPEAKInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangmotorTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_motor_view = new testMOTORView();\r
+ if (test_motor_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_motor_view->testMOTORInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangeCAT1TESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_cat1_view = new testcat1View();\r
+ if (test_cat1_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_cat1_view->testcat1InitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangKEYTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_KEY_view = new testbuttonView();\r
+ if (test_KEY_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_KEY_view->testBUTTONInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ bool testView::ChangeMPTESTView(int16_t thisView)\r
+ {\r
+ if (SystemScrollView[thisView] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemAboutView");\r
+ test_MP_view = new testmakephoneView();\r
+ if (test_MP_view == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: new scrollView[%d] fail", thisView);\r
+ return false;\r
+ }\r
+ SystemScrollView[thisView] = test_MP_view->testmakephoneInitIView();\r
+ RootView::GetInstance()->Add(SystemScrollView[thisView]);\r
+ }\r
+ return true;\r
+ }\r
+\r
+ UIScrollView *testView::GetSystemScrollView(int ViewId)\r
+ {\r
+ if (SystemScrollView[ViewId] == nullptr)\r
+ {\r
+ return nullptr;\r
+ }\r
+ return SystemScrollView[ViewId];\r
+ }\r
+\r
+ /* -------------------------------------------------------------------------- */\r
+ // 1.MainStopWatchViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。\r
+ \r
+ // 3.根据传入的interface参数执行相应视图ID关联的成员函数。\r
+ bool testView::ClickFunc(int16_t interface)\r
+ {\r
+ int funcSize = sizeof(ViewMapper_t) / sizeof(ViewMapper_t[TESTVIEW]);\r
+ for (int i = 0; i < funcSize; i++)\r
+ {\r
+ if (interface == ViewMapper_t[i].viewId)\r
+ {\r
+ bool jug = (this->*(ViewMapper_t[i].func))(interface);\r
+ if (jug == false)\r
+ {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+ }\r
+ return false;\r
+ }\r
+\r
+ // 4.切换视图\r
+ void testView::ChangeView(int16_t hideView, int16_t showView)\r
+ {\r
+ if (hideView > MAX_TESTVIEWID)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: SystemViewId Overstep ones bounds");\r
+ return;\r
+ }\r
+ SystemScrollView[hideView]->SetVisible(false);\r
+ ClickFunc(showView);\r
+ SystemScrollView[showView]->SetVisible(true);\r
+ Draw();\r
+ }\r
+ /* -------------------------------------------------------------------------- */\r
+\r
+ void testView::OnStart()\r
+ {\r
+ View<testPresenter>::OnStart();\r
+ //InitIView();\r
+ initView_ext(43,120,380,100,120,"/user/res/SETTING_NEXT.bin");\r
+ }\r
+\r
+ void testView::OnSetUpView()\r
+ {\r
+ View<testPresenter>::OnSetUpView();\r
+ if (SystemScrollView[TESTVIEW] == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView:: OnSetUpView has nullptr");\r
+ return;\r
+ }\r
+ \r
+ SystemScrollView[TESTVIEW]->Add(SystemLabel);\r
+\r
+ int len =sizeof(ViewMapper_t)/sizeof(test_ext);\r
+\r
+ for(int i=0;i<len;i++)\r
+ {\r
+ SystemScrollView[TESTVIEW]->Add(button[i]);\r
+ }\r
+ // SystemScrollView[SYSTEMVIEW]->Add(SuperviseButton);\r
+ // SystemScrollView[SYSTEMVIEW]->Add(SystemLanguageButton);\r
+ // SystemScrollView[SYSTEMVIEW]->Add(FactoryResetButton);\r
+ // SystemScrollView[SYSTEMVIEW]->Add(SystemUpgradeButtonExt);\r
+\r
+ RootView::GetInstance()->Add(SystemScrollView[TESTVIEW]);\r
+ Draw();\r
+ }\r
+\r
+ void testView::OnTearDownView()\r
+ {\r
+\r
+ View<testPresenter>::OnTearDownView();\r
+ return;\r
+ }\r
+\r
+ void testView::OnStop()\r
+ {\r
+\r
+ View<testPresenter>::OnStop();\r
+ RootView::GetInstance()->RemoveAll();\r
+ return;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+#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<UIView::OnDragListener *>(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
--- /dev/null
+#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<UIView::OnClickListener *>(testPresenter::GetInstance());
+ // button->SetOnClickListener(touchListener);
+
+ // UIView::OnDragListener *drgListener = static_cast<UIView::OnDragListener *>(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<UIView::OnDragListener *>(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
--- /dev/null
+#include "wearable_log.h"
+#include "custom_utils.h"
+#include "producttest/include/testPresenter.h"
+#include "producttest/include/testcat1.h"
+#include "AlarmClockModel.h"
+#include "cmsis_os2.h"
+#include "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<UIView::OnClickListener *>(testPresenter::GetInstance());
+ button->SetOnClickListener(touchListener);
+
+ // UIView::OnDragListener *drgListener = static_cast<UIView::OnDragListener *>(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<UIView::OnDragListener *>(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
--- /dev/null
+#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<UIView::OnDragListener *>(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<UIView::OnTouchListener *>(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<UIView::OnDragListener *>(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
--- /dev/null
+#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<UIView::OnDragListener *>(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
--- /dev/null
+#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<UIView::OnDragListener *>(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
--- /dev/null
+#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<UIView::OnClickListener *>(testPresenter::GetInstance());
+ button->SetOnClickListener(touchListener);
+
+ // UIView::OnDragListener *drgListener = static_cast<UIView::OnDragListener *>(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<UIView::OnDragListener *>(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
--- /dev/null
+#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<UIView::OnClickListener *>(testPresenter::GetInstance());
+ button->SetOnClickListener(touchListener);
+
+ // UIView::OnDragListener *drgListener = static_cast<UIView::OnDragListener *>(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<UIView::OnDragListener *>(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
--- /dev/null
+#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<UIView::OnClickListener *>(testPresenter::GetInstance());
+ button->SetOnClickListener(touchListener);
+
+ // UIView::OnDragListener *drgListener = static_cast<UIView::OnDragListener *>(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<UIView::OnDragListener *>(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
void AlarmGetClockNum(void);\r
int AlarmPlayerStat();\r
int AlarmPlayerInit(void);\r
+ int AlarmPlayerInit_BY_fir_name(char *);\r
+\r
int AlarmPlayerStart();\r
+ int testPlayerStart(char *);\r
int AlarmPlayerStop();\r
private:\r
void SetAlarmId(uint8_t id);\r
${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
${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
#include "PhoneService.h"
#include "power_display_service.h"
#include "cat1_server.h"
+#include "testchanging.h"
+#include "testcat1.h"
namespace OHOS {
#ifdef __cplusplus
{
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)
{
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;
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);
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*/
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
}
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
}