From: Caisking <3449750381@qq.com> Date: Thu, 20 Jun 2024 03:24:22 +0000 (+0800) Subject: 增加训练睡眠否决 X-Git-Tag: release_V1.2.70_20241020_135402~948^2~39 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8cb4951f2305ad02fa8c7bbf6620fe1881c989b5;p=mirrors%2FFD230.git 增加训练睡眠否决 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp index e1b5e418d..c5ae60dea 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp @@ -27,6 +27,48 @@ extern "C" namespace OHOS { + +#ifdef __cplusplus + extern "C" + { +#endif + +#include "pm_veto.h" +#include "pm.h" + /*移除睡眠否决投票*/ + void uapi_remove_sport_vote(void) + { + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_HEART); + if (cnt == 1) + { + uapi_pm_remove_sleep_veto(PM_ID_HEART); + } + else + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE, "Sport SERVICE MCU has delete pm_id_Sport vote"); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE, "Sport SERVICE MCU SLEEP SUCCESS"); + } + + /*添加睡眠否决投票*/ + void uapi_add_sport_vote(void) + { + uint8_t cnt = pm_veto_get_id_cnt(PM_ID_HEART); + if (cnt == 0) + { + uapi_pm_add_sleep_veto(PM_ID_HEART); + } + else + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE, "Sport SERVICE MCU has got pm_id_Sport vote"); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE, "Sport SERVICE MCU WAKEUP SUCCESS"); + } + +#ifdef __cplusplus + } +#endif + static const uint16_t LABEL_FONT_SIZE = 200; static const uint32_t BACK_GROUND_COLOR = 0xfff6f6f6; static const uint32_t CARD_PAGE_COLOR = 0xffd0d0d0; @@ -36,10 +78,11 @@ namespace OHOS TraingCardView::TraingCardView() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingCardView::TraingCardView"); - g_pTraingCardView = this; InitTimer(); // 开启计时器 TraingModel::GetInstance()->SetSportState(ExerciseState::Start); // 设置运动状态为开始 TraingModel::GetInstance()->SetTimestamp(); + uapi_add_sport_vote(); // 保护进程 + g_pTraingCardView = this; } TraingCardView::~TraingCardView() @@ -48,6 +91,7 @@ namespace OHOS g_pTraingCardView = nullptr; DisableTimer(); // 关闭计时器 TraingModel::GetInstance()->SetTimestamp(); + uapi_remove_sport_vote(); // 移除 } TraingCardView *TraingCardView::GetInstance() @@ -385,7 +429,7 @@ namespace OHOS getView->SetDirection(1); // 初始化Lable - InitLabelExt(labeltitle, 83, 50, 300, 35, "label1",STR_GOAL_ACHIEVED, DEFAULT_VECTOR_FONT_FILENAME, 35); + InitLabelExt(labeltitle, 83, 50, 300, 35, "label1", STR_GOAL_ACHIEVED, DEFAULT_VECTOR_FONT_FILENAME, 35); getView->Add(labeltitle); InitLabelExt(labelgettag, 103, 307, 200, 35, "label3", STR_ACCOMPLISH_GOAL, DEFAULT_VECTOR_FONT_FILENAME, 30); getView->Add(labelgettag);