From 581927263bbda8c1835dde8322113016585ac750 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 13 Jun 2024 18:11:29 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E6=B4=BB=E5=8A=A8slice?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/fd230app/CMakeLists.txt | 11 +- .../nativelauncher/include/AppViewIDs.h | 2 + .../nativelauncher/include/NativeLauncher.h | 3 +- .../nativelauncher/include/UiConfig.h | 2 + .../nativelauncher/src/NativeLauncher.cpp | 18 + .../nativeui/applist/src/ApplistModel.cpp | 3 + .../nativeui/goal/include/Maingoalpresenter.h | 58 ++ .../nativeui/goal/include/Maingoalview.h | 67 +++ .../fd230app/nativeui/goal/include/goalhint.h | 49 ++ .../nativeui/goal/include/goalmodel.h | 50 ++ .../nativeui/goal/include/goalother.h | 89 +++ .../fd230app/nativeui/goal/include/goalview.h | 65 ++ .../nativeui/goal/src/Maingoalpresenter.cpp | 123 ++++ .../nativeui/goal/src/Maingoalview.cpp | 239 ++++++++ .../fd230app/nativeui/goal/src/goalhint.cpp | 106 ++++ .../fd230app/nativeui/goal/src/goalmodel.cpp | 137 +++++ .../fd230app/nativeui/goal/src/goalother.cpp | 567 ++++++++++++++++++ .../fd230app/nativeui/goal/src/goalview.cpp | 320 ++++++++++ .../service/ble_service/blemoder/bletest.cpp | 1 + .../service/ble_service/bleservice/bleEvent.c | 16 +- .../mk_fs_image/fd230/fs/user/res/step/1.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/10.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/11.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/12.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/13.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/14.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/15.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/16.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/17.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/18.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/19.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/2.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/20.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/3.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/4.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/5.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/6.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/7.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/8.bin | 3 + .../mk_fs_image/fd230/fs/user/res/step/9.bin | 3 + .../drivers/peripheral/cywee/Inc/cywee_hal.h | 3 + .../drivers/peripheral/cywee/src/main_dml.c | 11 + 42 files changed, 1984 insertions(+), 16 deletions(-) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalpresenter.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalview.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/include/goalhint.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/include/goalmodel.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/include/goalother.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/include/goalview.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalview.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/src/goalhint.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/src/goalother.cpp create mode 100644 code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/1.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/10.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/11.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/12.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/13.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/14.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/15.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/16.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/17.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/18.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/19.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/2.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/20.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/3.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/4.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/5.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/6.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/7.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/8.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/9.bin diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 35b5d6061..c0534909a 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -642,8 +642,15 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testhrsenson.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testgsenson.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testold.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testbt.cpp - + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/producttest/src/testbt.cpp + + #每日目标 + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalmodel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalview.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/Maingoalpresenter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/Maingoalview.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalother.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalhint.cpp #${CMAKE_CURRENT_SOURCE_DIR} /service/acc_service.c ) if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES) diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h index 5714792b6..959d6c1fa 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h @@ -44,6 +44,7 @@ typedef enum : uint16_t VIEW_INDOORWALK, // 室内步行 VIEW_SHUTDOWN_OR_REBOOT, // 关机或重启界面 VIEW_WEATHER, // 天气 + VIEW_GOAL, //每日目标 VIEW_SYSTEM, // 系统 VIEW_SOUND_VIBRATION, // 声音与震动 VIEW_SYSTEM_VOLUME, // 系统音量 @@ -64,6 +65,7 @@ typedef enum : uint16_t VIEW_SYSTEM_UPDATE, // 系统更新 VIEW_WATCH_QR_CODE, //手表二维码 VIEW_RESPIRATORY_TRAINING, //呼吸训练 + /* ----------------------------------- 录音 ----------------------------------- */ VIEW_RECORD, /* ---------------------------------- 界面 ---------------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h index 94e18908d..c27a9cfd9 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h @@ -39,7 +39,8 @@ namespace OHOS /* ----------------------------------- 录音 ----------------------------------- */ void InitRecordingSlice(void); /* -------------------------------------------------------------------------- */ - void InitWeatherSlice(void); + void InitWeatherSlice(void); + void InitGoalSlice(void); void InitSystemSlice(void); void InitSoundAndVibrationSlice(void); void InitSystemVolumeSlice(void); diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index 1ef68161c..0e3820e06 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -268,6 +268,8 @@ namespace OHOS static constexpr const char *PNG_APPLIST_TACKEPHOTOS_IMAGE = APP_LIST_PATH "/assistant.bin"; // 遥控拍照 static constexpr const char *PNG_APPLIST_BLUETOOTH_IMAGE = APP_LIST_PATH "/Bluetooth.bin"; // 蓝牙 static constexpr const char *PNG_APPLIST_BREATHE_IMAGE = APP_LIST_PATH "/breathe.bin"; // 呼吸训练 + static constexpr const char *PNG_APPLIST_GOAL_IMAGE = APP_LIST_PATH "/sport.bin"; // 每日目标 + /* ---------------------------------- 快速训练 ---------------------------------- */ static constexpr const char *PNG_TRAING_BOUTTONMORE_IMAGE = APP_RES_PATH "/Training/More.bin"; static constexpr const char *PNG_TRAING_BUTTONGRONG_IMAGE = APP_RES_PATH "/Training/Bouttonground.bin"; diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index fcf319d08..d412038d0 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -69,6 +69,9 @@ #include "weather/include/MainWeatherPresenter.h" #include "weather/include/MainWeatherView.h" +#include "goal/include/Maingoalpresenter.h" +#include "goal/include/Maingoalview.h" + #include "system/include/SystemPresenter.h" #include "system/include/SystemView.h" @@ -263,6 +266,8 @@ namespace OHOS {VIEW_INDOORWALK, &NativeLauncher::InitIndoorWalkSlice}, {VIEW_SHUTDOWN_OR_REBOOT, &NativeLauncher::InitRebootSlice}, {VIEW_WEATHER, &NativeLauncher::InitWeatherSlice}, // 天气 + {VIEW_GOAL, &NativeLauncher::InitGoalSlice}, // 每日目标 + {VIEW_SYSTEM, &NativeLauncher::InitSystemSlice}, // 系统实例化地址 {VIEW_SOUND_VIBRATION, &NativeLauncher::InitSoundAndVibrationSlice}, // 声音与震动实例化地址 {VIEW_SYSTEM_VOLUME, &NativeLauncher::InitSystemVolumeSlice}, // 系统音量 @@ -665,6 +670,19 @@ namespace OHOS NativeAbility::GetInstance().AddSliceProxy(VIEW_WEATHER, mainweather); } + void NativeLauncher::InitGoalSlice(void) // 目标 + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitWeatherSlice"); + SliceProxy *maingoal = new AbilitySliceProxy; + if (maingoal == nullptr) + { + return; + } + NativeAbility::GetInstance().AddSliceProxy(VIEW_GOAL, maingoal); + } + + + void NativeLauncher::InitSystemSlice(void) // 系统 { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitSystemSlice"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp index fb13ebb76..f7a3b0660 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp @@ -29,6 +29,9 @@ namespace OHOS {VIEW_BLOODOXY, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, "血氧", STR_BLOOD_OXYGEN, nullptr}, {VIEW_HEART, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_HEART_IMAGE, "心率", STR_HEART_RATE, nullptr}, {VIEW_WEATHER, PNG_APPLIST_WEATHER_IMAGE, PNG_APPLIST_WEATHER_IMAGE, "天气", STR_WEATHER, nullptr}, + + {VIEW_GOAL, PNG_APPLIST_GOAL_IMAGE, PNG_APPLIST_GOAL_IMAGE, "每日目标", STR_ACTIVITY, nullptr}, + {VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, "训练", STR_TRAINING, nullptr}, {VIEW_TRAINING_RECORD, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_TRAINING_RECORD_IMAGE, "训练记录", STR_TRAINING_RECORD, nullptr}, {VIEW_RECORD, PNG_APPLIST_RECORD_IMAGE, PNG_APPLIST_RECORD_IMAGE, "录音", STR_RECORD, nullptr}, diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalpresenter.h b/code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalpresenter.h new file mode 100644 index 000000000..4200ed9b3 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalpresenter.h @@ -0,0 +1,58 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-01-29 15:37:44 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-10 10:58:31 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/MaingoalPresenter.h + */ +#ifndef MAIN_GOAL_PRESENTER_H +#define MAIN_GOAL_PRESENTER_H + +#include "Presenter.h" +#include "View.h" +#include "Maingoalview.h" +#include "goal/include/goalmodel.h" +/*主天气视图*/ +namespace OHOS +{ + static constexpr const char *MAIN_GOAL_VIEW = "MainWeatherview"; + class GoalControlViewOnSwipeListener : public UISwipeView::OnSwipeListener + { + public: + GoalControlViewOnSwipeListener() {} + ~GoalControlViewOnSwipeListener() {} + void OnSwipe(UISwipeView &view) override; + }; + + class MaingoalrView; + class MaingoalPresenter : public Presenter, + public UIView::OnClickListener, + public RootView::OnKeyActListener, + public UIView::OnDragListener, + public UISwipeView::OnSwipeListener + { + public: + MaingoalPresenter(); + virtual ~MaingoalPresenter(); + + void OnStart() override; + void OnPause() override; + void OnResume() override; + void OnStop() override; + + static MaingoalPresenter *GetInstance(); + + private: + // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; + bool OnClick(UIView &view, const ClickEvent &event) override; + bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView &view, const DragEvent &event) override; + bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 + void OnSwipe(UISwipeView &view) override; + + GoalModel *weatherModel{nullptr}; + bool X_DRAG_FLAG{false}; + }; +} // namespace OHOS + +#endif // MainWeather_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalview.h b/code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalview.h new file mode 100644 index 000000000..5bd4464a3 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/include/Maingoalview.h @@ -0,0 +1,67 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-01-29 15:37:44 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-10 11:22:41 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/MaingoalrView.h + */ +#ifndef MAIN_GOAL_VIEW_H +#define MAIN_GOAL_VIEW_H + +#include "BaseView.h" +#include "View.h" +#include "components/ui_swipe_view.h" +#include "goal/include/goalview.h" +#include "goal/include/goalother.h" +#include "goal/include/goalhint.h" + +namespace OHOS +{ + typedef enum + { + MAINGOALVIEW = 0, // 主目标视图 + GOALOTHERVIEW, // 其他目标 + GOALHINTVIEW, // 提示 + MAX_GOALVIEW, + } goalPageId; + class MaingoalPresenter; + class MaingoalrView : public View + { + + public: + MaingoalrView(); + virtual ~MaingoalrView(); + static MaingoalrView *GetInstance(void); + UISwipeView *MaingoalViewInit(void); + void ClearAll(void); + AppGroupView *GoalViewPageInit(void); + AppGroupView *OtherGoalPageInit(void); + AppGroupView *HintGoalPageInit(void); + + AppGroupView *FutureWeatherViewPageInit(void); + UIScrollView *WeatherDataErrorViewPageInit(void); + + GoalView *GetgoalView(void); + GoalotherView *GetohergoalView(void); + + UIView *GetGoalPageView(void); + + public: + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; + + private: + GoalView *goalView{nullptr}; + GoalotherView *goalotherView{nullptr}; + GoalhintView *goalhintView{nullptr}; + + private: + int16_t maxPage = MAX_GOALVIEW; + UISwipeView *goalSwipeViewList{nullptr}; // 天气滑动视图列表 + AppGroupView *recordCard[MAX_GOALVIEW]{nullptr}; + AppGroupView *CreatePage(int32_t WeatherPageId); + }; +} // namespace OHOS +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalhint.h b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalhint.h new file mode 100644 index 000000000..b16e17791 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalhint.h @@ -0,0 +1,49 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-03-30 09:14:38 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-04-13 18:34:25 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/GoalhintView.h + */ +#ifndef GOAL_HINT_VIEW_H +#define GOAL_HINT_VIEW_H + +#include "BaseView.h" +#include "View.h" + +#include "components/root_view.h" +#include "components/ui_view_group.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label_ext.h" +#include "components/ui_image_view.h" +#include "components/ui_image_animator.h" +#include "components/ui_circle_progress.h" + +#include "wearable_log.h" +#include "AppGroupView.h" +#include + +namespace OHOS +{ + //static constexpr const char *WeatherBackground = "/user/res/weather/WEATHER_BACKGROUND.bin"; // 天气背景 + class GoalhintView : public AppGroupView + { + + public: + GoalhintView(); + virtual ~GoalhintView(); + static GoalhintView *GetInstance(void); + bool InitPage(void); + virtual bool InitView(void *caller) override; + void ClearAll(); + bool GetInitViewState(void); + + private: + UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight); + private: + UILabelExt *goalhintlabel{nullptr}; + bool viewInitStatus{false}; + }; +} // namespace OHOS + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalmodel.h b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalmodel.h new file mode 100644 index 000000000..13268a417 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalmodel.h @@ -0,0 +1,50 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-04-08 18:40:20 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-09 15:46:16 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/WeatherModel.h + */ +#ifndef GOAL_MODEL_H +#define GOAL_MODEL_H + +#include "wearable_log.h" +#include "iostream" +#include + +namespace OHOS +{ + + class GoalModel + { + public: + static GoalModel &GetInstance(void); + + uint8_t getstepvalue(); + + char* getstepGoal(); + char* getstepnew(); + + char* getcaloriesGoal(); + char* getcaloriespnew(); + + char* getdistanceGoal(); + char* getdistancenew(); + + char* getfatburninggoal(); + char* getfatburningnew(); + + char* getstandgoal(); + char* getstandnew(); + + private: + GoalModel(); + GoalModel(const GoalModel &) = delete; + GoalModel &operator=(const GoalModel &) = delete; + virtual ~GoalModel(); + bool WEATHER_DATA_VALID{false}; // 天气数据是否有效 + }; + +} + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalother.h b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalother.h new file mode 100644 index 000000000..50b5d76f5 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalother.h @@ -0,0 +1,89 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-03-30 09:14:38 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-04-13 18:34:25 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/GoalView.h + */ +#ifndef GOAL_OTHER_VIEW_H +#define GOAL_OTHER_VIEW_H + +#include "BaseView.h" +#include "View.h" + +#include "components/root_view.h" +#include "components/ui_view_group.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label_ext.h" +#include "components/ui_image_view.h" +#include "components/ui_image_animator.h" +#include "components/ui_circle_progress.h" + +#include "wearable_log.h" +#include "AppGroupView.h" +#include + +namespace OHOS +{ + //static constexpr const char *WeatherBackground = "/user/res/weather/WEATHER_BACKGROUND.bin"; // 天气背景 + class GoalotherView : public AppGroupView + { + + public: + GoalotherView(); + virtual ~GoalotherView(); + static GoalotherView *GetInstance(void); + bool InitPage(void); + virtual bool InitView(void *caller) override; + void ClearAll(); + bool GetInitViewState(void); + + void GoalViewrefresh(); + + private: + UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight); + + private: + const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages); + void FreeImagePathsArray(const char **imagePaths, const int numImages); + void DumpWeatherInfo(); + std::string WeatherImag; // 天气图片 + std::string Temperature; // 温度 + std::string WeatherDescription; // 天气描述 + std::string WeatherArea; // 天气地区 + std::string MaxandMinTemperature; // 最高与最低气温 + private: + + + UILabelExt *caloriegoalTitle{nullptr}; // 卡路里标题 + UILabelExt *mileagegoalTitle{nullptr}; // 里程标题 + UILabelExt *fatburninggoalTitle{nullptr}; // 燃脂标题 + UILabelExt *standgoalTitle{nullptr}; // 站立标题 + + UILabel *caloriegoaldataLabel{nullptr}; // 目标 + UILabel *calorienowdataLabel{nullptr}; // 完成 + + + UILabel *mileagegoaldataLabel{nullptr}; // 目标 + UILabel *mileagenowdataLabel{nullptr}; // 完成 + + + UILabel *fatburninggoaldataLabel{nullptr}; // 目标 + UILabel *fatburningnowdataLabel{nullptr}; // 完成 + + + UILabel *standgoaldataLabel{nullptr}; // 目标 + UILabel *standnowdataLabel{nullptr}; // 完成 + + UIImageAnimatorView *PullUpAnimatorView{nullptr}; // 上拉动画 + + UIImageView *transverseline_1{nullptr}; + UIImageView *transverseline_2{nullptr}; + UIImageView *verticalline{nullptr}; + + const char **PullUpPathsArray{nullptr}; + bool viewInitStatus{false}; + }; +} // namespace OHOS + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalview.h b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalview.h new file mode 100644 index 000000000..9d4ad693c --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/include/goalview.h @@ -0,0 +1,65 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-03-30 09:14:38 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-04-13 18:34:25 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/include/GoalView.h + */ +#ifndef GOAL_VIEW_H +#define GOAL_VIEW_H + +#include "BaseView.h" +#include "View.h" + +#include "components/root_view.h" +#include "components/ui_view_group.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label_ext.h" +#include "components/ui_image_view.h" +#include "components/ui_image_animator.h" +#include "components/ui_circle_progress.h" + +#include "wearable_log.h" +#include "AppGroupView.h" +#include + +namespace OHOS +{ + //static constexpr const char *WeatherBackground = "/user/res/weather/WEATHER_BACKGROUND.bin"; // 天气背景 + class GoalView : public AppGroupView + { + + public: + + GoalView(); + virtual ~GoalView(); + static GoalView *GetInstance(void); + bool InitPage(void); + virtual bool InitView(void *caller) override; + void ClearAll(); + bool GetInitViewState(void); + void GoalViewrefresh(); + + private: + UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight); + + private: + const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages); + void FreeImagePathsArray(const char **imagePaths, const int numImages); + + private: + UICircleProgress * circleProgress1_{nullptr}; //步数进度条 + + UILabelExt *goalTitle{nullptr}; // 目标 + UILabelExt *goalstepLabel{nullptr}; // 目标 + UILabelExt *nowstepLabel{nullptr}; // 完成 + + UIImageAnimatorView *PullUpAnimatorView{nullptr}; // 上拉动画 + UIImageAnimatorView *stepAnimatorView{nullptr}; // 走路动画 + const char **PullUpPathsArray{nullptr}; + const char **goalPathsArray{nullptr}; + bool viewInitStatus{false}; + }; +} // namespace OHOS + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp new file mode 100644 index 000000000..fcc4b049f --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp @@ -0,0 +1,123 @@ +#include "AppViewIDs.h" +#include "NativeAbility.h" +#include "goal/include/Maingoalpresenter.h" +#include "common/key_code.h" +#include "common/key_code.h" +#include +#include +#include "UiConfig.h" +namespace OHOS +{ + + // 当前Presenter属性实例化的内存指针 + static MaingoalPresenter *g_pMainWeatherPresenter = nullptr; + + MaingoalPresenter::MaingoalPresenter() + { + weatherModel = &GoalModel::GetInstance(); + g_pMainWeatherPresenter = this; + } + + MaingoalPresenter::~MaingoalPresenter() + { + + g_pMainWeatherPresenter = nullptr; + } + + MaingoalPresenter *MaingoalPresenter::GetInstance() + { + + return g_pMainWeatherPresenter; + } + + void MaingoalPresenter::OnStart() + { + + Presenter::OnStart(); + } + + void MaingoalPresenter::OnPause(void) + { + + Presenter::OnPause(); + } + + void MaingoalPresenter::OnResume(void) + { + Presenter::OnResume(); + } + + void MaingoalPresenter::OnStop(void) + { + Presenter::OnStop(); + } + + bool MaingoalPresenter::OnDrag(UIView &view, const DragEvent &event) + { + UNUSED(view); + if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动 + { + MaingoalPresenter::X_DRAG_FLAG = true; + } + return true; + } + + bool MaingoalPresenter::OnDragEnd(UIView &view, const DragEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " MaingoalPresenter::OnDragEnd"); + UNUSED(view); + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MaingoalPresenter::X_DRAG_FLAG) + { + NativeAbility::GetInstance().Back(); + X_DRAG_FLAG = false; + } + return true; + } + + bool MaingoalPresenter::OnClick(UIView &view, const ClickEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " MaingoalPresenter::OnClick"); + + UNUSED(view); + UNUSED(event); + return true; + } + + // 增加按键事件 + bool MaingoalPresenter::OnKeyAct(UIView &view, const KeyEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnKeyAct"); + uint16 keyID = event.GetKeyId(); + uint16_t keyState = event.GetState(); + // 如果是power键就返回上一级 + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + { + NativeAbility::GetInstance().Back(); + } + return true; + } + + void MaingoalPresenter::OnSwipe(UISwipeView &view) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainWeatherPresenter::OnSwipe,current tab index = %d", view.GetCurrentPage()); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "the view index = %d,dragging direction = %d,current tab index = %d", view.GetViewIndex(), view.GetDirection(), view.GetCurrentPage()); + // if (view.GetCurrentPage() == GOALSTEPVIEW) + // { + + // } + } + + void GoalControlViewOnSwipeListener::OnSwipe(UISwipeView &view) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalControlViewOnSwipeListener::OnSwipe,current tab index = %d", view.GetCurrentPage()); + if (view.GetCurrentPage() == MAINGOALVIEW) + { + view.SetIntercept(false); + } + else + { + view.SetIntercept(true); + } + return; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalview.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalview.cpp new file mode 100644 index 000000000..a92501df4 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalview.cpp @@ -0,0 +1,239 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-01-29 15:37:44 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-10 11:31:08 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/MaingoalrView.cpp + */ +#include "goal/include/Maingoalview.h" +#include "goal/include/Maingoalpresenter.h" +#include "goal/include/goalmodel.h" +namespace OHOS +{ + static MaingoalrView *g_pgoalView{nullptr}; + MaingoalrView::MaingoalrView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MaingoalrView::MaingoalrView"); + g_pgoalView = this; + } + + MaingoalrView::~MaingoalrView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MaingoalrView::~MaingoalrView"); + ClearAll(); + g_pgoalView = nullptr; + } + + MaingoalrView *MaingoalrView::GetInstance(void) + { + return g_pgoalView; + } + + void MaingoalrView::ClearAll(void) + { + if (goalSwipeViewList != nullptr) + { + for (int32_t i = 0; i < maxPage; i++) + { + recordCard[i] = nullptr; + } + goalSwipeViewList->RemoveAll(); + + delete goalView; + goalView = nullptr; + + + delete goalSwipeViewList; + goalSwipeViewList = nullptr; + } + + } + + /* + * @brief 主天气页面视图初始化 + */ + UISwipeView *MaingoalrView::MaingoalViewInit(void) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MaingoalrView::MaingoalViewInit"); + goalSwipeViewList = new UISwipeView(UISwipeView::VERTICAL); + if (nullptr == goalSwipeViewList) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goalSwipeViewList new fail!!"); + return nullptr; + } + + goalSwipeViewList->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + goalSwipeViewList->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); // 0 : X; 0 : Y + goalSwipeViewList->SetAnimatorTime(50); // 50:animator drag time(ms) + goalSwipeViewList->SetViewId(MAIN_GOAL_VIEW); + goalSwipeViewList->SetDraggable(true); + goalSwipeViewList->SetTouchable(true); + for (uint16_t i = 0; i < 3; i++) + { + recordCard[i] = CreatePage(i); + if (nullptr == recordCard[i]) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "recordCard[%d] is nullptr!!", i); + return nullptr; + } + recordCard[i]->InitView(this); + goalSwipeViewList->Add(recordCard[i]); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MaingoalrView InitPage over!!"); + return goalSwipeViewList; + } + + // 获取天气页面视图 + UIView *MaingoalrView::GetGoalPageView() + { + + return dynamic_cast(MaingoalViewInit()); + + } + + void MaingoalrView::OnStart() + { + View::OnStart(); + RootView::GetInstance()->Add(GetGoalPageView()); + + if (goalSwipeViewList != nullptr) + { + UIView::OnClickListener *goalOnClickListener = (UIView::OnClickListener *)OHOS::MaingoalPresenter::GetInstance(); + if (goalOnClickListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goalOnClickListener new fail"); + return; + } + + UIView::OnDragListener *goalOnDragListener = (UIView::OnDragListener *)OHOS::MaingoalPresenter::GetInstance(); + if (goalOnDragListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnDragListener new fail"); + return; + } + + UISwipeView::OnSwipeListener *goalOnSwipeListener = (UISwipeView::OnSwipeListener *)OHOS::MaingoalPresenter::GetInstance(); + if (goalOnSwipeListener == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnSwipeListener new fail"); + return; + } + goalSwipeViewList->SetOnClickListener(goalOnClickListener); + goalSwipeViewList->SetOnDragListener(goalOnDragListener); + goalSwipeViewList->SetOnSwipeListener(goalOnSwipeListener); + } + + /* --------------------------------- 添加按键监听 --------------------------------- */ + RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MaingoalPresenter::GetInstance(); + RootView::GetInstance()->SetOnKeyActListener(keyactListener); + /* -------------------------------------------------------------------------- */ + } + + void MaingoalrView::OnSetUpView() + { + View::OnSetUpView(); + Draw(); + } + + void MaingoalrView::OnTearDownView() + { + View::OnTearDownView(); + return; + } + + void MaingoalrView::OnStop() + { + View::OnStop(); + RootView::GetInstance()->ClearOnKeyActListener(); + RootView::GetInstance()->RemoveAll(); + return; + } + + GoalView *MaingoalrView::GetgoalView(void) + { + return goalView; + } + + GoalotherView *MaingoalrView::GetohergoalView(void) + { + return goalotherView; + } + + /* + * @brief 天气页面视图初始化 + */ + AppGroupView *MaingoalrView::GoalViewPageInit(void) + { + goalView = new GoalView(); + if (goalView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MaingoalrView::new goalView fail!"); + return nullptr; + } + + return goalView; + } + + AppGroupView *MaingoalrView::OtherGoalPageInit(void) + { + goalotherView = new GoalotherView(); + if (goalotherView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MaingoalrView::new goalView fail!"); + return nullptr; + } + + return goalotherView; + } + + AppGroupView *MaingoalrView::HintGoalPageInit(void) + { + goalhintView = new GoalhintView(); + if (goalhintView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MaingoalrView::new goalView fail!"); + return nullptr; + } + + return goalhintView; + } + + + /* + * @brief 气象报告视图初始化 + */ + + struct MainWeatherViewMapper + { + const int16_t viewId; + AppGroupView *(MaingoalrView::*func)(void); + }; + + // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与DisplayBrightnessViewMapper类中的特定成员函数指针进行了绑定。 + static const MainWeatherViewMapper g_pageMapper[] = { + {MAINGOALVIEW, &MaingoalrView::GoalViewPageInit}, + {GOALOTHERVIEW, &MaingoalrView::OtherGoalPageInit}, + {GOALHINTVIEW, &MaingoalrView::HintGoalPageInit}, + }; + + /* + * @brief 根据提供的 WeatherPageId 查找对应的页面ID,然后根据这个页面ID来创建对应的页面视图 + */ + AppGroupView *MaingoalrView::CreatePage(int32_t WeatherPageId) + { + uint16_t i; + AppGroupView *view = nullptr; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CreatePage WeatherPageId:%d", WeatherPageId); + + for (i = 0; i < sizeof(g_pageMapper) / sizeof(g_pageMapper[0]); i++) + { + if (g_pageMapper[i].viewId == WeatherPageId) + { // 正确使用 WeatherPageId 来匹配视图ID + view = (this->*(g_pageMapper[i].func))(); // 如果找到匹配项,则调用相应的函数创建视图 + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CreatePage view:%p", view); + return view; // 返回创建的视图 + } + } + return nullptr; // 如果没有找到匹配的视图ID,返回 nullptr + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalhint.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalhint.cpp new file mode 100644 index 000000000..f8a4f0764 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalhint.cpp @@ -0,0 +1,106 @@ +#include "goal/include/goalhint.h" +#include "ConfigModel.h" +#include "goal/include/goalmodel.h" +#include "common/image_cache_manager.h" +/* +当至天气界面时,主动获取最新天气数据。 +(此操作静默将进行,获取到则立刻更新显示,获取不到则重试 +重试3次无果结束更新) +在加载该视图时,需要加载:1时间,2天气图片,3温度,4天气描述,5,地点,6,温度范围 +*/ + +namespace OHOS +{ + + static GoalhintView *g_pgoalView{nullptr}; + GoalhintView::GoalhintView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalhintView::GoalhintView"); + SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + SetViewIndex(0); // 视图索引 + + g_pgoalView = this; + } + + GoalhintView::~GoalhintView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " GoalhintView::~GoalhintView"); + ClearAll(); + g_pgoalView = nullptr; + } + + + void GoalhintView::ClearAll() + { + RemoveAll(); + if (goalhintlabel != nullptr) + { + delete goalhintlabel; + goalhintlabel = nullptr; + } + + } + + GoalhintView *GoalhintView::GetInstance() + { + return g_pgoalView; + } + + // 初始化标签 + UILabelExt *GoalhintView::InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight) + { + UILabelExt *label = new UILabelExt(); + if (label == nullptr) + { + return nullptr; + } + label->SetPosition(x, y, w, h); + label->SetStyle(STYLE_TEXT_FONT, textfont); + label->SetStyle(STYLE_LINE_HEIGHT, lineheight); + label->SetText(text); + label->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, textfont); + return label; + } + + // 初始化天气页面 + bool GoalhintView::InitPage(void) + { + if (goalhintlabel == nullptr) { + goalhintlabel = new UILabelExt(); + } + goalhintlabel->SetPosition(98, 198); // widget's left position and top position + goalhintlabel->Resize(200, 60); // widget's width and height + goalhintlabel->SetViewId("label13");// Set style + goalhintlabel->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + goalhintlabel->SetText("目标设置及更多数据\n请前往手机APP查看"); + goalhintlabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + goalhintlabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); + goalhintlabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + goalhintlabel->SetRollSpeed(0); + goalhintlabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + + // Add to rootView + Add(goalhintlabel); + goalhintlabel->SetVisible(true); + + return true; + } + + bool GoalhintView::InitView(void *caller) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalhintView InitView %p", caller); + if (InitPage() == false) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalhintView::InitPage fail"); + return false; + } + SetDraggable(true); + SetTouchable(true); + return true; + } + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp new file mode 100644 index 000000000..bef09fbb2 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalmodel.cpp @@ -0,0 +1,137 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-04-08 18:40:09 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-10 11:27:16 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/weather/src/GoalModel.cpp + */ +#include "goal/include/goalmodel.h" +#include "goal/include/Maingoalview.h" + +#include "ActivityModel.h" +#include "ConfigModel.h" +#include "cywee_hal.h" + +namespace OHOS +{ + + GoalModel::GoalModel() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GoalModel::GoalModel"); + } + + GoalModel::~GoalModel() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GoalModel::~GoalModel"); + } + uint8_t GoalModel::getstepvalue() + { + int stepgoal= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT); + int stepdata= OHOS::ActivityModel::GetInstance()->GetStepCounter(); + return stepdata/stepgoal *100; + } + char stepgoalstr[20]; + char* GoalModel::getstepGoal() + { + int stepgoal= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT); + memset((void *)stepgoalstr,0,20); + sprintf_s(stepgoalstr,20,"/%d",stepgoal); + return stepgoalstr; + } + + char stepnewstr[20]; + char* GoalModel::getstepnew() + { + int stepdata= OHOS::ActivityModel::GetInstance()->GetStepCounter(); + memset((void *)stepnewstr,0,20); + sprintf_s(stepnewstr,20,"%d",stepdata); + return stepnewstr; + } + + char caloriesgoalstr[20]; + char* GoalModel::getcaloriesGoal() + { + int caloriesdata= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_CALORIES); + memset((void *)caloriesgoalstr,0,20); + sprintf_s(caloriesgoalstr,20,"/%d",caloriesdata); + return caloriesgoalstr; + } + + char caloriesnewstr[20]; + char* GoalModel::getcaloriespnew() + { + int caloriesdata= get_calories_data(); + + memset((void *)caloriesnewstr,0,20); + sprintf_s(caloriesnewstr,20,"%d",caloriesdata); + return caloriesnewstr; + } + + char distancegoalstr[20]; + char* GoalModel::getdistanceGoal() + { + int distancedata= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DISTANCE); + memset((void *)distancegoalstr,0,20); + sprintf_s(distancegoalstr,20,"/%d",distancedata); + return distancegoalstr; + } + + char distancenewstr[20]; + char* GoalModel::getdistancenew() + { + int distancedata= get_distance_data(); + + memset((void *)distancenewstr,0,20); + sprintf_s(distancenewstr,20,"%d",distancedata); + return distancenewstr; + } + + char fatburninggoalstr[20]; + char* GoalModel::getfatburninggoal() + { + int fatburningdata= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION); + memset((void *)fatburninggoalstr,0,20); + sprintf_s(fatburninggoalstr,20,"/%d",fatburningdata); + return fatburninggoalstr; + } + + char fatburningnewstr[20]; + char* GoalModel::getfatburningnew() + { + int fatburningdata=10; + + memset((void *)fatburningnewstr,0,20); + sprintf_s(fatburningnewstr,20,"%d",fatburningdata); + return fatburningnewstr; + } + + char standstr[20]; + char* GoalModel::getstandgoal() + { + int standdata= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_DURATION); + memset((void *)standstr,0,20); + sprintf_s(standstr,20,"/%d",standdata); + return standstr; + } + + char standnewstr[20]; + char* GoalModel::getstandnew() + { + int standdata=10; + + memset((void *)standnewstr,0,20); + sprintf_s(standnewstr,20,"%d",standdata); + return standnewstr; + } + + + + + GoalModel &GoalModel::GetInstance() + { + static GoalModel instance; + return instance; + } + + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalother.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalother.cpp new file mode 100644 index 000000000..da1b7c5d3 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalother.cpp @@ -0,0 +1,567 @@ +#include "goal/include/goalother.h" +#include "ConfigModel.h" +#include "goal/include/goalmodel.h" +#include "common/image_cache_manager.h" +/* +当至天气界面时,主动获取最新天气数据。 +(此操作静默将进行,获取到则立刻更新显示,获取不到则重试 +重试3次无果结束更新) +在加载该视图时,需要加载:1时间,2天气图片,3温度,4天气描述,5,地点,6,温度范围 +*/ + +namespace OHOS +{ + /*主天气背景图片*/ + static constexpr int16_t WEATHER_BACKGROUND_IMAGE_X = 0; + static constexpr int16_t WEATHER_BACKGROUND_IMAGE_Y = 0; + static constexpr int16_t WEATHER_BACKGROUND_IMAGE_W = 466; + static constexpr int16_t WEATHER_BACKGROUND_IMAGE_H = 466; + + /*天气图片*/ + static constexpr int16_t WEATHER_IMAGE_X = 77; + static constexpr int16_t WEATHER_IMAGE_Y = 124; + static constexpr int16_t WEATHER_IMAGE_W = 130; + static constexpr int16_t WEATHER_IMAGE_H = 130; + + /*当前时间标签*/ + static constexpr int16_t CURRENT_TIME_LABEL_X = 133; + static constexpr int16_t CURRENT_TIME_LABEL_Y = 52; + static constexpr int16_t CURRENT_TIME_LABEL_W = 200; + static constexpr int16_t CURRENT_TIME_LABEL_H = 47; + static constexpr int16_t CURRENT_TIME_LABEL_TEXT_FONT = 40; + static constexpr int16_t CURRENT_TIME_LABEL_LINE_HEIGHT = 47; + + /*温度标签*/ + static constexpr int16_t TEMPERATURE_LABEL_X = 211; + static constexpr int16_t TEMPERATURE_LABEL_Y = 126; + static constexpr int16_t TEMPERATURE_LABEL_W = 178; + static constexpr int16_t TEMPERATURE_LABEL_H = 125; + static constexpr int16_t TEMPERATURE_LABEL_TEXT_FONT = 100; + static constexpr int16_t TEMPERATURE_LABEL_LINE_HEIGHT = 125; + + /*天气描述标签*/ + static constexpr int16_t WEATHER_DESCRIPTION_LABEL_X = 33; + static constexpr int16_t WEATHER_DESCRIPTION_LABEL_Y = 264; + static constexpr int16_t WEATHER_DESCRIPTION_LABEL_W = 400; + static constexpr int16_t WEATHER_DESCRIPTION_LABEL_H = 43; + static constexpr int16_t WEATHER_DESCRIPTION_LABEL_TEXT_FONT = 35; + static constexpr int16_t WEATHER_DESCRIPTION_LABEL_LINE_HEIGHT = 41; + + /*天气地区标签*/ + static constexpr int16_t WEATHER_AREA_LABEL_X = 43; + static constexpr int16_t WEATHER_AREA_LABEL_Y = 330; + static constexpr int16_t WEATHER_AREA_LABEL_W = 380; + static constexpr int16_t WEATHER_AREA_LABEL_H = 33; + static constexpr int16_t WEATHER_AREA_LABEL_TEXT_FONT = 26; + static constexpr int16_t WEATHER_AREA_LABEL_LINE_HEIGHT = 30; + + /*最高与最低气温标签*/ + static constexpr int16_t MAXANDMIN_TEMPERATURE_LABEL_X = 83; + static constexpr int16_t MAXANDMIN_TEMPERATURE_LABEL_Y = 368; + static constexpr int16_t MAXANDMIN_TEMPERATURE_LABEL_W = 300; + static constexpr int16_t MAXANDMIN_TEMPERATURE_LABEL_H = 33; + static constexpr int16_t MAXANDMIN_TEMPERATURE_LABEL_TEXT_FONT = 20; + static constexpr int16_t MAXANDMIN_TEMPERATURE_LABEL_LINE_HEIGHT = 23; + + static constexpr int16_t PULLUP_ANIMATOR_VIEW_X = 213; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_Y = 430; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_W = 40; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_H = 40; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_NUM_FRAMES = 70; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_TIME = 100; + static ImageAnimatorInfo PullUpimageAnimatorInfo[PULLUP_ANIMATOR_VIEW_NUM_FRAMES]; + + static ImageAnimatorInfo goalAnimatorInfo[20]; + static constexpr const char *PullUpPaths = "/user/res/weather/PullUp/PullUp_"; + + + static GoalotherView *g_pgoalView{nullptr}; + GoalotherView::GoalotherView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalotherView::GoalotherView"); + SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + SetViewIndex(0); // 视图索引 + + g_pgoalView = this; + } + + GoalotherView::~GoalotherView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " GoalotherView::~GoalotherView"); + ClearAll(); + g_pgoalView = nullptr; + } + + void GoalotherView::GoalViewrefresh() + { + mileagenowdataLabel->SetText(GoalModel::GetInstance().getdistancenew()); + mileagegoaldataLabel->SetText(GoalModel::GetInstance().getdistanceGoal()); + + fatburningnowdataLabel->SetText(GoalModel::GetInstance().getfatburningnew()); + fatburninggoaldataLabel->SetText(GoalModel::GetInstance().getfatburninggoal()); + + standnowdataLabel->SetText(GoalModel::GetInstance().getstandnew()); + standgoaldataLabel->SetText(GoalModel::GetInstance().getstandgoal()); + + calorienowdataLabel->SetText(GoalModel::GetInstance().getcaloriespnew()); + caloriegoaldataLabel->SetText(GoalModel::GetInstance().getcaloriesGoal()); + + + } + + void GoalotherView::ClearAll() + { + RemoveAll(); + if (caloriegoalTitle != nullptr) + { + delete caloriegoalTitle; + caloriegoalTitle = nullptr; + } + if (mileagegoalTitle != nullptr) + { + delete mileagegoalTitle; + mileagegoalTitle = nullptr; + } + if (fatburninggoalTitle != nullptr) + { + delete fatburninggoalTitle; + fatburninggoalTitle = nullptr; + } + if (standgoalTitle != nullptr) + { + delete standgoalTitle; + standgoalTitle = nullptr; + } + + if (caloriegoaldataLabel != nullptr) + { + delete caloriegoaldataLabel; + caloriegoaldataLabel = nullptr; + } + if (calorienowdataLabel != nullptr) + { + delete calorienowdataLabel; + calorienowdataLabel = nullptr; + } + + if (mileagegoaldataLabel != nullptr) + { + delete mileagegoaldataLabel; + mileagegoaldataLabel = nullptr; + } + if (mileagenowdataLabel != nullptr) + { + delete mileagenowdataLabel; + mileagenowdataLabel = nullptr; + } + + if (fatburninggoaldataLabel != nullptr) + { + delete fatburninggoaldataLabel; + fatburninggoaldataLabel = nullptr; + } + if (fatburningnowdataLabel != nullptr) + { + delete fatburningnowdataLabel; + fatburningnowdataLabel = nullptr; + } + + if (standgoaldataLabel != nullptr) + { + delete standgoaldataLabel; + standgoaldataLabel = nullptr; + } + if (standnowdataLabel != nullptr) + { + delete standnowdataLabel; + standnowdataLabel = nullptr; + } + + if (transverseline_1 != nullptr) + { + delete transverseline_1; + transverseline_1 = nullptr; + } + if (transverseline_2 != nullptr) + { + delete transverseline_2; + transverseline_2 = nullptr; + } + if (verticalline != nullptr) + { + delete verticalline; + verticalline = nullptr; + } + + if (PullUpAnimatorView != nullptr) + { + PullUpAnimatorView->Stop(); + delete PullUpAnimatorView; + PullUpAnimatorView = nullptr; + } + FreeImagePathsArray(PullUpPathsArray, PULLUP_ANIMATOR_VIEW_NUM_FRAMES); + + } + + GoalotherView *GoalotherView::GetInstance() + { + return g_pgoalView; + } + + // 初始化标签 + UILabelExt *GoalotherView::InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight) + { + UILabelExt *label = new UILabelExt(); + if (label == nullptr) + { + return nullptr; + } + label->SetPosition(x, y, w, h); + label->SetStyle(STYLE_TEXT_FONT, textfont); + label->SetStyle(STYLE_LINE_HEIGHT, lineheight); + label->SetText(text); + label->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, textfont); + return label; + } + + // 初始化天气页面 + bool GoalotherView::InitPage(void) + { + /////////////////////////////////线//////////////////////////////////////////////// + if (transverseline_1 == nullptr) { + transverseline_1 = new UIImageView(); + } + transverseline_1->SetPosition(0, 169); // widget's left position and top position + transverseline_1->Resize(466, 2); // widget's width and height + transverseline_1->SetViewId("image1");// Set style + transverseline_1->SetStyle(STYLE_BACKGROUND_COLOR, 0xff333333); + transverseline_1->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + transverseline_1->SetVisible(true); + + // Add ImageView to App + if (transverseline_2 == nullptr) { + transverseline_2 = new UIImageView(); + } + transverseline_2->SetPosition(232, 191); // widget's left position and top position + transverseline_2->Resize(2, 82); // widget's width and height + transverseline_2->SetViewId("image2");// Set style + transverseline_2->SetStyle(STYLE_BACKGROUND_COLOR, 0xff333333); + transverseline_2->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + transverseline_2->SetVisible(true); + + // Add ImageView to App + if (verticalline == nullptr) { + verticalline = new UIImageView(); + } + verticalline->SetPosition(0, 296); // widget's left position and top position + verticalline->Resize(466, 2); // widget's width and height + verticalline->SetViewId("image1");// Set style + verticalline->SetStyle(STYLE_BACKGROUND_COLOR, 0xff333333); + verticalline->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + verticalline->SetVisible(true); + + + /////////////////////////////////标题///////////////////////////////////////// + if (mileagegoalTitle == nullptr) { + mileagegoalTitle = new UILabelExt(); + } + mileagegoalTitle->SetPosition(168, 49); // widget's left position and top position + mileagegoalTitle->Resize(201, 65); // widget's width and height + mileagegoalTitle->SetViewId("label1");// Set style + mileagegoalTitle->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + mileagegoalTitle->SetText("里程(KM)"); + mileagegoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + mileagegoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + mileagegoalTitle->SetRollSpeed(0); + mileagegoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + mileagegoalTitle->SetVisible(true); + + if (fatburninggoalTitle == nullptr) { + fatburninggoalTitle = new UILabelExt(); + } + fatburninggoalTitle->SetPosition(61, 195); // widget's left position and top position + fatburninggoalTitle->Resize(201, 65); // widget's width and height + fatburninggoalTitle->SetViewId("label1");// Set style + fatburninggoalTitle->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + fatburninggoalTitle->SetText("燃脂时间"); + fatburninggoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + fatburninggoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + fatburninggoalTitle->SetRollSpeed(0); + fatburninggoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + fatburninggoalTitle->SetVisible(true); + + if (standgoalTitle == nullptr) { + standgoalTitle = new UILabelExt(); + } + standgoalTitle->SetPosition(279, 196); // widget's left position and top position + standgoalTitle->Resize(201, 65); // widget's width and height + standgoalTitle->SetViewId("label1");// Set style + standgoalTitle->SetStyle(STYLE_TEXT_FONT, 30); + // Set additional property + standgoalTitle->SetText("站立次数"); + standgoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + standgoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + standgoalTitle->SetRollSpeed(0); + standgoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + standgoalTitle->SetVisible(true); + + if (caloriegoalTitle == nullptr) { + caloriegoalTitle = new UILabelExt(); + } + caloriegoalTitle->SetPosition(158, 313); // widget's left position and top position + caloriegoalTitle->Resize(201, 65); // widget's width and height + caloriegoalTitle->SetViewId("label1");// Set style + caloriegoalTitle->SetStyle(STYLE_TEXT_FONT, 30); + // Set additional property + caloriegoalTitle->SetText("消耗卡路里"); + caloriegoalTitle->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + caloriegoalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + caloriegoalTitle->SetRollSpeed(0); + caloriegoalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + caloriegoalTitle->SetVisible(true); + + ////////////////////////里程/////////////////////////// + if (mileagenowdataLabel == nullptr) { + mileagenowdataLabel = new UILabel(); + } + mileagenowdataLabel->SetPosition(163-20, 87); // widget's left position and top position + mileagenowdataLabel->Resize(75, 60); // widget's width and height + mileagenowdataLabel->SetViewId("label2");// Set style + mileagenowdataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + mileagenowdataLabel->SetText(GoalModel::GetInstance().getdistancenew()); + mileagenowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + mileagenowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff)); + mileagenowdataLabel->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER); + mileagenowdataLabel->SetRollSpeed(0); + mileagenowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + mileagenowdataLabel->SetVisible(true); + + // Add Label to App + if (mileagegoaldataLabel == nullptr) { + mileagegoaldataLabel = new UILabel(); + } + mileagegoaldataLabel->SetPosition(243-20, 86); // widget's left position and top position + mileagegoaldataLabel->Resize(82, 60); // widget's width and height + mileagegoaldataLabel->SetViewId("label2");// Set style + mileagegoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + mileagegoaldataLabel->SetText(GoalModel::GetInstance().getdistanceGoal()); + mileagegoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + mileagegoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); + mileagegoaldataLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); + mileagegoaldataLabel->SetRollSpeed(0); + mileagegoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + mileagegoaldataLabel->SetVisible(true); + + ///////////////////////燃脂/////////////////////////// + if (fatburningnowdataLabel == nullptr) { + fatburningnowdataLabel = new UILabel(); + } + fatburningnowdataLabel->SetPosition(47-20, 223); // widget's left position and top position + fatburningnowdataLabel->Resize(75, 60); // widget's width and height + fatburningnowdataLabel->SetViewId("label2");// Set style + fatburningnowdataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + fatburningnowdataLabel->SetText(GoalModel::GetInstance().getfatburningnew()); + fatburningnowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + fatburningnowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff)); + fatburningnowdataLabel->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER); + fatburningnowdataLabel->SetRollSpeed(0); + fatburningnowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + fatburningnowdataLabel->SetVisible(true); + // Add Label to App + if (fatburninggoaldataLabel == nullptr) { + fatburninggoaldataLabel = new UILabel(); + } + fatburninggoaldataLabel->SetPosition(128-20, 223); // widget's left position and top position + fatburninggoaldataLabel->Resize(82, 60); // widget's width and height + fatburninggoaldataLabel->SetViewId("label2");// Set style + fatburninggoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + fatburninggoaldataLabel->SetText(GoalModel::GetInstance().getfatburninggoal()); + fatburninggoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + fatburninggoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); + fatburninggoaldataLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); + fatburninggoaldataLabel->SetRollSpeed(0); + fatburninggoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + fatburninggoaldataLabel->SetVisible(true); + ///////////////////////站立/////////////////////////// + if (standnowdataLabel == nullptr) { + standnowdataLabel = new UILabel(); + } + standnowdataLabel->SetPosition(47+200, 223); // widget's left position and top position + standnowdataLabel->Resize(75, 60); // widget's width and height + standnowdataLabel->SetViewId("label2");// Set style + standnowdataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + + standnowdataLabel->SetText(GoalModel::GetInstance().getstandnew()); + standnowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + standnowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff)); + standnowdataLabel->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER); + standnowdataLabel->SetRollSpeed(0); + standnowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + standnowdataLabel->SetVisible(true); + + if (standgoaldataLabel == nullptr) { + standgoaldataLabel = new UILabel(); + } + standgoaldataLabel->SetPosition(128+200, 223); // widget's left position and top position + standgoaldataLabel->Resize(82, 60); // widget's width and height + standgoaldataLabel->SetViewId("label2");// Set style + standgoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + standgoaldataLabel->SetText(GoalModel::GetInstance().getstandgoal()); + standgoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + standgoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); + standgoaldataLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); + standgoaldataLabel->SetRollSpeed(0); + standgoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + + ///////////////////////卡路里/////////////////////////// + if (calorienowdataLabel == nullptr) { + calorienowdataLabel = new UILabel(); + } + calorienowdataLabel->SetPosition(163-20, 353); // widget's left position and top position + calorienowdataLabel->Resize(75, 60); // widget's width and height + calorienowdataLabel->SetViewId("label2");// Set style + calorienowdataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + calorienowdataLabel->SetText(GoalModel::GetInstance().getcaloriespnew()); + calorienowdataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + calorienowdataLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff)); + calorienowdataLabel->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER); + calorienowdataLabel->SetRollSpeed(0); + calorienowdataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + calorienowdataLabel->SetVisible(true); + + if (caloriegoaldataLabel == nullptr) { + caloriegoaldataLabel = new UILabel(); + } + caloriegoaldataLabel->SetPosition(243-20, 353); // widget's left position and top position + caloriegoaldataLabel->Resize(82, 60); // widget's width and height + caloriegoaldataLabel->SetViewId("label2");// Set style + caloriegoaldataLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + caloriegoaldataLabel->SetText(GoalModel::GetInstance().getcaloriesGoal()); + + caloriegoaldataLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + caloriegoaldataLabel->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); + caloriegoaldataLabel->SetAlign(TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_CENTER); + caloriegoaldataLabel->SetRollSpeed(0); + caloriegoaldataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + caloriegoaldataLabel->SetVisible(true); + + PullUpPathsArray = CreateImagePathsArray(PullUpPaths, "bin", PULLUP_ANIMATOR_VIEW_NUM_FRAMES); + if (PullUpAnimatorView == nullptr) + { + PullUpAnimatorView = new UIImageAnimatorView(); + if (PullUpAnimatorView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpAnimatorView new fail"); + return false; + } + for (uint8_t i = 0; i < PULLUP_ANIMATOR_VIEW_NUM_FRAMES; i++) + { + PullUpimageAnimatorInfo[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(PullUpPathsArray[i]); + PullUpimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + PullUpimageAnimatorInfo[i].pos.x = PULLUP_ANIMATOR_VIEW_X; + PullUpimageAnimatorInfo[i].pos.y = PULLUP_ANIMATOR_VIEW_Y; + PullUpimageAnimatorInfo[i].width = PULLUP_ANIMATOR_VIEW_W; + PullUpimageAnimatorInfo[i].height = PULLUP_ANIMATOR_VIEW_H; + } + PullUpAnimatorView->SetPosition(PULLUP_ANIMATOR_VIEW_X, PULLUP_ANIMATOR_VIEW_Y, PULLUP_ANIMATOR_VIEW_W, PULLUP_ANIMATOR_VIEW_H); + PullUpAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + PullUpAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + PullUpAnimatorView->SetImageAnimatorSrc(PullUpimageAnimatorInfo, PULLUP_ANIMATOR_VIEW_NUM_FRAMES, PULLUP_ANIMATOR_VIEW_TIME); + PullUpAnimatorView->SetRepeat(true); + PullUpAnimatorView->Start(); + } + /* -------------------------------- 将组件添加到根视图 ------------------------------- */ + Add(caloriegoalTitle); + Add(mileagegoalTitle); + Add(fatburninggoalTitle); + Add(standgoalTitle); + + Add(caloriegoaldataLabel); + Add(calorienowdataLabel); + + Add(mileagegoaldataLabel); + Add(mileagenowdataLabel); + + Add(fatburninggoaldataLabel); + Add(fatburningnowdataLabel); + + Add(standgoaldataLabel); + Add(standnowdataLabel); + + Add(PullUpAnimatorView); + + Add(transverseline_1); + Add(transverseline_2); + Add(verticalline); + return true; + } + + bool GoalotherView::InitView(void *caller) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalotherView InitView %p", caller); + if (InitPage() == false) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalotherView::InitPage fail"); + return false; + } + SetDraggable(true); + SetTouchable(true); + return true; + } + + // 获取视图初始化状态 + bool GoalotherView::GetInitViewState(void) + { + return viewInitStatus; + } + + const char **GoalotherView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages) + { + const char **imagePaths = new const char *[numImages]; + char buffer[256]; + for (int i = 0; i < numImages; i++) + { + snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension); + imagePaths[i] = strdup(buffer); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]); + } + return imagePaths; + } + + /* + * @brief: 释放图片路径数组指针 + * @param {char} imagePaths 图片路径数组 + * @param {int} numImages 图片数量 + */ + void GoalotherView::FreeImagePathsArray(const char **imagePaths, const int numImages) + { + for (int i = 0; i < numImages; i++) + { + delete imagePaths[i]; + imagePaths[i] = nullptr; + } + } + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp new file mode 100644 index 000000000..efc442fdb --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/goalview.cpp @@ -0,0 +1,320 @@ +#include "goal/include/goalview.h" +#include "ConfigModel.h" +#include "goal/include/goalmodel.h" +#include "common/image_cache_manager.h" +/* +当至天气界面时,主动获取最新天气数据。 +(此操作静默将进行,获取到则立刻更新显示,获取不到则重试 +重试3次无果结束更新) +在加载该视图时,需要加载:1时间,2天气图片,3温度,4天气描述,5,地点,6,温度范围 +*/ + +namespace OHOS +{ + + + static constexpr int16_t PULLUP_ANIMATOR_VIEW_X = 213; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_Y = 364; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_W = 40; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_H = 40; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_NUM_FRAMES = 70; + static constexpr int16_t PULLUP_ANIMATOR_VIEW_TIME = 100; + static ImageAnimatorInfo PullUpimageAnimatorInfo[PULLUP_ANIMATOR_VIEW_NUM_FRAMES]; + + static ImageAnimatorInfo goalAnimatorInfo[20]; + static constexpr const char *PullUpPaths = "/user/res/weather/PullUp/PullUp_"; + + static constexpr const char *stepPaths = "/user/res/step/"; + + static GoalView *g_pgoalView{nullptr}; + GoalView::GoalView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalView::GoalView"); + SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + SetViewIndex(0); // 视图索引 + + g_pgoalView = this; + } + + GoalView::~GoalView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " GoalView::~GoalView"); + ClearAll(); + g_pgoalView = nullptr; + } + + void GoalView::GoalViewrefresh() + { + nowstepLabel->SetText(GoalModel::GetInstance().getstepnew()); + goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal()); + + circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue()); + + } + + void GoalView::ClearAll() + { + RemoveAll(); + if (circleProgress1_ != nullptr) + { + delete circleProgress1_; + circleProgress1_ = nullptr; + } + if (goalstepLabel != nullptr) + { + delete goalstepLabel; + goalstepLabel = nullptr; + } + if (nowstepLabel != nullptr) + { + delete nowstepLabel; + nowstepLabel = nullptr; + } + if (goalTitle != nullptr) + { + delete goalTitle; + goalTitle = nullptr; + } + if (stepAnimatorView != nullptr) + { + delete stepAnimatorView; + stepAnimatorView = nullptr; + } + if (PullUpAnimatorView != nullptr) + { + PullUpAnimatorView->Stop(); + delete PullUpAnimatorView; + PullUpAnimatorView = nullptr; + } + FreeImagePathsArray(PullUpPathsArray, PULLUP_ANIMATOR_VIEW_NUM_FRAMES); + FreeImagePathsArray(PullUpPathsArray, 20); + + } + + GoalView *GoalView::GetInstance() + { + return g_pgoalView; + } + + // 初始化标签 + UILabelExt *GoalView::InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight) + { + UILabelExt *label = new UILabelExt(); + if (label == nullptr) + { + return nullptr; + } + label->SetPosition(x, y, w, h); + label->SetStyle(STYLE_TEXT_FONT, textfont); + label->SetStyle(STYLE_LINE_HEIGHT, lineheight); + label->SetText(text); + label->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, textfont); + return label; + } + + // 初始化天气页面 + bool GoalView::InitPage(void) + { + + + /* --------------------------------goalTitle--------------------------------- */ + if (goalTitle == nullptr) { + goalTitle = new UILabelExt(); + } + goalTitle->SetPosition(173, 50); // widget's left position and top position + goalTitle->Resize(200, 60); // widget's width and height + goalTitle->SetViewId("label1");// Set style + goalTitle->SetStyle(STYLE_TEXT_FONT, 30); + + // Set additional property + goalTitle->SetText("今日步数"); + goalTitle->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + goalTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + goalTitle->SetRollSpeed(0); + goalTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /*----------------------------------------------------------------------------- */ + + + // Add Label to App + if (nowstepLabel == nullptr) { + nowstepLabel = new UILabelExt(); + } + nowstepLabel->SetPosition(121, 201); // widget's left position and top position + nowstepLabel->Resize(223, 94); // widget's width and height + nowstepLabel->SetViewId("nowstepLabel");// Set style + nowstepLabel->SetStyle(STYLE_TEXT_FONT, 80); + + // Set additional property + + nowstepLabel->SetText(GoalModel::GetInstance().getstepnew()); + nowstepLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + //nowstepLabel->SetTextColor(0x4FC34C); + nowstepLabel->SetTextColor(Color::GetColorFromRGBA(0x4F, 0xC3, 0x4C, 0xff)); + nowstepLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + nowstepLabel->SetRollSpeed(0); + nowstepLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 80); + + + // Add Label to App + if (goalstepLabel == nullptr) { + goalstepLabel = new UILabelExt(); + } + goalstepLabel->SetPosition(157, 297); // widget's left position and top position + goalstepLabel->Resize(152, 47); // widget's width and height + goalstepLabel->SetViewId("goalstepLabel");// Set style + goalstepLabel->SetStyle(STYLE_TEXT_FONT, 40); + + // Set additional property + goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal()); + goalstepLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + goalstepLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); + goalstepLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + goalstepLabel->SetRollSpeed(0); + goalstepLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); + + + /*----------------------------------------------------------------------------- */ + + if (circleProgress1_ == nullptr) { + circleProgress1_ = new UICircleProgress(); + } + circleProgress1_->SetPosition(0, 0); // widget's left position and top position + circleProgress1_->Resize(466, 466); // widget's width and height + circleProgress1_->SetViewId("circleProgress1");// Set style + circleProgress1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + circleProgress1_->SetStyle(STYLE_BORDER_WIDTH, 10); + + // Set additional property + // Set BackgroundStyle + circleProgress1_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + circleProgress1_->SetBackgroundStyle(STYLE_LINE_WIDTH, 16); + // Set ForegroundStyle + circleProgress1_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195f6); + circleProgress1_->SetForegroundStyle(STYLE_BORDER_WIDTH, 80); + circleProgress1_->SetForegroundStyle(STYLE_BORDER_RADIUS, 16); + circleProgress1_->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff); + circleProgress1_->SetForegroundStyle(STYLE_LINE_HEIGHT, 35); + circleProgress1_->SetForegroundStyle(STYLE_LINE_COLOR, 0xff45ff5d); + circleProgress1_->SetForegroundStyle(STYLE_LINE_WIDTH, 16); + circleProgress1_->SetCenterPosition(224, 220); + circleProgress1_->SetRadius(195); + circleProgress1_->SetStartAngle(40); + circleProgress1_->SetEndAngle(320); + circleProgress1_->SetValue(1); + + /*----------------------------------------------------------------------------- */ + goalPathsArray = CreateImagePathsArray(stepPaths, "bin", 20); + if (stepAnimatorView == nullptr) + { + stepAnimatorView = new UIImageAnimatorView(); + if (stepAnimatorView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpAnimatorView new fail"); + return false; + } + for (uint8_t i = 0; i < 20; i++) + { + goalAnimatorInfo[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(goalPathsArray[i]); + goalAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + goalAnimatorInfo[i].pos.x = 193; + goalAnimatorInfo[i].pos.y = 90; + goalAnimatorInfo[i].width = 100; + goalAnimatorInfo[i].height = 100; + } + stepAnimatorView->SetPosition(183, 90, 100, 100); + stepAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + stepAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + stepAnimatorView->SetImageAnimatorSrc(goalAnimatorInfo, 20, 100); + stepAnimatorView->SetRepeat(true); + stepAnimatorView->Start(); + } + + + + PullUpPathsArray = CreateImagePathsArray(PullUpPaths, "bin", PULLUP_ANIMATOR_VIEW_NUM_FRAMES); + if (PullUpAnimatorView == nullptr) + { + PullUpAnimatorView = new UIImageAnimatorView(); + if (PullUpAnimatorView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PullUpAnimatorView new fail"); + return false; + } + for (uint8_t i = 0; i < PULLUP_ANIMATOR_VIEW_NUM_FRAMES; i++) + { + PullUpimageAnimatorInfo[i].imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(PullUpPathsArray[i]); + PullUpimageAnimatorInfo[i].imageType = IMG_SRC_IMAGE_INFO; + PullUpimageAnimatorInfo[i].pos.x = PULLUP_ANIMATOR_VIEW_X; + PullUpimageAnimatorInfo[i].pos.y = PULLUP_ANIMATOR_VIEW_Y; + PullUpimageAnimatorInfo[i].width = PULLUP_ANIMATOR_VIEW_W; + PullUpimageAnimatorInfo[i].height = PULLUP_ANIMATOR_VIEW_H; + } + PullUpAnimatorView->SetPosition(PULLUP_ANIMATOR_VIEW_X, PULLUP_ANIMATOR_VIEW_Y, PULLUP_ANIMATOR_VIEW_W, PULLUP_ANIMATOR_VIEW_H); + PullUpAnimatorView->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + PullUpAnimatorView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + PullUpAnimatorView->SetImageAnimatorSrc(PullUpimageAnimatorInfo, PULLUP_ANIMATOR_VIEW_NUM_FRAMES, PULLUP_ANIMATOR_VIEW_TIME); + PullUpAnimatorView->SetRepeat(true); + PullUpAnimatorView->Start(); + } + /* -------------------------------- 将组件添加到根视图 ------------------------------- */ + Add(circleProgress1_); + Add(goalstepLabel); + Add(nowstepLabel); + Add(PullUpAnimatorView); + Add(goalTitle); + Add(stepAnimatorView); + + viewInitStatus = true; + return true; + } + + bool GoalView::InitView(void *caller) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalView InitView %p", caller); + if (InitPage() == false) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GoalView::InitPage fail"); + return false; + } + SetDraggable(true); + SetTouchable(true); + return true; + } + + // 获取视图初始化状态 + bool GoalView::GetInitViewState(void) + { + return viewInitStatus; + } + + + const char **GoalView::CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages) + { + const char **imagePaths = new const char *[numImages]; + char buffer[256]; + for (int i = 0; i < numImages; i++) + { + snprintf(buffer, sizeof(buffer), "%s%d.%s", basePath, i + 1, fileExtension); + imagePaths[i] = strdup(buffer); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " imagePaths[%d] = %s", i, imagePaths[i]); + } + return imagePaths; + } + + /* + * @brief: 释放图片路径数组指针 + * @param {char} imagePaths 图片路径数组 + * @param {int} numImages 图片数量 + */ + void GoalView::FreeImagePathsArray(const char **imagePaths, const int numImages) + { + for (int i = 0; i < numImages; i++) + { + delete imagePaths[i]; + imagePaths[i] = nullptr; + } + } + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index e8bffe48d..5858b7e0e 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -448,6 +448,7 @@ void set_languaage(uint32_t id) #ifdef FD230 OHOS::language::GetInstance()->ChangeLanguage(id); #endif + } char *addressbook(void)//获取通讯录保存文件地址路径 diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 5fc847729..1106eeaba 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -4301,15 +4301,6 @@ void Read_JSON_file_buf_send_bin_Data(uint8_t num,uint16_t id,char *data_item) path=get_health_OXYGEN_data_path(); dataBit = 1;//血氧数据字节1个字节 uint8_t break; - case 0x44://同步燃脂时间数据 - path=NULL; - break; - case 0x46://同步卡路里历史数据 - path=NULL; - break; - case 0x47://同步距离历史数据 - path=NULL; - break; case 0x4b://睡眠历史数据 path=NULL; break; @@ -4376,8 +4367,8 @@ void Read_JSON_file_buf_send_bin_Data(uint8_t num,uint16_t id,char *data_item) for(int i=0;ivalueint; - uint32_t value=cJSON_GetObjectItem(heart_data_item,"value")->valueint; + uint32_t timestamp=cJSON_GetObjectItem(heart_data_item,"timestamp")->valueint; + uint8_t value=cJSON_GetObjectItem(heart_data_item,"value")->valueint; // value =450; printf("value :%d\r\n",value); printf("timestamp :%d\r\n",timestamp); @@ -5424,7 +5415,7 @@ void decode_file_checksum(ble_read_data *buffer_handle) case 3://dial TRANSMIT_DATA= TRANS_DIAL_FAIL; CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); - ble_reply_cmd(DIAL_INSTALL_REPY_CMD,0); + break; default: break; @@ -5445,7 +5436,6 @@ void decode_file_checksum(ble_read_data *buffer_handle) case 3://dial TRANSMIT_DATA= TRANS_DIAL_FAIL; CustomEventPublish(TOPIC_EVENT_BLE_TRANSMIT,&TRANSMIT_DATA,1); - ble_reply_cmd(DIAL_INSTALL_REPY_CMD,0); break; default: break; diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/1.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/1.bin new file mode 100644 index 000000000..4e459fada --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9843e75686c25594a82a3ad4f6a9d5a29a24ab4af5ea5af3c39a1675ee36d07 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/10.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/10.bin new file mode 100644 index 000000000..c76bcd4df --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/10.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a25f247f35639d428c45940021f21d4fe25d3020d705e759ee39e97f45135a71 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/11.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/11.bin new file mode 100644 index 000000000..91165f9e1 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/11.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e65d177955da6fdb9c5224bd955b22fb5dbe1add8b42904740946abdd189871 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/12.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/12.bin new file mode 100644 index 000000000..2e93be7bc --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/12.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a3fd771ff91d194079b8538bab723ffe1c8e2d134ef37cab8488f3b77826dc5 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/13.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/13.bin new file mode 100644 index 000000000..a5ad281c4 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/13.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bccd59acc1b87bdb3d92c9ef76abae6aeb486c10ab074556bd2f1b3fd3198f5e +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/14.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/14.bin new file mode 100644 index 000000000..366c3dbcb --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/14.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:782e38b305507170cddbf96a0e98aaa0292bd0b19c2817a27e8bafb9d9a9a27d +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/15.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/15.bin new file mode 100644 index 000000000..f352ffab7 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/15.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e4f5848eedc7999f07c220c119eed3c9d9e0a885d55e5532b184f3f17264df5 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/16.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/16.bin new file mode 100644 index 000000000..23161bc45 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/16.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0ab63324633f0b58db87d5af8f4748657cd0f4875bd3e98ff5708229db49fdf +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/17.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/17.bin new file mode 100644 index 000000000..46119cd8d --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/17.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8781fc9de927d45cc16d6dac9b754c8e1d20f76a935c092663d35f5c2d6cee1e +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/18.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/18.bin new file mode 100644 index 000000000..d93d30ac1 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/18.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18b1cd08391ecf406e54f83866e0c71c6d7cce81a15dc3d3e37605e324d922f6 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/19.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/19.bin new file mode 100644 index 000000000..ed3d3e362 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/19.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:248a37acfc6f5fdbcdfc61b0e82d1b99fd00b269b51f8b8631094be25c7660c5 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/2.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/2.bin new file mode 100644 index 000000000..5df50c720 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:687d1d7454931e647f1b5f8df7b80ec345e00e54759e946ec8331fe0688400a4 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/20.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/20.bin new file mode 100644 index 000000000..4ae9a1a17 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/20.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:932fbce28b1f75bd95dbe75594ab4c0498d1f6a1be54c04ad3bdc4e3f8edf2da +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/3.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/3.bin new file mode 100644 index 000000000..b05972154 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/3.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eabb81bcfd3cbe50e91bf6bee5ea878424f3d8ce01c38746146c680d88ccc9f8 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/4.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/4.bin new file mode 100644 index 000000000..1588b5d45 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/4.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52d07c91058ff172f1c9b21e97a12af3b56d95fb88e7307eb2aa75adf759daae +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/5.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/5.bin new file mode 100644 index 000000000..5cb59b9de --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/5.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:745e8dfad4fd99a26ae6b3d54622d8f48636f4593c5b49e6efc41d310e997592 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/6.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/6.bin new file mode 100644 index 000000000..b935abb64 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/6.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e8b22db9a32d8d2a06800f83e01500d3d9c673f27f5068fe728202f08cd0d99 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/7.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/7.bin new file mode 100644 index 000000000..294bde3fb --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/7.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:feea6eb8af29185f46af7af9908cccc6600fd5743ecce116b7d463e46933e699 +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/8.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/8.bin new file mode 100644 index 000000000..ba01960ee --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/8.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3a7dce81442aca5b3dc4689501159c91ec8a75d8a70918bbfd20df901a876bf +size 6824 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/9.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/9.bin new file mode 100644 index 000000000..460b28a04 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/step/9.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce894ba1a43f6b407f25cd201a3b72da7ab387649d116c20bc9971524da575df +size 6824 diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index ee472fe3d..88a353e7a 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -520,7 +520,10 @@ void distances_history_save(void); void set_stand_falg(void); void set_calories_data(uint32_t data); +int get_calories_data(void); + void set_distance_data(uint32_t data); +int get_distance_data(void ); void cywee_get_chipinfo(char *databuf,uint8_t len); void cywee_get_acc_switch(uint8_t cmd); diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 5009ec1ff..cdda9ddbf 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -94,16 +94,26 @@ void step_history_save(void) CWM_OS_saveData_history(&stepcount,&history_step_,sizeof(int),CYWEE_SAVE_DATA_STEP); } +int get_calories_data(void) +{ + return new_calories; +} void set_calories_data(uint32_t data) { new_calories=data; } + void set_distance_data(uint32_t data) { new_distance=data; } +int get_distance_data(void ) +{ + return new_distance; +} + void set_stand_falg(void) { stand_falg=1; @@ -124,6 +134,7 @@ void distances_history_save(void) } + void cywee_ar_alert_switch(int cmd) { memset(&scl, 0, sizeof(scl)); -- 2.17.1