From: Caisking <3449750381@qq.com> Date: Wed, 10 Apr 2024 12:05:26 +0000 (+0800) Subject: 搭建训练信息接收以及处理 X-Git-Tag: release_V1.2.70_20241020_135402~1200^2~3^2~3 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=25aeb58b87429ce83feb69ff1fc98015e47dea58;p=mirrors%2FFD230.git 搭建训练信息接收以及处理 --- diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index dbd97e527..0411c18a4 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -107,6 +107,7 @@ set(PRIVATE_HEADER ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include + ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/cywee/ ${ROOT_DIR}/open_source/openharmony/foundation/distributedschedule/samgr_lite/interfaces/kits/samgr ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/include/dial @@ -467,12 +468,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingSetTimePresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingSetCaluliView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingSetCaluliPresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingControlView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingControlPresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingDataView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingDataPresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingDetailView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingDetailPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnoteView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnotePresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnote2View.cpp @@ -481,8 +476,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEnddataPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinPresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingMusicView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingMusicPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingStrongView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingStrongPresenter.cpp diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h index 3983010e2..ef60514fa 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h @@ -71,7 +71,6 @@ typedef enum : uint16_t VIEW_SAVEBAT, // 省电模式界面 /* ----------------------------------- 训练 ----------------------------------- */ VIEW_TRAINING, // 训练 - VIEW_TRAININGMUSIC, // 训练音乐 VIEW_TRAININGNOMAL, // 正常训练开始界面(除骑行,健走,跑步外) VIEW_TRAININGSET, // 训练目标(时长,卡路里) VIEW_TRAININGSETTIME, // 设置训练时长 @@ -79,9 +78,6 @@ typedef enum : uint16_t VIEW_TRAININGSETDIST, // 设置训练路程 VIEW_TRAININGSETSTEP, // 设置训练步数 VIEW_TRAININGCRAD, // 训练控制卡片 - VIEW_TRAININGCONTROL, // 训练控制(包括结束,暂停,继续训练) - VIEW_TRAININGDATA, // 训练数据 - VIEW_TRAININGDETAIL, // 详细训练数据 VIEW_TRAININGENDNOTE, // 结束训练提醒 VIEW_TRAININGENDNOTE2, // 结束训练时间太短 VIEW_TRAININGENDDATA, // 训练结束详细数据 diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h index b33ebdc5b..085da84fb 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h @@ -11,11 +11,11 @@ namespace OHOS public: static NativeLauncher &GetInstance(void); void InitNativeLauncher(void); - void InitMainSlice(void); - void InitSetDesktopSlice(void); - void InitSetCardSlice(void); - void InitAddCardSlice(void); - void InitSetDialSlice(void); + void InitMainSlice(void); + void InitSetDesktopSlice(void); + void InitSetCardSlice(void); + void InitAddCardSlice(void); + void InitSetDialSlice(void); void InitMainSampleSlice(void); void InitSettingSlice(void); @@ -64,7 +64,6 @@ namespace OHOS void InitMessageSlice(void); /* ----------------------------------- 训练 ----------------------------------- */ void InitTraingSlice(void); - void InitTraingMusicSlice(void); void InitTraingNomalSlice(void); void InitTraingSetSlice(void); void InitTraingStrongSlice(void); @@ -72,10 +71,7 @@ namespace OHOS void InitTraingSetCaluliSlice(void); void InitTraingSetDistSlice(void); void InitTraingSetStepSlice(void); - void InitTraingControlSlice(void); void InitTraingCardSlice(void); - void InitTraingDataSlice(void); - void InitTraingDetailSlice(void); void InitTraingEndnoteSlice(void); void InitTraingEndnote2Slice(void); void InitTraingEnddataSlice(void); @@ -96,7 +92,7 @@ namespace OHOS void InitTraingRestSlice(void); // 休闲训练 void InitTraingBallSlice(void); // 球类训练 void InitTraingAquaticSlice(void); // 水上训练 - void InitTraingOtherSlice(void); // 其他训练 + void InitTraingOtherSlice(void); // 其他训练 void InitTraingRecordSlice(void); // 训练记录 diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index f1d2c5cf2..e1f13343e 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -166,12 +166,6 @@ #include "traing/include/TraingSetDistView.h" #include "traing/include/TraingSetSeptPresenter.h" #include "traing/include/TraingSetSeptView.h" -#include "traing/include/TraingControlPresenter.h" -#include "traing/include/TraingControlView.h" -#include "traing/include/TraingDataPresenter.h" -#include "traing/include/TraingDataView.h" -#include "traing/include/TraingDetailPresenter.h" -#include "traing/include/TraingDetailView.h" #include "traing/include/TraingEndnotePresenter.h" #include "traing/include/TraingEndnoteView.h" #include "traing/include/TraingEndnote2Presenter.h" @@ -182,8 +176,6 @@ #include "traing/include/TraingStrongView.h" #include "traing/include/TraingWinPresenter.h" #include "traing/include/TraingWinView.h" -#include "traing/include/TraingMusicView.h" -#include "traing/include/TraingMusicPresenter.h" /* ---------------------------------- GPS训练 --------------------------------- */ #include "traing/training_GPS/include/TraingGPSPresenter.h" #include "traing/training_GPS/include/TraingGPSView.h" @@ -304,7 +296,6 @@ namespace OHOS {VIEW_SAVEBAT, &NativeLauncher::InitSaveBatSlice}, /* ----------------------------------- 训练 ----------------------------------- */ {VIEW_TRAINING, &NativeLauncher::InitTraingSlice}, // 训练 - {VIEW_TRAININGMUSIC, &NativeLauncher::InitTraingMusicSlice}, // 训练音乐卡片 {VIEW_TRAININGNOMAL, &NativeLauncher::InitTraingNomalSlice}, // 正常训练初始界面 {VIEW_TRAININGSET, &NativeLauncher::InitTraingSetSlice}, // 训练目标设置界面 {VIEW_TRAININGGPSSET, &NativeLauncher::InitTraingGPSSetSlice}, // 训练GPS目标设置界面 @@ -312,10 +303,7 @@ namespace OHOS {VIEW_TRAININGSETCALULI, &NativeLauncher::InitTraingSetCaluliSlice}, // 设置目标卡路里 {VIEW_TRAININGSETDIST, &NativeLauncher::InitTraingSetDistSlice}, // 设置目标距离 {VIEW_TRAININGSETSTEP, &NativeLauncher::InitTraingSetStepSlice}, // 设置目标步数 - {VIEW_TRAININGCONTROL, &NativeLauncher::InitTraingControlSlice}, // 训练控制 {VIEW_TRAININGCRAD, &NativeLauncher::InitTraingCardSlice}, // 训练卡片 - {VIEW_TRAININGDATA, &NativeLauncher::InitTraingDataSlice}, // 训练数据 - {VIEW_TRAININGDETAIL, &NativeLauncher::InitTraingDetailSlice}, // 详细训练数据 {VIEW_TRAININGENDNOTE, &NativeLauncher::InitTraingEndnoteSlice}, // 训练结束提醒 {VIEW_TRAININGENDNOTE2, &NativeLauncher::InitTraingEndnote2Slice}, // 训练结束时间太短提醒 {VIEW_TRAININGENDDATA, &NativeLauncher::InitTraingEnddataSlice}, // 训练结束详细数据 @@ -950,26 +938,12 @@ namespace OHOS SliceProxy *traingsetstepview = new AbilitySliceProxy; NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGSETSTEP, traingsetstepview); } - void NativeLauncher::InitTraingControlSlice(void) - { - SliceProxy *traingcontrolview = new AbilitySliceProxy; - NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGCONTROL, traingcontrolview); - } void NativeLauncher::InitTraingCardSlice(void) { SliceProxy *traingcardview = new AbilitySliceProxy; NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGCRAD, traingcardview); } - void NativeLauncher::InitTraingDataSlice(void) - { - SliceProxy *traingdataview = new AbilitySliceProxy; - NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGDATA, traingdataview); - } - void NativeLauncher::InitTraingDetailSlice(void) - { - SliceProxy *traingdetailview = new AbilitySliceProxy; - NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGDETAIL, traingdetailview); - } + void NativeLauncher::InitTraingEndnoteSlice(void) { SliceProxy *traingendnoteview = new AbilitySliceProxy; @@ -995,11 +969,7 @@ namespace OHOS SliceProxy *traingrecordview = new AbilitySliceProxy; NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAINING_RECORD, traingrecordview); } - void NativeLauncher::InitTraingMusicSlice(void) - { - SliceProxy *traingmusicview = new AbilitySliceProxy; - NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGMUSIC, traingmusicview); - } + /* -------------------------------------------------------------------------- */ void NativeLauncher::InitTraingGPSSlice(void) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlPresenter.h deleted file mode 100644 index 5815522d2..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlPresenter.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef _TraingControl_PRESENTER_H -#define _TraingControl_PRESENTER_H - -#include "Presenter.h" -#include "TraingControlView.h" - -namespace OHOS -{ - class TraingControlView; - - class TraingControlPresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener - { - public: - TraingControlPresenter(); - virtual ~TraingControlPresenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - std::string test = "暂停"; - static TraingControlPresenter *GetInstance(); - - private: - // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView &view, const DragEvent &event) override; - bool OnDragEnd(UIView& view, const DragEvent& event) override; - }; -} // namespace OHOS - -#endif // SLEEPDETAIL_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlView.h deleted file mode 100644 index 743699b1a..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingControlView.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef _TraingControl_VIEW_H -#define _TraingControl_VIEW_H - -#include "BaseView.h" -#include "View.h" -#include -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_label_ext.h" -#include "components/ui_image_view.h" -#include "components/ui_button.h" -#include "components/ui_image_animator.h" -#include "components/ui_label_button_ext.h" -#include "components/ui_chart.h" -#include "components/ui_list.h" -#include "components/icon_adapter.h" -#include "wearable_log.h" -#include "ohos_types.h" -#include "components/ui_card_page.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" -#include "TraingControlPresenter.h" -namespace OHOS -{ -#define BUTTONSTOP "button1" -#define BUTTONPAUSE "button2" -#define BUTTONCONTINUE "button3" - - - - class TraingControlPresenter; - class TraingControlView : public View - { - - public: - TraingControlView(); - virtual ~TraingControlView(); - static TraingControlView *GetInstance(void); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; - void InitView(); - void DeInit(); - - void InitList(); - void PreLoad(void); - - //通过函数改变 - void SetLabel(); - void SetButton(); - - private: - UIView::OnDragListener *draglistener{nullptr}; - TraingControlView(TraingControlView &&) = delete; - TraingControlView &operator=(TraingControlView &&) = delete; - - UIViewGroup *container_ = nullptr; - - UILabelExt *label1_ = nullptr; - UILabelExt *label2_ = nullptr; - UILabelExt *label3_ = nullptr; - UILabelExt *label4_ = nullptr; - - UIImageView *image1_ = nullptr; - - UIButton *button1_ = nullptr; - UIButton *button2_ = nullptr; - - bool viewiInitStatus{false}; - }; -} // namespace OHOS -#endif // TraingControl_PRESENTER_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataPresenter.h deleted file mode 100644 index 0de0fabbc..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataPresenter.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _TraingData_PRESENTER_H -#define _TraingData_PRESENTER_H - -#include "Presenter.h" -#include "TraingDataView.h" - -namespace OHOS -{ - class TraingDataView; - - class TraingDataPresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener - { - public: - TraingDataPresenter(); - virtual ~TraingDataPresenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - static TraingDataPresenter *GetInstance(); - - private: - // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView &view, const DragEvent &event) override; - bool OnDragEnd(UIView& view, const DragEvent& event) override; - }; -} // namespace OHOS - -#endif // SLEEPDETAIL_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataView.h deleted file mode 100644 index 9b8696860..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDataView.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef _TraingData_VIEW_H -#define _TraingData_VIEW_H - -#include "BaseView.h" -#include "View.h" -#include -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_label_ext.h" -#include "components/ui_image_view.h" -#include "components/ui_button.h" -#include "components/ui_image_animator.h" -#include "components/ui_label_button_ext.h" -#include "components/ui_chart.h" -#include "components/ui_list.h" -#include "components/icon_adapter.h" -#include "wearable_log.h" -#include "ohos_types.h" -#include "components/ui_card_page.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" -#include "TraingDataPresenter.h" -namespace OHOS -{ -#define BUTTONNOTE "button1" - - - class TraingDataPresenter; - class TraingDataView : public View - { - - public: - TraingDataView(); - virtual ~TraingDataView(); - static TraingDataView *GetInstance(void); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; - void InitView(); - void DeInit(); - - void InitList(); - void PreLoad(void); - - // 通过函数改变 - void SetLabel(); - void SetButton(); - - private: - UIView::OnDragListener *draglistener{nullptr}; - TraingDataView(TraingDataView &&) = delete; - TraingDataView &operator=(TraingDataView &&) = delete; - - UIViewGroup *container_ = nullptr; - - UILabelExt *label1_ = nullptr; - UILabelExt *label2_ = nullptr; - UILabelExt *label3_ = nullptr; - UILabelExt *label4_ = nullptr; - UILabelExt *label5_ = nullptr; - - UIImageView *image1_ = nullptr; - UIImageView *image2_ = nullptr; - UIImageView *image3_ = nullptr; - UIImageView *image4_ = nullptr; - UIImageView *image5_ = nullptr; - UIImageView *image6_ = nullptr; - - UIButton *button1_ = nullptr; - bool viewiInitStatus{false}; - }; -} // namespace OHOS -#endif // TraingData_PRESENTER_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailPresenter.h deleted file mode 100644 index 5f0683b04..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailPresenter.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _TraingDetail_PRESENTER_H -#define _TraingDetail_PRESENTER_H - -#include "Presenter.h" -#include "TraingDetailView.h" - -namespace OHOS -{ - class TraingDetailView; - - class TraingDetailPresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener - { - public: - TraingDetailPresenter(); - virtual ~TraingDetailPresenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - static TraingDetailPresenter *GetInstance(); - - private: - // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView &view, const DragEvent &event) override; - bool OnDragEnd(UIView& view, const DragEvent& event) override; - }; -} // namespace OHOS - -#endif // SLEEPDETAIL_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailView.h deleted file mode 100644 index 1d1d68c54..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingDetailView.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef _TraingDetail_VIEW_H -#define _TraingDetail_VIEW_H - -#include "BaseView.h" -#include "View.h" -#include -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_label_ext.h" -#include "components/ui_image_view.h" -#include "components/ui_button.h" -#include "components/ui_image_animator.h" -#include "components/ui_label_button_ext.h" -#include "components/ui_chart.h" -#include "components/ui_list.h" -#include "components/icon_adapter.h" -#include "wearable_log.h" -#include "ohos_types.h" -#include "components/ui_card_page.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" -#include "TraingDetailPresenter.h" -namespace OHOS -{ - class TraingDetailPresenter; - class TraingDetailView : public View - { - - public: - TraingDetailView(); - virtual ~TraingDetailView(); - static TraingDetailView *GetInstance(void); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; - void InitView(); - void DeInit(); - - void InitList(); - void PreLoad(void); - - // 通过函数改变 - void SetLabel(); - void SetButton(); - - private: - UIView::OnDragListener *draglistener{nullptr}; - TraingDetailView(TraingDetailView &&) = delete; - TraingDetailView &operator=(TraingDetailView &&) = delete; - - UIViewGroup *container_ = nullptr; - - UILabelExt *label1_ = nullptr; - UILabelExt *label2_ = nullptr; - UILabelExt *label3_ = nullptr; - UILabelExt *label4_ = nullptr; - UILabelExt *label5_ = nullptr; - UILabelExt *label6_ = nullptr; - UILabelExt *label7_ = nullptr; - UILabelExt *label8_ = nullptr; - - UIImageView *image1_ = nullptr; - UIImageView *image2_ = nullptr; - UIImageView *image3_ = nullptr; - UIImageView *image4_ = nullptr; - UIImageView *image5_ = nullptr; - UIImageView *image6_ = nullptr; - UIImageView *image7_ = nullptr; - - bool viewiInitStatus{false}; - }; -} // namespace OHOS -#endif // TraingDetail_PRESENTER_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h index f89c87f16..aa9fa12da 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h @@ -35,6 +35,9 @@ #include "traing/include/TraingModel.h" #include "traing/Training_UiConfig.h" +#include "cywee_service.h" +#include "cywee_hal.h" + #include struct QuickTraining @@ -57,64 +60,65 @@ struct QuickTraining }; #ifdef __cplusplus -extern "C" { -#endif -struct Trainingdata_hard -{ - uint32_t num; -}; -/* -"src":0, -"ty":0, -"st":1657865201, -"sp":1657867001, -"tgt":0, -"tg":5000, -"pg":60, -"du":1800, -"ca":2355,//卡路里为该数值乘以0.1 -"di":3000, -"hr":127, -"stp":10000 -*/ -struct Trainingdata +extern "C" { - //0:手表开启的训练1:APP开启的训练 - uint32_t src; - //0:健身类1:舞蹈类2:休闲运动3:球类4:水上项目5:冰上项目6:极限运动 7:其他 - uint32_t bt; - //训练类型0:健走1:跑步2:骑行 - uint32_t ty; - //开始时间戳 - uint32_t st; - //结束时间戳 - uint32_t sp; - //训练目标类型 - uint32_t tgt; - //训练目标 - uint32_t tg; - //目标完成度 - uint32_t pg; - //训练时长 - uint32_t du; - //卡路里 - uint32_t ca; - //距离 - uint32_t di; - //平均心率 - uint32_t hr; - //步数 - uint32_t stp; - //训练强度 - uint32_t ti; - //圈数 - uint32_t cir; - //最高海拔高度 - uint32_t alt; -}; -Trainingdata *read_Trainingdata_data(uint32_t timedata,uint16_t offset); +#endif + struct Trainingdata_hard + { + uint32_t num; + }; + /* + "src":0, + "ty":0, + "st":1657865201, + "sp":1657867001, + "tgt":0, + "tg":5000, + "pg":60, + "du":1800, + "ca":2355,//卡路里为该数值乘以0.1 + "di":3000, + "hr":127, + "stp":10000 + */ + struct Trainingdata + { + // 0:手表开启的训练1:APP开启的训练 + uint32_t src; + // 0:健身类1:舞蹈类2:休闲运动3:球类4:水上项目5:冰上项目6:极限运动 7:其他 + uint32_t bt; + // 训练类型0:健走1:跑步2:骑行 + uint32_t ty; + // 开始时间戳 + uint32_t st; + // 结束时间戳 + uint32_t sp; + // 训练目标类型 + uint32_t tgt; + // 训练目标 + uint32_t tg; + // 目标完成度 + uint32_t pg; + // 训练时长 + uint32_t du; + // 卡路里 + uint32_t ca; + // 距离 + uint32_t di; + // 平均心率 + uint32_t hr; + // 步数 + uint32_t stp; + // 训练强度 + uint32_t ti; + // 圈数 + uint32_t cir; + // 最高海拔高度 + uint32_t alt; + }; + Trainingdata *read_Trainingdata_data(uint32_t timedata, uint16_t offset); -int write_Trainingdata_data(Trainingdata data); + int write_Trainingdata_data(Trainingdata data); #ifdef __cplusplus } @@ -131,6 +135,24 @@ namespace OHOS Pause, Continue }; + // 运动类型 + enum class ExerciseClass + { + NORMAL = 0, + TREADMILL, + OUTDOOR, + INDOOR, + FITNESS_PEDOMETER, + FREE_TRAINING, + }; + struct SportData + { + int calories; // 训练卡路里 + int duration; // 训练时长 + int steps; // 训练步数 + int distance; // 训练距离 + }; + class TraingModel { public: @@ -155,6 +177,12 @@ namespace OHOS void SetSportState(ExerciseState state); /*获取运动状态*/ ExerciseState GetSportState(); + /*获取运动类型*/ + ExerciseClass GetSportType(); + /*解析传输过来的数据*/ + void AnalysisData(cywee_result_t *cyweeInfo); + /*获取训练数据*/ + SportData *GetSportdata(); private: TraingModel(const TraingModel &) = delete; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMusicPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMusicPresenter.h deleted file mode 100644 index ac2fb70df..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMusicPresenter.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef _TraingMusic_PRESENTER_H -#define _TraingMusic_PRESENTER_H - -#include "Presenter.h" -#include "TraingMusicView.h" - -namespace OHOS -{ - class TraingMusicView; - - class TraingMusicPresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener - { - public: - TraingMusicPresenter(); - virtual ~TraingMusicPresenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - - static TraingMusicPresenter *GetInstance(); - - private: - // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView &view, const DragEvent &event) override; - bool OnDragEnd(UIView &view, const DragEvent &event) override; - }; -} // namespace OHOS - -#endif // SLEEPDETAIL_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMusicView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMusicView.h deleted file mode 100644 index 1e28558e2..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingMusicView.h +++ /dev/null @@ -1,53 +0,0 @@ - -#ifndef _TraingMusic_VIEW_H -#define _TraingMusic_VIEW_H - -#include "BaseView.h" -#include "View.h" -#include -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_label_ext.h" -#include "components/ui_image_view.h" -#include "components/ui_button.h" -#include "components/ui_image_animator.h" -#include "components/ui_label_button_ext.h" -#include "components/ui_chart.h" -#include "components/ui_list.h" -#include "components/icon_adapter.h" -#include "wearable_log.h" -#include "ohos_types.h" -#include "components/ui_card_page.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" -#include "PlayersView.h" -#include "TraingMusicPresenter.h" -namespace OHOS -{ - class TraingMusicPresenter; - class TraingMusicView : public View - { - - public: - TraingMusicView(); - virtual ~TraingMusicView(); - static TraingMusicView *GetInstance(void); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; - void InitView(); - void DeInit(); - void PreLoad(void); - - private: - UIView::OnDragListener *draglistener{nullptr}; - TraingMusicView(TraingMusicView &&) = delete; - TraingMusicView &operator=(TraingMusicView &&) = delete; - PlayersView *playersView{nullptr}; - UIViewGroup *container_ = nullptr; - bool viewiInitStatus{false}; - }; -} // namespace OHOS -#endif // TraingMusic_PRESENTER_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlPresenter.cpp deleted file mode 100644 index 67b9a1ed8..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlPresenter.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" -#include "NativeAbility.h" - -#include -#include -#include -#include "traing/include/TraingControlPresenter.h" -// #include "TraingControlView.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static TraingControlPresenter *g_pTraingControlPresenter = nullptr; - - TraingControlPresenter::TraingControlPresenter() - { - - g_pTraingControlPresenter = this; - } - - TraingControlPresenter::~TraingControlPresenter() - { - - g_pTraingControlPresenter = nullptr; - } - - TraingControlPresenter *TraingControlPresenter::GetInstance() - { - - return g_pTraingControlPresenter; - } - - void TraingControlPresenter::OnStart() - { - - Presenter::OnStart(); - } - - void TraingControlPresenter::OnPause(void) - { - - Presenter::OnPause(); - } - - void TraingControlPresenter::OnResume(void) - { - - Presenter::OnResume(); - } - - void TraingControlPresenter::OnStop(void) - { - - Presenter::OnStop(); - } - bool TraingControlPresenter::OnDrag(UIView &view, const DragEvent &event) - { - return true; - } - bool TraingControlPresenter::OnDragEnd(UIView &view, const DragEvent &event) - { - - if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA); - } - UNUSED(view); - return true; - } - - bool TraingControlPresenter::OnClick(UIView &view, const ClickEvent &event) - { - // 根据控件id查找是哪个控件触发了点击回调 - if (strcmp(view.GetViewId(), BUTTONSTOP) == 0) - { - // 模拟训练 - int random = rand() % 100; // 生成一个0~99的随机数 - if (random < 70) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDNOTE2); - } - else - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDNOTE); - } - } - - printf("********* test:%s\n", test.c_str()); - if (strcmp(view.GetViewId(), BUTTONPAUSE) == 0) - { - // 改变lable文字,button背景图片 - // test如果等于继续那就变为暂停,反之; - test == "ç»§ç»­" ? test = "暂停" : test = "ç»§ç»­"; - TraingControlView::GetInstance()->SetLabel(); - TraingControlView::GetInstance()->SetButton(); - } - printf("********* test:%s\n", test.c_str()); - // TraingControlView::GetInstance()->InitView(); - - return true; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlView.cpp deleted file mode 100644 index eda72268e..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlView.cpp +++ /dev/null @@ -1,217 +0,0 @@ - -#include "traing/include/TraingControlView.h" - -#include "common/image_cache_manager.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" -#include "UiConfig.h" -#include "ui_resource_image.h" -#include -#include "components/ui_button.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -namespace OHOS -{ - - static TraingControlView *g_pTraingControlView{nullptr}; - - TraingControlView::TraingControlView() - { - g_pTraingControlView = this; - } - - TraingControlView::~TraingControlView() - { - DeInit(); - g_pTraingControlView = nullptr; - } - - TraingControlView *TraingControlView::GetInstance() - { - - return g_pTraingControlView; - } - - /* InitView:初始化界面*/ - void TraingControlView ::InitView() - { - if (container_ == nullptr) - { - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, 466, 466); - container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - } - - // 初始化Button - TraingModel::GetInstance()->InitButton(button1_, 100, 202, 100, 100, BUTTONSTOP); - // Set additional property - button1_->SetImageSrc(SPORT_STOP_IMAGE, SPORT_STOP_IMAGE); - // 设置按钮的点击事件监听器为 TraingGPSPresenter 的实例 - button1_->SetOnClickListener(static_cast(TraingControlPresenter::GetInstance())); - container_->Add(button1_); - TraingModel::GetInstance()->InitButton(button2_, 255, 202, 100, 100, BUTTONPAUSE); - // Set additional property - button2_->SetImageSrc(SPORT_PAUSE_IMAGE, SPORT_PAUSE_IMAGE); - button2_->SetOnClickListener(static_cast(TraingControlPresenter::GetInstance())); - container_->Add(button2_); - - // 初始化Lable - TraingModel::GetInstance()->InitLabel(label1_, 188, 52, 90, 35, "label1", "训练中", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabel(label2_, 98, 110, 60, 35, "label2", "00:00:00", DEFAULT_VECTOR_FONT_FILENAME, 65); - TraingModel::GetInstance()->InitLabel(label3_, 125, 324, 60, 40, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabel(label4_, 280, 324, 60, 40, "label4", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 20); - container_->Add(label1_); - container_->Add(label2_); - container_->Add(label3_); - container_->Add(label4_); - - // 初始化Image - TraingModel::GetInstance()->InitImageView(image1_, 193, 421, 80, 20, "image1", CONTROL_POINT_IMAGE); - container_->Add(image1_); - } - - /******************************************************************************************************/ - void TraingControlView::SetLabel() - { - if (TraingControlPresenter::GetInstance()->test == "ç»§ç»­") - { - label4_->SetText("ç»§ç»­"); - } - else - { - label4_->SetText("暂停"); - } - } - - void TraingControlView::SetButton() - { - if (TraingControlPresenter::GetInstance()->test == "ç»§ç»­") - { - // button2_->SetViewId(BUTTONCONTINUE); - button2_->SetImageSrc(SPORT_CONTINUE_IMAGE, nullptr); - } - if (TraingControlPresenter::GetInstance()->test == "暂停") - { - // button2_->SetViewId(BUTTONPAUSE); - button2_->SetImageSrc(SPORT_PAUSE_IMAGE, nullptr); - } - } - /******************************************************************************************************/ - - /* DeInit:删除组件 */ - void TraingControlView::DeInit() - { - // 删除Label - container_->RemoveAll(); - if (label1_ != nullptr) - { - container_->Remove(label1_); - delete label1_; - label1_ = nullptr; - } - if (label2_ != nullptr) - { - container_->Remove(label2_); - delete label2_; - label2_ = nullptr; - } - if (label3_ != nullptr) - { - container_->Remove(label3_); - delete label3_; - label3_ = nullptr; - } - if (label4_ != nullptr) - { - container_->Remove(label4_); - delete label4_; - label4_ = nullptr; - } - - // 删除Button - if (button1_ != nullptr) - { - container_->Remove(button1_); - delete button1_; - button1_ = nullptr; - } - if (button2_ != nullptr) - { - container_->Remove(button2_); - delete button2_; - button2_ = nullptr; - } - - // 删除Image - if (image1_ != nullptr) - { - container_->Remove(image1_); - delete image1_; - image1_ = nullptr; - } - - // 删除容器 - if (container_ != nullptr) - { - container_->RemoveAll(); // 移除容器中的所有组件 - delete container_; - container_ = nullptr; - } - } - - void TraingControlView::PreLoad(void) - { - if (!viewiInitStatus) - { - InitView(); - viewiInitStatus = true; - } - } - void TraingControlView::OnStart() - { - container_ = new UIViewGroup(); - if (container_ == nullptr) - { - return; - } - container_->SetPosition(0, 0); - container_->SetWidth(Screen::GetInstance().GetWidth()); - container_->SetHeight(Screen::GetInstance().GetHeight()); - - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(TraingControlPresenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - - container_->SetTouchable(true); - container_->SetDraggable(true); - - PreLoad(); - RootView::GetInstance()->Add(container_); - } - - void TraingControlView::OnSetUpView() - { - - View::OnSetUpView(); - Draw(); - } - - void TraingControlView::OnTearDownView() - { - - View::OnTearDownView(); - return; - } - - void TraingControlView::OnStop() - { - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataPresenter.cpp deleted file mode 100644 index 9e73e69b6..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataPresenter.cpp +++ /dev/null @@ -1,89 +0,0 @@ - -#include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" -#include "NativeAbility.h" - -#include -#include -#include -#include "traing/include/TraingDataPresenter.h" -// #include "TraingDataView.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static TraingDataPresenter *g_pTraingDataPresenter = nullptr; - - TraingDataPresenter::TraingDataPresenter() - { - g_pTraingDataPresenter = this; - } - - TraingDataPresenter::~TraingDataPresenter() - { - g_pTraingDataPresenter = nullptr; - } - - TraingDataPresenter *TraingDataPresenter::GetInstance() - { - return g_pTraingDataPresenter; - } - - void TraingDataPresenter::OnStart() - { - Presenter::OnStart(); - } - - void TraingDataPresenter::OnPause(void) - { - Presenter::OnPause(); - } - - void TraingDataPresenter::OnResume(void) - { - Presenter::OnResume(); - } - - void TraingDataPresenter::OnStop(void) - { - Presenter::OnStop(); - } - bool TraingDataPresenter::OnDrag(UIView &view, const DragEvent &event) - { - return true; - } - bool TraingDataPresenter::OnDragEnd(UIView &view, const DragEvent &event) - { - - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); - } - if (event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDETAIL); - } - if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMUSIC); - } - UNUSED(view); - return true; - } - - bool TraingDataPresenter::OnClick(UIView &view, const ClickEvent &event) - { - // 根据控件id查找是哪个控件触发了点击回调 - if (strcmp(view.GetViewId(), BUTTONNOTE) == 0) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGSTRONG); - } - if (strcmp(view.GetViewId(), BUTTONNOTE) == 0) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGSTRONG); - } - return true; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataView.cpp deleted file mode 100644 index 52026924c..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataView.cpp +++ /dev/null @@ -1,148 +0,0 @@ - -#include "traing/include/TraingDataView.h" - -#include "common/image_cache_manager.h" -#include "components/ui_label_ext.h" -#include "language/font/ui_resource_string.h" -#include "UiConfig.h" -#include "ui_resource_image.h" -#include -#include "components/ui_button.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -namespace OHOS -{ - static TraingDataView *g_pTraingDataView{nullptr}; - - TraingDataView::TraingDataView() - { - g_pTraingDataView = this; - } - - TraingDataView::~TraingDataView() - { - DeInit(); - g_pTraingDataView = nullptr; - } - - TraingDataView *TraingDataView::GetInstance() - { - - return g_pTraingDataView; - } - - /* InitView:初始化界面*/ - void TraingDataView ::InitView() - { - if (container_ == nullptr) - { - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, 466, 466); - container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - } - - // 初始化Image - TraingModel::GetInstance()->InitImageView(image1_, 13, 13, 440, 386, "image1", PROGRESS_IMAGE); - TraingModel::GetInstance()->InitImageView(image2_, 208, 297, 20, 20, "image2", ARROWS_IMAGE); - TraingModel::GetInstance()->InitImageView(image3_, 98, 314, 270, 20, "image3", SPORT_STRENGTH_IMAGE); - TraingModel::GetInstance()->InitImageView(image4_, 225, 396, 16, 10, "image4", INCO_UP_IMAGE); - TraingModel::GetInstance()->InitImageView(image5_, 193, 421, 80, 20, "image5", DATA_POINT_IMAGE); - container_->Add(image1_); - container_->Add(image2_); - container_->Add(image3_); - container_->Add(image4_); - container_->Add(image5_); - // 初始化Lable - TraingModel::GetInstance()->InitLabel(label1_, 185, 60, 90, 35, "label1", "23:54", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabel(label2_, 158, 120, 150, 35, "label2", "跳绳运动中", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabel(label3_, 90, 175, 60, 40, "label3", "00:31:26", DEFAULT_VECTOR_FONT_FILENAME, 80); - TraingModel::GetInstance()->InitLabel(label4_, 150, 276, 60, 40, "label4", "144", DEFAULT_VECTOR_FONT_FILENAME, 23); - TraingModel::GetInstance()->InitLabel(label5_, 167, 350, 60, 40, "label4", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 26); - container_->Add(label1_); - container_->Add(label2_); - container_->Add(label3_); - container_->Add(label4_); - container_->Add(label5_); - // 初始化Button - TraingModel::GetInstance()->InitButton(button1_, 275, 350, 26, 26, BUTTONNOTE); - // Set additional property - button1_->SetImageSrc(NOTE_IMAGE, NOTE_IMAGE); - button1_->SetOnClickListener(static_cast(TraingDataPresenter::GetInstance())); - container_->Add(button1_); - } - - /* DeInit:删除组件 */ - void TraingDataView::DeInit() - { - container_->RemoveAll(); - UIView *view = static_cast(container_)->GetChildrenHead(); - while (view != nullptr) - { - UIView *tempView = view; - view = view->GetNextSibling(); - if (tempView->GetParent()) - { - static_cast(tempView->GetParent())->Remove(tempView); - } - delete tempView; - } - delete container_; - container_ = nullptr; - } - - void TraingDataView::PreLoad(void) - { - if (!viewiInitStatus) - { - InitView(); - viewiInitStatus = true; - } - } - void TraingDataView::OnStart() - { - container_ = new UIViewGroup(); - if (container_ == nullptr) - { - return; - } - container_->SetPosition(0, 0); - container_->SetWidth(Screen::GetInstance().GetWidth()); - container_->SetHeight(Screen::GetInstance().GetHeight()); - - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(TraingDataPresenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - - container_->SetTouchable(true); - container_->SetDraggable(true); - - PreLoad(); - RootView::GetInstance()->Add(container_); - } - - void TraingDataView::OnSetUpView() - { - - View::OnSetUpView(); - Draw(); - } - - void TraingDataView::OnTearDownView() - { - - View::OnTearDownView(); - return; - } - - void TraingDataView::OnStop() - { - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp deleted file mode 100644 index 20f24f097..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailPresenter.cpp +++ /dev/null @@ -1,81 +0,0 @@ - - -#include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" -#include "NativeAbility.h" - -#include -#include -#include -#include "traing/include/TraingDetailPresenter.h" -// #include "TraingDetailView.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static TraingDetailPresenter *g_pTraingDetailPresenter = nullptr; - - TraingDetailPresenter::TraingDetailPresenter() - { - - g_pTraingDetailPresenter = this; - } - - TraingDetailPresenter::~TraingDetailPresenter() - { - - g_pTraingDetailPresenter = nullptr; - } - - TraingDetailPresenter *TraingDetailPresenter::GetInstance() - { - - return g_pTraingDetailPresenter; - } - - void TraingDetailPresenter::OnStart() - { - - Presenter::OnStart(); - } - - void TraingDetailPresenter::OnPause(void) - { - - Presenter::OnPause(); - } - - void TraingDetailPresenter::OnResume(void) - { - - Presenter::OnResume(); - } - - void TraingDetailPresenter::OnStop(void) - { - - Presenter::OnStop(); - } - bool TraingDetailPresenter::OnDrag(UIView &view, const DragEvent &event) - { - return true; - } - bool TraingDetailPresenter::OnDragEnd(UIView &view, const DragEvent &event) - { - - if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA); - } - UNUSED(view); - return true; - } - - bool TraingDetailPresenter::OnClick(UIView &view, const ClickEvent &event) - { - // 根据控件id查找是哪个控件触发了点击回调 - return true; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailView.cpp deleted file mode 100644 index e40c94d54..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailView.cpp +++ /dev/null @@ -1,155 +0,0 @@ - -#include "traing/include/TraingDetailView.h" - -#include "common/image_cache_manager.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" -#include "UiConfig.h" -#include "ui_resource_image.h" -#include -#include "components/ui_button.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -namespace OHOS -{ - - - - static TraingDetailView *g_pTraingDetailView{nullptr}; - - TraingDetailView::TraingDetailView() - { - g_pTraingDetailView = this; - } - - TraingDetailView::~TraingDetailView() - { - DeInit(); - g_pTraingDetailView = nullptr; - } - - TraingDetailView *TraingDetailView::GetInstance() - { - - return g_pTraingDetailView; - } - - /* InitView:初始化界面*/ - void TraingDetailView ::InitView() - { - if (container_ == nullptr) - { - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, 466, 466); - container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - } - - // 初始化Image - TraingModel::GetInstance()->InitImageView(image1_, 134, 58, 30, 30, "image1", HEARTRATE_30_IMAGE); - TraingModel::GetInstance()->InitImageView(image2_, 44, 189, 30, 30, "image2", MILEAGE_30_IMAGE); - TraingModel::GetInstance()->InitImageView(image3_, 297, 189, 30, 30, "image3", STEP_30_IMAGE); - TraingModel::GetInstance()->InitImageView(image4_, 129, 335, 30, 30, "image4", CALORIES_30_IMAGE); - TraingModel::GetInstance()->InitImageView(image5_, 0, 160, 10, 466, "image5", LINE_1_IMAGE); - TraingModel::GetInstance()->InitImageView(image6_, 233, 193, 80, 20, "image5", LINE_2_IMAGE); - TraingModel::GetInstance()->InitImageView(image7_, 0, 306, 10, 466, "image5", LINE_1_IMAGE); - container_->Add(image1_); - container_->Add(image2_); - container_->Add(image3_); - container_->Add(image4_); - container_->Add(image5_); - container_->Add(image6_); - container_->Add(image7_); - // 初始化Lable - TraingModel::GetInstance()->InitLabel(label1_, 174, 60, 90, 35, "label1", "心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabel(label2_, 80, 190, 60, 40, "label2", "距离(公里)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabel(label3_, 332, 189, 60, 40, "label3", "步数", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabel(label4_, 167, 336, 60, 40, "label4", "卡路里(千卡)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabel(label5_, 202, 94, 60, 40, "label5", "144", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabel(label6_, 76, 233, 60, 40, "label6", "13.21", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabel(label7_, 300, 233, 60, 40, "label7", "28312", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabel(label8_, 175, 376, 60, 40, "label8", "210.03", DEFAULT_VECTOR_FONT_FILENAME, 40); - container_->Add(label1_); - container_->Add(label2_); - container_->Add(label3_); - container_->Add(label4_); - container_->Add(label5_); - container_->Add(label6_); - container_->Add(label7_); - container_->Add(label8_); - } - - /* DeInit:删除组件 */ - void TraingDetailView::DeInit() - { - container_->RemoveAll(); - UIView *view = static_cast(container_)->GetChildrenHead(); - while (view != nullptr) - { - UIView *tempView = view; - view = view->GetNextSibling(); - if (tempView->GetParent()) - { - static_cast(tempView->GetParent())->Remove(tempView); - } - delete tempView; - } - delete container_; - container_ = nullptr; - } - - void TraingDetailView::PreLoad(void) - { - if (!viewiInitStatus) - { - InitView(); - viewiInitStatus = true; - } - } - void TraingDetailView::OnStart() - { - container_ = new UIViewGroup(); - if (container_ == nullptr) - { - return; - } - container_->SetPosition(0, 0); - container_->SetWidth(Screen::GetInstance().GetWidth()); - container_->SetHeight(Screen::GetInstance().GetHeight()); - - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(TraingDetailPresenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - - container_->SetTouchable(true); - container_->SetDraggable(true); - - PreLoad(); - RootView::GetInstance()->Add(container_); - } - - void TraingDetailView::OnSetUpView() - { - - View::OnSetUpView(); - Draw(); - } - - void TraingDetailView::OnTearDownView() - { - - View::OnTearDownView(); - return; - } - - void TraingDetailView::OnStop() - { - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2Presenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2Presenter.cpp index ca5fece4d..79a6f90af 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2Presenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2Presenter.cpp @@ -74,7 +74,7 @@ namespace OHOS // 根据控件id查找是哪个控件触发了点击回调 if (strcmp(view.GetViewId(), BUTTONNO) == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); + // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); } if (strcmp(view.GetViewId(), BUTTONYES) == 0) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnotePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnotePresenter.cpp index e7e8448e3..9ae0f7a45 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnotePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnotePresenter.cpp @@ -74,7 +74,7 @@ namespace OHOS // 根据控件id查找是哪个控件触发了点击回调 if (strcmp(view.GetViewId(), BUTTONNO) == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); + //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); } if (strcmp(view.GetViewId(), BUTTONYES) == 0) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index d4c345a08..2e6b9ec69 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -13,190 +13,20 @@ #include "cmsis_os.h" #include "traing/training_card/include/TraingCardPresenter.h" +#include "broadcast_feature.h" +#include "broadcast_service.h" +#include "samgr_lite.h" + #define TIMER 1 #define CHECK 0 #define HARD_OFF 1 #define TRAINING_PATH "user/userdata/sportdata/" +extern "C" +{ + static void Notify(void *args, const Topic topic, Request *request); +} namespace OHOS { -#ifdef __cplusplus - extern "C" - { -#endif - // 处理数据头 - static void write_Trainingdata_hard_data(uint32_t data) - { - char file_path[128] = {0}; - sprintf(file_path, "%shard_%d.bin", TRAINING_PATH, data); - - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s", file_path); - FILE *fp = fopen(file_path, "rb+"); - Trainingdata_hard hard; - int ret = 0; - if (fp == NULL) - { - hard.num = 0; - fp = fopen(file_path, "wb+"); - } - else - { - ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); - } - - fseek(fp, 0, SEEK_SET); - fclose(fp); - - fp = fopen(file_path, "wb+"); - hard.num++; - ret = fwrite((void *)&hard, sizeof(Trainingdata_hard), 1, fp); - fseek(fp, 0, SEEK_SET); - fclose(fp); - } - // 获得数据个数 - static int get_Trainingdata_data_num(uint32_t data) - { - - char file_path[128] = {0}; - sprintf(file_path, "%shard_%d.bin", TRAINING_PATH, data); - - FILE *fp = fopen(file_path, "ab"); - if (fp == NULL) - { - return 0xffffff; - } - fseek(fp, 0, SEEK_SET); - Trainingdata_hard hard; - int ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); - fseek(fp, 0, SEEK_SET); - fclose(fp); - return hard.num; - } - - // 写数据 - int write_Trainingdata_data(Trainingdata data) - { - uint64_t time; - uapi_get_timestampe_ms(&time); - uint32_t timeday = time / 1000 / 60 / 60 / 12; - char file_path[128] = {0}; - sprintf(file_path, "%s%d.bin", TRAINING_PATH, timeday); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s", file_path); - write_Trainingdata_hard_data(timeday); - FILE *fp = fopen(file_path, "ab"); - if (fp == NULL) - { - fopen(file_path, "wb+"); - } -#if HARD_OFF - int ret = 0; - - ret = fwrite((void *)&data, sizeof(Trainingdata), 1, fp); - if (ret != 1) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "2 fwrite_data %d", ret); - } -#else - if (fp == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "file is NULL"); - } - Trainingdata_hard hard = {0}; - fseek(fp, 0, SEEK_SET); - int ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); - - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hard num %d", hard.num); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fread %d", ret); - if (ret == 0) - { - hard.num = 1; - hard.st = timeday; - fseek(fp, 0, SEEK_SET); - ret = fwrite((void *)&hard, sizeof(Trainingdata_hard), 1, fp); - - if (ret != 1) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fwrite_hard %d", ret); - } - - ret = fwrite((void *)&data, sizeof(Trainingdata), 1, fp); - if (ret != 1) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "1 fwrite_data %d", ret); - } - } - else - { - ret = fseek(fp, 8, SEEK_END); - if (ret != 0) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fseek %d", ret); - } - hard.num++; - ret = fwrite((void *)&(hard), sizeof(Trainingdata_hard), 1, fp); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hard num %d", hard.num); - if (ret) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fwrite_hard %d", ret); - } - - fseek(fp, 0, SEEK_END); - // fclose(fp); - - // fp= fopen(file_path,"ab+"); - ret = fwrite((void *)&data, sizeof(Trainingdata), 1, fp); - if (ret != 1) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "2 fwrite_data %d", ret); - } - } -#endif - - fseek(fp, 0, SEEK_SET); - fclose(fp); - return 1; - } - // 读数据 - Trainingdata *read_Trainingdata_data(uint32_t timedata, uint16_t offset) - { - char file_path[128] = {0}; - sprintf(file_path, "%s%d.bin", TRAINING_PATH, timedata); - - FILE *fp = fopen(file_path, "rb+"); - Trainingdata *data = (Trainingdata *)malloc(sizeof(Trainingdata)); - if (fp == NULL || get_Trainingdata_data_num(timedata) < offset) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "file is NULL %d", get_Trainingdata_data_num(timedata)); - return NULL; - } -#if HARD_OFF - fseek(fp, sizeof(Trainingdata) * offset, SEEK_SET); - fread((void *)data, sizeof(Trainingdata), 1, fp); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d", data->src); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d %d ", offset, sizeof(Trainingdata)); -#else - fseek(fp, 0, SEEK_SET); - Trainingdata_hard hard; - int ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hard num %d", hard.num); - if (ret == 0) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "file is NULL"); - return NULL; - } - else - { - fread((void *)data, sizeof(Trainingdata), 1, fp); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d", data->src); - } -#endif - fseek(fp, 0, SEEK_SET); - fclose(fp); - return data; - } -#ifdef __cplusplus - } -#endif - #if TIMER // 声明定时器变量 static osTimerId_t g_startCounting = NULL; // 定时器 @@ -208,6 +38,9 @@ namespace OHOS static constexpr int16 NUM_TIME_MIN = 60; static constexpr int16 NUM_TIME_HOUR = 3600; static constexpr int32 NUM_TIME_DAY = 86400; + + SportData *sportdata = new SportData(); + #endif TraingModel ::TraingModel() { @@ -427,15 +260,101 @@ namespace OHOS return true; } + /*设置运动Id*/ void TraingModel::SetSportEvent(UIResourceTextId id) { sportId_ = id; } + /*获取运动Id*/ UIResourceTextId TraingModel::GetSportEvent() { return sportId_; } - + /*获取运动类型*/ + ExerciseClass TraingModel::GetSportType() + { + switch (sportId_) + { + // 室外跑步 + case UIResourceTextId::STR_EXERCISE_OUTDOORRUNNING: + return ExerciseClass::OUTDOOR; + break; + // 室内跑步 + case UIResourceTextId::STR_EXERCISE_INDOORRUNNING: + return ExerciseClass::INDOOR; + break; + // 自由训练 + default: + return ExerciseClass::FREE_TRAINING; + break; + } + } + /*设置运动状态*/ + void TraingModel::SetSportState(ExerciseState state) + { + sportstate_ = state; + } + /*获取运动状态*/ + ExerciseState TraingModel::GetSportState() + { + return sportstate_; + } + void TraingModel::AnalysisData(cywee_result_t *cyweeInfo) + { + // 不同的运动类型解析不同的数据 + ExerciseClass type = GetSportType(); + // 通用数据 + sportdata->calories = cyweeInfo->calories; + sportdata->duration = cyweeInfo->duration; + switch (type) + { + case ExerciseClass::OUTDOOR: + case ExerciseClass::INDOOR: + sportdata->distance = cyweeInfo->distance; + sportdata->steps = cyweeInfo->steps; + break; + case ExerciseClass::FREE_TRAINING: + break; + default: + break; + } + } + SportData *TraingModel::GetSportdata() + { + return sportdata; + } + static void Notify(void *args, const Topic topic, Request *request) + { + UNUSED(args); + UNUSED(topic); + if (request == NULL) + { + return; + } + switch (request->msgId) + { + case TOPIC_EVENT_TREADMILL_UPDATE: + case TOPIC_EVENT_OUTDOOR_RUNNING_UPDATE: + case TOPIC_EVENT_INDOOR_RUNNING_UPDATE: + case TOPIC_EVENT_FITNESS_PEDOMETERR_UPDATE: + cywee_result_t *cyweeInfo = new cywee_result_t(); // 在case块内分配内存 + int rets = memcpy_s(cyweeInfo, sizeof(cywee_result_t), (cywee_result_t *)request->data, request->len); + if (rets != EOK) + { + delete cyweeInfo; // 处理内存分配失败的情况 + cyweeInfo = NULL; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_result_t fail! ret = %d", rets); + return; + } + TraingModel::GetInstance()->AnalysisData(cyweeInfo); + delete cyweeInfo; // 释放内存 + break; + default: + // 处理未知msgId的情况 + break; + } + } + /* -------------------------------------------------------------------------- */ #if TIMER /* 时间显示 */ std::string TraingModel::DisplayMotionDuration() @@ -559,28 +478,183 @@ namespace OHOS #ifdef __cplusplus } #endif - /*设置运动状态*/ - void TraingModel::SetSportState(ExerciseState state) - { - sportstate_ = state; - } - /*获取运动状态*/ - ExerciseState TraingModel::GetSportState() - { - return sportstate_; - } -#if 0 - // 打开传感器 - bool TraingModel::OpenDistancesSensor(void) +#endif +/* ---------------------------------- 数据存储 ---------------------------------- */ +#ifdef __cplusplus + extern "C" { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingModel::OpenDistancesSensor!!"); - return true; - } +#endif + // 处理数据头 + static void write_Trainingdata_hard_data(uint32_t data) + { + char file_path[128] = {0}; + sprintf(file_path, "%shard_%d.bin", TRAINING_PATH, data); - bool TraingModel::CloseDistancesSensor(void) - { - return true; - } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s", file_path); + FILE *fp = fopen(file_path, "rb+"); + Trainingdata_hard hard; + int ret = 0; + if (fp == NULL) + { + hard.num = 0; + fp = fopen(file_path, "wb+"); + } + else + { + ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); + } + + fseek(fp, 0, SEEK_SET); + fclose(fp); + + fp = fopen(file_path, "wb+"); + hard.num++; + ret = fwrite((void *)&hard, sizeof(Trainingdata_hard), 1, fp); + fseek(fp, 0, SEEK_SET); + fclose(fp); + } + // 获得数据个数 + static int get_Trainingdata_data_num(uint32_t data) + { + + char file_path[128] = {0}; + sprintf(file_path, "%shard_%d.bin", TRAINING_PATH, data); + + FILE *fp = fopen(file_path, "ab"); + if (fp == NULL) + { + return 0xffffff; + } + fseek(fp, 0, SEEK_SET); + Trainingdata_hard hard; + int ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); + fseek(fp, 0, SEEK_SET); + fclose(fp); + return hard.num; + } + + // 写数据 + int write_Trainingdata_data(Trainingdata data) + { + uint64_t time; + uapi_get_timestampe_ms(&time); + uint32_t timeday = time / 1000 / 60 / 60 / 12; + char file_path[128] = {0}; + sprintf(file_path, "%s%d.bin", TRAINING_PATH, timeday); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s", file_path); + write_Trainingdata_hard_data(timeday); + FILE *fp = fopen(file_path, "ab"); + if (fp == NULL) + { + fopen(file_path, "wb+"); + } +#if HARD_OFF + int ret = 0; + + ret = fwrite((void *)&data, sizeof(Trainingdata), 1, fp); + if (ret != 1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "2 fwrite_data %d", ret); + } +#else + if (fp == NULL) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "file is NULL"); + } + Trainingdata_hard hard = {0}; + fseek(fp, 0, SEEK_SET); + int ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); + + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hard num %d", hard.num); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fread %d", ret); + if (ret == 0) + { + hard.num = 1; + hard.st = timeday; + fseek(fp, 0, SEEK_SET); + ret = fwrite((void *)&hard, sizeof(Trainingdata_hard), 1, fp); + + if (ret != 1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fwrite_hard %d", ret); + } + + ret = fwrite((void *)&data, sizeof(Trainingdata), 1, fp); + if (ret != 1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "1 fwrite_data %d", ret); + } + } + else + { + ret = fseek(fp, 8, SEEK_END); + if (ret != 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fseek %d", ret); + } + hard.num++; + ret = fwrite((void *)&(hard), sizeof(Trainingdata_hard), 1, fp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hard num %d", hard.num); + if (ret) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "fwrite_hard %d", ret); + } + + fseek(fp, 0, SEEK_END); + // fclose(fp); + + // fp= fopen(file_path,"ab+"); + ret = fwrite((void *)&data, sizeof(Trainingdata), 1, fp); + if (ret != 1) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "2 fwrite_data %d", ret); + } + } +#endif + + fseek(fp, 0, SEEK_SET); + fclose(fp); + return 1; + } + // 读数据 + Trainingdata *read_Trainingdata_data(uint32_t timedata, uint16_t offset) + { + char file_path[128] = {0}; + sprintf(file_path, "%s%d.bin", TRAINING_PATH, timedata); + + FILE *fp = fopen(file_path, "rb+"); + Trainingdata *data = (Trainingdata *)malloc(sizeof(Trainingdata)); + if (fp == NULL || get_Trainingdata_data_num(timedata) < offset) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "file is NULL %d", get_Trainingdata_data_num(timedata)); + return NULL; + } +#if HARD_OFF + fseek(fp, sizeof(Trainingdata) * offset, SEEK_SET); + fread((void *)data, sizeof(Trainingdata), 1, fp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d", data->src); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d %d ", offset, sizeof(Trainingdata)); +#else + fseek(fp, 0, SEEK_SET); + Trainingdata_hard hard; + int ret = fread((void *)&hard, sizeof(Trainingdata_hard), 1, fp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hard num %d", hard.num); + if (ret == 0) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "file is NULL"); + return NULL; + } + else + { + fread((void *)data, sizeof(Trainingdata), 1, fp); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d", data->src); + } #endif + fseek(fp, 0, SEEK_SET); + fclose(fp); + return data; + } +#ifdef __cplusplus + } #endif } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMusicPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMusicPresenter.cpp deleted file mode 100644 index 65dd18790..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMusicPresenter.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" -#include "NativeAbility.h" - -#include -#include -#include -#include "traing/include/TraingMusicPresenter.h" -// #include "TraingMusicView.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static TraingMusicPresenter *g_pTraingMusicPresenter = nullptr; - TraingMusicPresenter::TraingMusicPresenter() - { - g_pTraingMusicPresenter = this; - } - - TraingMusicPresenter::~TraingMusicPresenter() - { - g_pTraingMusicPresenter = nullptr; - } - - TraingMusicPresenter *TraingMusicPresenter::GetInstance() - { - return g_pTraingMusicPresenter; - } - - void TraingMusicPresenter::OnStart() - { - - Presenter::OnStart(); - } - - void TraingMusicPresenter::OnPause(void) - { - - Presenter::OnPause(); - } - - void TraingMusicPresenter::OnResume(void) - { - - Presenter::OnResume(); - } - - void TraingMusicPresenter::OnStop(void) - { - - Presenter::OnStop(); - } - bool TraingMusicPresenter::OnDrag(UIView &view, const DragEvent &event) - { - return true; - } - bool TraingMusicPresenter::OnDragEnd(UIView &view, const DragEvent &event) - { - - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA); - } - UNUSED(view); - return true; - } - - bool TraingMusicPresenter::OnClick(UIView &view, const ClickEvent &event) - { - return true; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMusicView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMusicView.cpp deleted file mode 100644 index fb5d1f50b..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMusicView.cpp +++ /dev/null @@ -1,124 +0,0 @@ - -#include "traing/include/TraingMusicView.h" -#include -#include "common/image_cache_manager.h" -#include "components/ui_label_ext.h" -#include "language/font/ui_resource_string.h" -#include "UiConfig.h" -#include "ui_resource_image.h" -#include -#include "components/ui_button.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -namespace OHOS -{ - - static TraingMusicView *g_pTraingMusicView{nullptr}; - - TraingMusicView::TraingMusicView() - { - g_pTraingMusicView = this; - } - - TraingMusicView::~TraingMusicView() - { - DeInit(); - g_pTraingMusicView = nullptr; - } - - TraingMusicView *TraingMusicView::GetInstance() - { - return g_pTraingMusicView; - } - /******************************************************************************************************/ - - /* DeInit:删除组件 */ - void TraingMusicView::DeInit() - { - container_->RemoveAll(); - // 删除容器 - if (playersView != nullptr) - { - playersView->RemoveAll(); // 移除容器中的所有组件 - delete playersView; - playersView = nullptr; - } - if (container_ != nullptr) - { - container_->RemoveAll(); // 移除容器中的所有组件 - delete container_; - container_ = nullptr; - } - } - - void TraingMusicView::PreLoad(void) - { - if (!viewiInitStatus) - { - InitView(); - viewiInitStatus = true; - } - } - void TraingMusicView ::InitView() - { - if (container_ == nullptr) - { - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, 466, 466); - container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - } - playersView = new PlayersView(); - if (playersView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView new fail"); - return; - } - playersView->PreLoad(); - container_->Add(playersView); - } - void TraingMusicView::OnStart() - { - container_ = new UIViewGroup(); - if (container_ == nullptr) - { - return; - } - container_->SetPosition(0, 0); - container_->SetWidth(Screen::GetInstance().GetWidth()); - container_->SetHeight(Screen::GetInstance().GetHeight()); - - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(TraingMusicPresenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - container_->SetTouchable(true); - container_->SetDraggable(true); - PreLoad(); - RootView::GetInstance()->Add(container_); - } - - void TraingMusicView::OnSetUpView() - { - - View::OnSetUpView(); - Draw(); - } - - void TraingMusicView::OnTearDownView() - { - - View::OnTearDownView(); - return; - } - - void TraingMusicView::OnStop() - { - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp index fb472cd97..c25f5d40b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp @@ -9,6 +9,7 @@ #include #include #include "traing/include/TraingNomalPresenter.h" +#include "traing/training_card/include/TraingCardPresenter.h" // #include "TraingNomalView.h" namespace OHOS @@ -98,6 +99,10 @@ namespace OHOS if (strcmp(view.GetViewId(), BUTTONGO) == 0) { NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD); + // 获取运动类型 + ExerciseClass type = TraingModel::GetInstance()->GetSportType(); + // 开启对应的运动 + TraingCardPresenter::GetInstance()->OpenSensor(type); } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp index 288e0d889..352bca480 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp @@ -66,7 +66,7 @@ namespace OHOS if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA); + // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA); } UNUSED(view); return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp index 62c4b8573..9bdd8a8e2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp @@ -1,7 +1,7 @@ #include "AppViewIDs.h" #include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" +#include "language/font/ui_resource_string.h" #include "NativeAbility.h" #include @@ -68,7 +68,7 @@ namespace OHOS (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) { uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING); + // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING); } UNUSED(view); return true; @@ -83,7 +83,7 @@ namespace OHOS } if (strcmp(view.GetViewId(), BUTTONGO) == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); + // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp index 2517296cd..551f8832b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp @@ -75,7 +75,7 @@ namespace OHOS // 根据控件id查找是哪个控件触发了点击回调 if (strcmp(view.GetViewId(), BUTTONOK) == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); + //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h index 6115d70b3..3b646f974 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h @@ -15,6 +15,11 @@ #include "traing/training_card/include/TrainingControlView.h" #include "traing/training_card/include/TrainingDataView.h" #include "ModelListenerSample.h" + +#include "cywee_service.h" +#include "cywee_hal.h" +#include "traing/include/TraingModel.h" + namespace OHOS { class TraingCardView; @@ -28,6 +33,7 @@ namespace OHOS public: TraingCardPresenter(); virtual ~TraingCardPresenter(); + static TraingCardPresenter *GetInstance(); void OnStart() override; void OnPause() override; @@ -35,10 +41,11 @@ namespace OHOS void OnStop() override; virtual void Notify() override; - static TraingCardPresenter *GetInstance(); + bool OpenSensor(ExerciseClass type); + bool ControlSensor(ExerciseState state); void ModifiesTime(); - + void RefreshData(); // 更新数据 private: // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; bool OnClick(UIView &view, const ClickEvent &event) override; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TrainingDetailView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TrainingDetailView.h index 874f788b5..97459abaf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TrainingDetailView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TrainingDetailView.h @@ -40,7 +40,11 @@ namespace OHOS void PreLoad(void) override; void UnLoad(void) override; - // UILabelExt *GetTimeLabel(); + + UILabelExt *GetHeartLabel(); + UILabelExt *GetMileLabel(); + UILabelExt *GetStepLabel(); + UILabelExt *GetCalorieLabel(); private: UIView::OnDragListener *draglistener{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp index c5ec9eff1..eb3918a3e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -9,7 +9,10 @@ #include #include #include "traing/training_card/include/TraingCardPresenter.h" -// #include "TraingCardView.h" +#include "traing/include/TraingModel.h" + +extern "C" void do_cywee_service_check_msg(int cmd); + extern "C" { void InitTimer(); @@ -79,6 +82,104 @@ namespace OHOS return true; } + // 计时器更新timer + void TraingCardPresenter::ModifiesTime() + { + std ::string TimeStr = TraingModel::GetInstance()->DisplayMotionDuration(); + if (TimeStr.empty()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::GetInstance()->DisplayMotionDuration() nullptr"); + return; + } + if (TrainingControlView::GetInstance()->GetTimeLabel() != nullptr) + { + TrainingControlView::GetInstance()->GetTimeLabel()->SetText(TimeStr.c_str()); + } + if (TrainingDataView::GetInstance()->GetTimeLabel() != nullptr) + { + TrainingDataView::GetInstance()->GetTimeLabel()->SetText(TimeStr.c_str()); + } + } + + /* --------------------------------- cywee库操作 -------------------------------- */ + bool TraingCardPresenter::OpenSensor(ExerciseClass type) + { + // 根据不同的运动项目进行不同的运动 + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingCardPresenter::OpenSensor!!"); + // 进行运动项目的判断的时候需要先退出当前项目 + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_EXIT); + switch (type) + { + case ExerciseClass::NORMAL: + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_NORMAL); + break; + case ExerciseClass::TREADMILL: + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_TREADMILL); + break; + case ExerciseClass::OUTDOOR: + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_OUTDOOR_RUNNING); + break; + case ExerciseClass::INDOOR: + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_INDOOR_RUNNING); + break; + case ExerciseClass::FITNESS_PEDOMETER: + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_FITNESS_PEDOMETERR); + break; + case ExerciseClass::FREE_TRAINING: + do_cywee_service_check_msg(SPORT_ACTIVE_MODE_FREE_TRAINING); + break; + default: + break; + } + return true; + } + + bool TraingCardPresenter::ControlSensor(ExerciseState state) + { + switch (state) + { + case ExerciseState::End: + // 退出进入普通模式 + OpenSensor(ExerciseClass::NORMAL); + break; + case ExerciseState::Pause: + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_PAUSE); + break; + case ExerciseState::Continue: + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESUME); + break; + default: + break; + } + return true; + } + void TraingCardPresenter::RefreshData() + { + SportData *sportdata = TraingModel::GetInstance()->GetSportdata(); + + if (sportdata == nullptr) + { + // 处理数据为空的情况 + return; + } + + std::string calorieStr = std::to_string(sportdata->calories); + std::string durationStr = std::to_string(sportdata->duration); + std::string stepsStr = std::to_string(sportdata->steps); + std::string distanceStr = std::to_string(sportdata->distance); + + TrainingDetailView::GetInstance()->GetHeartLabel()->SetText("0"); + TrainingDetailView::GetInstance()->GetCalorieLabel()->SetText(calorieStr.c_str()); + TrainingDetailView::GetInstance()->GetMileLabel()->SetText(distanceStr.c_str()); + TrainingDetailView::GetInstance()->GetStepLabel()->SetText(stepsStr.c_str()); + } + + void TraingCardPresenter::Notify(void) + { + TrainingDataView::GetInstance()->UpdataTime(); + } + + /* -------------------------------------------------------------------------- */ bool TraingCardPresenter::OnClick(UIView &view, const ClickEvent &event) { // 点击暂停按键 @@ -93,6 +194,8 @@ namespace OHOS TraingModel::GetInstance()->SetSportState(ExerciseState::Pause); // 暂停计时器 PauseTimer(); + // 暂停运动库 + OpenSensor(ExerciseState::Pause); return true; } // 暂停状态 @@ -104,38 +207,18 @@ namespace OHOS TraingModel::GetInstance()->SetSportState(ExerciseState::Start); // 恢复计时器 ResumeTimer(); + // 恢复运动库 + ControlSensor(ExerciseState::Continue); return true; } } // 点击结束按键 if (strcmp(view.GetViewId(), BUTTONEND) == 0) { + ControlSensor(ExerciseState::End); + // 弹窗显示是否结束 } return true; } - - // 计时器更新timer - void TraingCardPresenter::ModifiesTime() - { - std ::string TimeStr = TraingModel::GetInstance()->DisplayMotionDuration(); - if (TimeStr.empty()) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::GetInstance()->DisplayMotionDuration() nullptr"); - return; - } - if (TrainingControlView::GetInstance()->GetTimeLabel() != nullptr) - { - TrainingControlView::GetInstance()->GetTimeLabel()->SetText(TimeStr.c_str()); - } - if (TrainingDataView::GetInstance()->GetTimeLabel() != nullptr) - { - TrainingDataView::GetInstance()->GetTimeLabel()->SetText(TimeStr.c_str()); - } - } - - void TraingCardPresenter::Notify(void) - { - TrainingDataView::GetInstance()->UpdataTime(); - } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp index b7bbdc4d5..f09677f00 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp @@ -167,11 +167,22 @@ namespace OHOS } void TrainingDetailView::UnLoad(void) {} - /* - UILabelExt *TrainingDetailView::GetTimeLabel() - { - return timerlabel; - } - */ + + UILabelExt *TrainingDetailView::GetHeartLabel() + { + return heartlabel; + } + UILabelExt *TrainingDetailView::GetMileLabel() + { + return milelabel; + } + UILabelExt *TrainingDetailView::GetStepLabel() + { + return steplabel; + } + UILabelExt *TrainingDetailView::GetCalorieLabel() + { + return calorielabel; + } } diff --git a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h index 08042084d..c1cb6e73f 100755 --- a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h +++ b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h @@ -45,12 +45,14 @@ typedef enum { TOPIC_EVENT_HFP_FINISHED, TOPIC_EVENT_HFP_PHONE_TO_WATCH, TOPIC_EVENT_HFP_WATCH_TO_PHONE, +#ifdef CYWEE_SPORT TOPIC_EVENT_NORMAL_UPDATE, TOPIC_EVENT_TREADMILL_UPDATE, TOPIC_EVENT_OUTDOOR_RUNNING_UPDATE, TOPIC_EVENT_INDOOR_RUNNING_UPDATE, TOPIC_EVENT_FITNESS_PEDOMETERR_UPDATE, TOPIC_EVENT_FREE_TRAINING_UPDATE, +#endif TOPIC_EVENT_AR_ALERT_UPDATE, TOPIC_EVENT_EXTRA_INFO_UPDATE, #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index d46509234..38b333d39 100755 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -137,6 +137,7 @@ target = { 'SUPPORT_ALIPAY_SEC', 'SUPPORT_BLE_SERVICE', 'FD230', + 'CYWEE_SPORT', 'SUPPORT_HID_SERVICE' ], 'ram_component': ["algorithm", "dfx_port_brandy", "dfx_update", 'dfx_nv', "osal", "arch_port", "-:testsuite", diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index d553d3db3..76d353557 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -207,12 +207,12 @@ static void cywee_service_check_task(void const *arg) test_api(); }else if (mail.cmd == CYWEE_SERVICE_CMD_START_CHECK){ cywee_service_running_stat = true; - cywee_main_dml(SPORT_ACTIVE_MODE_NORMAL); + //cywee_main_dml(SPORT_ACTIVE_MODE_NORMAL); cywee_service_timer_start_check(CYWEE_CHECK_MS); }else if (mail.cmd == CYWEE_SERVICE_CMD_STOP_CHECK){ cywee_service_running_stat = false; if (g_cywee_service_timer != NULL) osTimerStop(g_cywee_service_timer); - activity_exit(); + //activity_exit(); } else if (mail.cmd == CYWEE_SERVICE_CMD_NORMAL_MODE){ diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 88f8c04ef..7dda450a8 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -71,7 +71,6 @@ void activity_exit(void) scl.iData[0] = 1; CWM_SettingControl(SCL_REQ_ACTIVITY_EXIT, &scl); cywee_installized = 0; - CWM_Sensor_Disable(IDX_ALGO_ACTIVITY_OUTPUT); } void cyw_mode_init(int mode)