-/***
- * @Author: Caisking 3449750381@qq.com
- * @Date: 2024-03-20 15:35:57
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-03-29 11:49:27
- * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- */
+
#ifndef Traing_MODEL_H
#define Traing_MODEL_H
int GetCal(); /*获取运动卡路里*/
// 训练状态相关配置
- void SetEntryType(ENTEYTYPE type); /*设置进入训练方式*/
- ENTEYTYPE GetEntryType(); /*获取训练进入方式*/
- void SetSportOpenWay(bool way); /*设置运动开始方式*/
- void SetSportOpenState(bool state); /*设置运动是否开始*/
- bool GetSportOpenState(); /*获取运动是否开始*/
- bool GetMomentum(); /*获取训练量是否达标*/
- void SetSportState(ExerciseState state); /*设置运动状态*/
- ExerciseState GetSportState(); /*获取运动状态*/
- void ResetSharedTrainingData(); /*重新初始化训练配置*/
+ void SetEntryType(ENTEYTYPE type); /*设置进入训练方式*/
+ ENTEYTYPE GetEntryType(); /*获取训练进入方式*/
+ void SetSportOpenWay(bool way); /*设置运动开始方式*/
+ void SetSportOpenState(bool state); /*设置运动是否开始*/
+ bool GetSportOpenState(); /*获取运动是否开始*/
+ bool GetMomentum(); /*获取训练量是否达标*/
+ void SetSportState(ExerciseState state); /*设置运动状态*/
+ ExerciseState GetSportState(); /*获取运动状态*/
+ void ResetSharedTrainingData(); /*重新初始化训练配置*/
+ void set_sport_config(UIResourceTextId id); // 运动识别进入运动
// 训练时间相关配置
std::string AnalysisTimestamp(uint64_t timestamp); /*解析时间戳*/
#define HIGH_INTENSITY_LOWER_THRESHOLD 70
#define HIGH_INTENSITY_UPPER_THRESHOLD 79
+#define MAXSPORTID 176
+
extern "C" errcode_t uapi_get_timestampe_ms(uint32_t *tm);
#ifdef __cplusplus
sendtraningdata(&data); // 发送数据函数
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SendLiveData Stop!");
}
+ /* -------------------------------- 运动识别发起处理 -------------------------------- */
+ void TraingModel::set_sport_config(UIResourceTextId id)
+ {
+ if (id >= MAXSPORTID)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "id is error");
+ return;
+ }
+ // 开始训练 ->不返回
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD);
+ // 配置运动项
+ SetSportEvent(id);
+ // 获取运动项目
+ ExerciseClass type = GetSportId();
+ // 开启对应的运动
+ TraingCardPresenter::GetInstance()->OpenSensor(type);
+ // 设置为手表开启运动
+ SetSportOpenWay(false);
+ }
+
/* -------------------------------------------------------------------------- */
#if TIMER
/* 时间显示 */
+/*** \r
+ * @Date: 2024-04-15 10:55:58\r
+ * @LastEditors: Caisking 3449750381@qq.com\r
+ * @LastEditTime: 2024-08-19 10:55:50\r
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TraingCardPresenter.h\r
+ */\r
/***\r
* @Author: Caisking 3449750381@qq.com\r
* @Date: 2024-03-19 17:37:18\r
\r
/*蓝牙开启运动*/\r
bool send_sport_cmd(training_ble *cmd);\r
- /*运动识别开启运动*/\r
- void set_sport_config(UIResourceTextId id);\r
\r
/*控制*/\r
void handleStartState();\r
+++ /dev/null
-#ifndef _TraingCard_PRESENTERC_H
-#define _TraingCard_PRESENTERC_H
-namespace OHOS
-{
- /*运动识别开启运动*/
- void set_sport_config(UIResourceTextId id);
-
-}
-
-#endif
\ No newline at end of file
\r
return false; // 没有匹配的操作\r
}\r
- /* -------------------------------- 运动识别发起处理 -------------------------------- */\r
- void TraingCardPresenter::set_sport_config(UIResourceTextId id)\r
- {\r
- if (id >= MAXSPORTID)\r
- {\r
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "id is error");\r
- return;\r
- }\r
- // 开始训练 ->不返回\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD);\r
- // 配置运动项\r
- TraingModel::GetInstance()->SetSportEvent(id);\r
- // 获取运动项目\r
- ExerciseClass type = TraingModel::GetInstance()->GetSportId();\r
- // 开启对应的运动\r
- TraingCardPresenter::GetInstance()->OpenSensor(type);\r
- // 设置为手表开启运动\r
- TraingModel::GetInstance()->SetSportOpenWay(false);\r
- }\r
\r
/* -------------------------------- 协议发起运动处理 -------------------------------- */\r
bool TraingCardPresenter::send_sport_cmd(training_ble *cmd)\r
/*运动识别*/
#include "BaseView.h"
+#include"ui_resource_string.h"
namespace OHOS
{
UIViewGroup *CreateMotionRecognitionView(void);
void SetMotionTypeId(int type);
int GetMotionType(void);
- int GetMotionTypeTextId(void);
+ UIResourceTextId GetMotionTypeTextId(void);
private:
MotionRecognitionViewEventListener();
#endif
#include <service/graphic_service.h>
#include "ConfigModel.h"
+#include "traing/include/TraingModel.h"
namespace OHOS
{
/*关闭弹窗*/
NotificationManager::GetInstance()->StopNotify();
/*开始运动*/
- int textId = GetMotionTypeTextId();
- // set_sport_config(textId);
+ UIResourceTextId sportId = GetMotionTypeTextId();
+ TraingModel::GetInstance()->set_sport_config(sportId);
}
return true;
return motionType;
}
- int MotionRecognitionViewEventListener::GetMotionTypeTextId(void)
+ UIResourceTextId MotionRecognitionViewEventListener::GetMotionTypeTextId(void)
{
- int motionTypeTextId;
+ UIResourceTextId motionTypeTextId;
switch (motionTypeId)
{
case 1: