bool AssistantModel::StartAssistant(void) {
if (uapi_open_voice_recognition() == 0) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uapi_open_voice_recognition is ok");
+ //成功开启语音助手
+ uapi_dev_runtime_set_voice_status(1);
return true;
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
}
//关闭语音助手
void AssistantModel::StopAssistant(void) {
-
if (uapi_close_voice_recognition() == 0) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
"uapi_close_voice_recognition is ok");
->IsVisible() == true &&
p_AssistantView->GetAssistantScrollView(ASSISTANT_MAIN_VIEW)
->IsVisible() == false) {
+ //设置退出状态
+ uapi_dev_runtime_set_voice_status(0);
p_AssistantView->ChangeView(ASSISTANT_ANSWER_VIEW, ASSISTANT_MAIN_VIEW);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "退出语音助手成功\r\n");
}
messageTimestamp = currentTimestamp;
+ /*
+ 以下状态不进行消息弹窗
+ -训练中
+ -省电模式
+ -呼吸训练中
+ -使用语音助手
+ */
if (uapi_dev_runtime_get_train_status() ||
uapi_dev_runtime_get_saveele_status() ||
- uapi_dev_runtime_get_respiratory_training_status()) {
+ uapi_dev_runtime_get_respiratory_training_status() ||
+ uapi_dev_runtime_get_voice_status()) {
free(messageInfo_.title);
free(messageInfo_.msg);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageInfo add is ok");
}
-
-
// 获取目前的项
MessageData *MessageModel::GetCurrentMessageData() {
if (currentIndex_ < MessageVector.size()) {
/*分析activity extra info数据*/
void TraingModel::AnalysisExtraData(
cywee_activity_result_extre_info_t *cyweeInfo) {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "extra data %d %d %d %d",
+
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[apc:%d fpc:%d cdc:%d std:%d]",
cyweeInfo->avg_pace, cyweeInfo->max_pace,
cyweeInfo->avg_step_freq, cyweeInfo->avg_step_len);
+ //平均配速
if (cyweeInfo->avg_pace != 0) {
sportdata->apc = cyweeInfo->avg_pace;
}
+ //最快配速
if (cyweeInfo->max_pace != 0) {
- sportdata->fpc = cyweeInfo->max_pace;
+ sportdata->fpc =cyweeInfo->max_pace;
}
+ //平均步频
if (cyweeInfo->avg_step_freq != 0) {
sportdata->cdc = cyweeInfo->avg_step_freq;
}
+ //平均步长
if (cyweeInfo->avg_step_len != 0) {
sportdata->std = cyweeInfo->avg_step_len * 100; // 前者cm 后者m
}
}
}
-// 每10秒进行配速和心率数据存储
+// 每5秒进行配速和心率数据存储
void TraingModel::StoreDataIfMinutePassed() {
if (sportdata->duration % 5 == 0) {
uint32_t timestamp;
ControlSensor(ExerciseState::End);\r
uapi_set_screen_on_api(); // 亮屏\r
#if DATATEST\r
- NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDDATA);\r
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDDATA);\r
+ // 回退\r
+ NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL);\r
return;\r
#endif\r
// 是否达到训练目标\r
#include "traing/include/TraingModel.h"\r
#include "uicomponents/UIComponents.h"\r
\r
-\r
extern "C" {\r
void StartTimer();\r
void StopAndResetTimer();\r
endView->RemoveAll();\r
getView->RemoveAll();\r
heartView->RemoveAll();\r
+ DetailView->RemoveAll();\r
\r
/*标签*/\r
delete endtitle;\r
endnotelabel = nullptr;\r
delete endnote;\r
endnote = nullptr;\r
+\r
delete labeltitle;\r
labeltitle = nullptr;\r
delete labeltag;\r
labelgettag = nullptr;\r
delete labelpre;\r
labelpre = nullptr;\r
+\r
delete hearttitle;\r
hearttitle = nullptr;\r
delete labelnote;\r
dataallview_ = nullptr;\r
delete musicview_;\r
musicview_ = nullptr;\r
+ delete DetailView; //删除屏蔽卡片\r
+ DetailView = nullptr;\r
\r
/*弹窗*/\r
delete endView;\r
\r
void TraingCardView::OnStop() {\r
View<TraingCardPresenter>::OnStop();\r
- container_ = nullptr;\r
+ // if (container_ != nullptr) {\r
+ // container_->RemoveAll();\r
+ // delete container_;\r
+ // container_ = nullptr;\r
+ // }\r
RootView::GetInstance()->RemoveAll();\r
return;\r
}\r
delete trainingDetailView;
trainingDetailView = nullptr;
+
+ delete trainingDataAllView;
+ trainingDataAllView = nullptr;
+
+ delete traingDataAllPageView;
+ traingDataAllPageView = nullptr;
}
UISwipeView *TraingDataAllView::TraingDataAllViewInit(void) {
void TrainingControlView::DeInit() {
RemoveAll();
if (labeltitle != nullptr) {
+ delete labeltitle;
labeltitle = nullptr;
}
if (labeltimer != nullptr) {
#include "common/image_cache_manager.h"
#include "components/ui_button.h"
#include "components/ui_label_ext.h"
+#include "custom_runtime.h"
#include "traing/Training_UiConfig.h"
#include "traing/include/TraingModel.h"
#include "ui_resource_image.h"
#include "ui_resource_string.h"
#include "uicomponents/UIComponents.h"
#include <ui_scroll_view.h>
-#include "custom_runtime.h"
namespace OHOS {
}
TrainingDataView::~TrainingDataView() {
- RemoveAll();
DeInit();
g_pTrainingDataView = nullptr;
}
InitLabelExt(sportlabel, 83, 120, 300, 35, "label2", sport_id,
DEFAULT_VECTOR_FONT_FILENAME, 30);
sportlabel->SetTextColor(Color::Gray());
-
//数字统一使用DEFAULT_VECTOR_FONT_FILENAME_EN
InitLabel(curtimelabel, 155, 60, 150, 50, "label1", "23:54",
DEFAULT_VECTOR_FONT_FILENAME_EN, 40);
DEFAULT_VECTOR_FONT_FILENAME_EN, 80);
InitLabel(heartlabel, 85, 284, 230, 80, "label4", "--",
DEFAULT_VECTOR_FONT_FILENAME_EN, 60);
-
InitLabel(ubpmlabel, 218, 284, 230, 80, "label5", "bpm",
DEFAULT_VECTOR_FONT_FILENAME, 60);
ubpmlabel->SetTextColor(Color::Gray());
return true;
#if 0
- // 初始化Button
- InitButton(buttonNote, 275, 350, 26, 26, BUTTONNOTE);
- // Set additional property
- buttonNote->SetImageSrc(NOTE_IMAGE, NOTE_IMAGE);
- buttonNote->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingCardPresenter::GetInstance()));
- Add(buttonNote);
+ // 初始化Button
+ InitButton(buttonNote, 275, 350, 26, 26, BUTTONNOTE);
+ // Set additional property
+ buttonNote->SetImageSrc(NOTE_IMAGE, NOTE_IMAGE);
+ buttonNote->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingCardPresenter::GetInstance()));
+ Add(buttonNote);
#endif
// 增加上拉卡片
// SetCoverable(true);
void TrainingDataView::DeInit() {
RemoveAll();
if (curtimelabel != nullptr) {
+ delete curtimelabel;
curtimelabel = nullptr;
}
if (sportlabel != nullptr) {
delete ubpmlabel;
ubpmlabel = nullptr;
}
+
// 删除button
if (buttonNote != nullptr) {
delete buttonNote;
}
// 删除Image
- if (image_lowIntensity != nullptr) {
- delete image_lowIntensity;
- image_lowIntensity = nullptr;
- }
if (image_iconup != nullptr) {
delete image_iconup;
image_iconup = nullptr;
delete image_iconpoint;
image_iconpoint = nullptr;
}
+ if (image_heart != nullptr) {
+ delete image_heart;
+ image_heart = nullptr;
+ }
+ if (image_progress != nullptr) {
+ delete image_progress;
+ image_progress = nullptr;
+ }
+
+ //删除进度条圆圈
if (circleProgress != nullptr) {
delete circleProgress;
circleProgress = nullptr;
// 解析时间
int hour = pTM.tm_hour;
//需要判断显示的格式
- if (uapi_dev_runtime_get_time_hour_show_model() == 12)
- {
- if (pTM.tm_hour > 12)
- hour = pTM.tm_hour - 12 ;
+ if (uapi_dev_runtime_get_time_hour_show_model() == 12) {
+ if (pTM.tm_hour > 12)
+ hour = pTM.tm_hour - 12;
}
-
+
int minute = pTM.tm_min;
// 将时间和日期转换为字符串
g_pTrainingDetailView = this;
}
TrainingDetailView::~TrainingDetailView() {
- RemoveAll();
DeInit();
g_pTrainingDetailView = nullptr;
}
uint8_t transmitting_status;//是否处于ble传输状态
uint8_t atuoota_status;//是否处于自动ota状态
+ uint8_t voice_status;//是否处于使用语音助手
} runtime_status_t;
{
return g_runtime.heartrate_detect_status;
}
+//设置是否在使用语音助手功能
+void uapi_dev_runtime_set_voice_status(uint8_t status)
+{
+ g_runtime.voice_status = status;
+}
+uint8_t uapi_dev_runtime_get_voice_status(void)
+{
+ return g_runtime.voice_status;
+}
// 设置是否为指南针页面状态
void uapi_dev_runtime_set_mmc_status(uint8_t status)
{
// 安全模式
uint8_t uapi_dev_runtime_get_safemode_flag(void);
+//是否使用语音助手状态
+void uapi_dev_runtime_set_voice_status(uint8_t status);
+uint8_t uapi_dev_runtime_get_voice_status(void);
void uapi_dev_runtime_set_hrs_passivity(uint8_t status);
// 获取被动心率检测状态