From: Caisking <3449750381@qq.com> Date: Fri, 16 Aug 2024 08:51:42 +0000 (+0800) Subject: 同步applsit更新;配置充电不能进行检测 X-Git-Tag: release_V1.2.70_20241020_135402~656 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a6da3f1591ded4bf6213b653b51e668242893e07;p=mirrors%2FFD230.git 同步applsit更新;配置充电不能进行检测 --- 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 f3caa03d7..d9bdc484c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp @@ -21,7 +21,7 @@ #include "applist/include/ApplistModel.h" #include "themestyle/include/ThemeStyleModel.h" -#define HEART_APPLIST 0 +#define HEART_APPLIST 1 namespace OHOS { /**- APPLSIT @@ -57,7 +57,7 @@ namespace OHOS #endif {VIEW_MAIN_PHONE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_DEFAULT_IMG, "手机", STR_PHONE, nullptr}, #if HEART_APPLIST - {VIEW_HEART_RESULT, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_DEFAULT_IMG, "心率", STR_HEART_RATE, nullptr}, + {VIEW_HEART_CHART, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_DEFAULT_IMG, "心率", STR_HEART_RATE, nullptr}, #endif {VIEW_BLOOD_RESULT, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_DEFAULT_IMG, "血氧", STR_BLOOD_OXYGEN, nullptr}, {VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_DEFAULT_IMG, "训练", STR_TRAINING, nullptr}, diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp index 6929aa7fd..01821c221 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp @@ -14,7 +14,11 @@ #include "ConfigModel.h" #include "traing/include/TraingModel.h" #include -namespace OHOS { +#include "heart_blood/health_service/health_service.h" +#include "battery_hal.h" + +namespace OHOS +{ ApplistPresenter::ApplistPresenter() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::ApplistPresenter()"); @@ -25,7 +29,8 @@ namespace OHOS { ApplistPresenter::~ApplistPresenter() { - if (keyActListenr != nullptr) { + if (keyActListenr != nullptr) + { delete keyActListenr; keyActListenr = nullptr; } @@ -36,11 +41,15 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnStart()"); Presenter::OnStart(); - if (keyActListenr == nullptr) { + if (keyActListenr == nullptr) + { keyActListenr = new KeyInputListener(); - if (keyActListenr != nullptr) { + if (keyActListenr != nullptr) + { RootView::GetInstance()->SetOnKeyActListener(keyActListenr); - } else { + } + else + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnStart: new KeyInputListener fail"); } } @@ -50,11 +59,13 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnResume()"); Presenter::OnResume(); - if (view_ == nullptr) { + if (view_ == nullptr) + { return; } const AppItem *itemInfo = model->GetApplistItems(); - for (uint8 i = 0; i < model->GetAppListNum(); i++) { + for (uint8 i = 0; i < model->GetAppListNum(); i++) + { view_->AddAppItemToList(itemInfo[i]); } view_->RefreshAppList(); @@ -72,25 +83,28 @@ namespace OHOS { Presenter::OnStop(); } - bool ApplistPresenter::OnRotate(UIView& view, const RotateEvent& event) + bool ApplistPresenter::OnRotate(UIView &view, const RotateEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnRotate"); - UICustomHexagonsList* hexagonsView = dynamic_cast(&view); - if (hexagonsView == nullptr) { + UICustomHexagonsList *hexagonsView = dynamic_cast(&view); + if (hexagonsView == nullptr) + { return false; } - + int8_t index = hexagonsView->GetFocusedImgIndex(); uint8_t focusIndex_ = 0; - if (index >= 0) { + if (index >= 0) + { focusIndex_ = static_cast(index); } - + HexagonsItemView *itemView = dynamic_cast(hexagonsView->GetViewByIndex(focusIndex_)); AppViewId viewId = itemView->GetViewId(); - if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) { // 2.0 threshold for beginning transition + if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) + { // 2.0 threshold for beginning transition hexagonsView->StopRotateAnimator(); - //NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS); + // NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS); NativeAbility::GetInstance().EnterSlice(viewId, TransitionType::TRANSITION_HEXAGONS); hexagonsView->ClearFocus(); } @@ -101,17 +115,21 @@ namespace OHOS { { UNUSED(event); AppViewId viewId = VIEW_INVALID; - char *uid = nullptr; + char *uid = nullptr; TransitionType type = TransitionType::TRANSITION_INVALID; AppListStyle style = GetCurrentStyle(); - if (style == AppListStyle::FOOTBALL_STYLE) { + if (style == AppListStyle::FOOTBALL_STYLE) + { FootballItemView *itemView = dynamic_cast(&view); viewId = itemView->GetViewId(); uid = (char *)itemView->GetAppUid(); - } else if (style == AppListStyle::HEXAGONS_STYLE) { + } + else if (style == AppListStyle::HEXAGONS_STYLE) + { HexagonsItemView *itemView = dynamic_cast(&view); - UIHexagonsList* hexagonsView = dynamic_cast(itemView->GetParent()); - if (hexagonsView == nullptr || itemView == nullptr) { + UIHexagonsList *hexagonsView = dynamic_cast(itemView->GetParent()); + if (hexagonsView == nullptr || itemView == nullptr) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hexagonsView or itemView is nullptr"); return false; } @@ -120,32 +138,45 @@ namespace OHOS { hexagonsView->SetDraggable(false); hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view type = TransitionType::TRANSITION_HEXAGONS; - } - else if(AppListStyle::ARC_SCALE_LIST_STYLE == style) + } + else if (AppListStyle::ARC_SCALE_LIST_STYLE == style) { - ArcScaleListItemView * itemView = dynamic_cast(&view); - if(nullptr == itemView) + ArcScaleListItemView *itemView = dynamic_cast(&view); + if (nullptr == itemView) { return false; } viewId = itemView->GetViewId(); uid = (char *)itemView->GetAppUid(); } - else { + else + { AppItemView *itemView = dynamic_cast(&view); - if (itemView == nullptr) { + if (itemView == nullptr) + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr", viewId); return false; } viewId = itemView->GetViewId(); uid = (char *)itemView->GetAppUid(); } - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d type = %d", viewId,type); - if (viewId < VIEW_MAX_INTER_APP) { - //NativeAbility::GetInstance().ChangeSlice(viewId, type); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d type = %d", viewId, type); + if (viewId < VIEW_MAX_INTER_APP) + { + /*心率Slice需要增加特殊配置*/ + bool isCharging = get_charge_stat(); // 获取充电状态 + if (isCharging && viewId == VIEW_HEART_CHART) + { + HealthState highHealthState; + highHealthState.checkType = CHARGE; + HealthService::GetInstance()->SetHealthCurrent(highHealthState); + viewId = VIEW_CHECK_INVALID; + } NativeAbility::GetInstance().EnterSlice(viewId, type); return true; - } else if (viewId == VIEW_EXTERN_APP) { + } + else if (viewId == VIEW_EXTERN_APP) + { #ifdef JS_ENABLE WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick bundleName = %s", uid); Want *want = new Want(); @@ -167,11 +198,13 @@ namespace OHOS { void ApplistPresenter::OnItemSelected(int16 index, UIView *view) { UNUSED(index); - if (view != nullptr) { + if (view != nullptr) + { itemViewSele = static_cast(view); itemViewSele->SelectedChange(); - if (preItemViewSele != nullptr && preItemViewSele != itemViewSele) { + if (preItemViewSele != nullptr && preItemViewSele != itemViewSele) + { preItemViewSele->Reset(); } preItemViewSele = itemViewSele; @@ -209,7 +242,7 @@ namespace OHOS { return model->GetCurrentStyle(); } - ApplistView* ApplistPresenter::GetAppListView() + ApplistView *ApplistPresenter::GetAppListView() { return view_; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp index 105c0fe34..25ff1c43b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp @@ -12,8 +12,9 @@ extern "C" errcode_t uapi_get_timestamp_ms(uint32_t *tm); #include "ConfigModel.h" #include "AppViewIDs.h" #include "NativeAbility.h" +#include "battery_hal.h" -#define MAX_UNWARE_COUNT 30 +#define MAX_UNWARE_COUNT 20 #define MAX_VALID_SPO2_COUNT 30 #define MAX_DISVALID_SPO2_COUNT 100 namespace OHOS @@ -64,6 +65,13 @@ namespace OHOS } else if (state == BloodState::Start && startspo2 == false) { + /*充电状态下不进行检测*/ + bool isCharging = get_charge_stat(); // 获取充电状态 + if (isCharging) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "充电不能检测"); + return; + } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "startspo2 Start"); uint16_t md = PPG_SERVICE_CMD_TYPE_DO_SPO2_TEST; send_ppg_cmd_msg(md); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalPresenter.cpp index ea61a6c5e..2597ad3d8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalPresenter.cpp @@ -1,3 +1,9 @@ +/*** + * @Date: 2024-07-30 11:22:00 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-08-16 15:59:09 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalPresenter.cpp + */ /* * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. * Description: bloodOxygen view @@ -39,7 +45,8 @@ #include "cywee_service.h" #include "MainModel.h" - +#include "heart_blood/health_service/health_service.h" +#include "battery_hal.h" namespace OHOS { @@ -79,7 +86,19 @@ namespace OHOS } if (strcmp(view.GetViewId(), CLICK_BLOOD_RE) == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_BLOOD_CHECK, TransitionType::TRANSITION_ZOOM); + // 检测过程中充电 失败可以弹窗 + bool isCharging = get_charge_stat(); // 获取充电状态 + if (isCharging) + { + HealthState highHealthState; + highHealthState.checkType = CHARGE; + HealthService::GetInstance()->SetHealthCurrent(highHealthState); + NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_INVALID, TransitionType::TRANSITION_ZOOM); + return true; + } + // 回到上一个检测界面 + uint16 preSlice = NativeAbility::GetInstance().GetPreSliceId(); + NativeAbility::GetInstance().ChangeSlice(preSlice, TransitionType::TRANSITION_ZOOM); } return true; }