From: Caisking <3449750381@qq.com> Date: Thu, 5 Sep 2024 07:16:19 +0000 (+0800) Subject: 增加血氧数据的nextday清空以及UI更新 X-Git-Tag: release_V1.2.70_20241020_135402~518^2~30 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=88bdfd3dcba10ee72e815ca402887ac21fa20cf6;p=mirrors%2FFD230.git 增加血氧数据的nextday清空以及UI更新 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenModel.h b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenModel.h index e43dcd1e0..339f0c05d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenModel.h @@ -1,4 +1,10 @@ /*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-09-05 14:58:21 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenModel.h + */ +/*** * @Date: 2024-04-15 10:55:58 * @LastEditors: Caisking 3449750381@qq.com * @LastEditTime: 2024-07-31 10:38:26 @@ -52,10 +58,10 @@ namespace OHOS void Blood_Result(void); void Blood_Control(BloodState state); - void ReInit(); + void ClearDisplayData(); + void CleanAllData(); private: - uint16_t displayspo2; uint16_t currentspo2; uint32_t timestamp_ms; 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 c6cf4d21d..546f4adbb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenModel.cpp @@ -13,6 +13,8 @@ extern "C" errcode_t uapi_get_timestamp_ms(uint32_t *tm); #include "AppViewIDs.h" #include "NativeAbility.h" #include "battery_hal.h" +#include "heart_blood/BloodCardView.h" +#include "MainViewSample.h" #define MAX_UNWARE_COUNT 30 #define MAX_VALID_SPO2_COUNT 30 @@ -46,8 +48,8 @@ namespace OHOS return &instance; } /* ---------------------------------- 状态检测 ---------------------------------- */ - // 重新初始化 - void BloodOxygenModel::ReInit() + + void BloodOxygenModel::ClearDisplayData() { currentspo2 = 0; timestamp_ms = 0; @@ -232,7 +234,6 @@ namespace OHOS } // 更新SPO2数据 - void BloodOxygenModel::UpSPO2data(uint8_t spo2) { displayspo2 = spo2; @@ -266,4 +267,20 @@ namespace OHOS Blood_Stop(); } } + + // 更新血氧数据 + void BloodOxygenModel::CleanAllData(void) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Nextday!"); + if (MainViewSample::GetInstance() != nullptr && BloodCardView::GetInstance() != nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "更新主界面血氧卡片"); + BloodCardView::GetInstance()->UpSPO2Text(); + } + if (BloodResultView::GetInstance() != nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "更新测量血氧卡片"); + BloodResultView::GetInstance()->UpSPO2Text(); + } + } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp index e59bdab3b..97fe087c0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp @@ -1,11 +1,10 @@ -/*** +/*** * @Date: 2024-04-15 10:55:58 * @LastEditors: Caisking 3449750381@qq.com * @LastEditTime: 2024-07-31 14:36:25 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp */ - #include "common/image_cache_manager.h" #include "ui_resource_image.h" #include @@ -48,6 +47,9 @@ namespace OHOS /* -------------------------------------------------------------------------- */ void BloodResultView::UpSPO2Text() { + if (bloodLabel == nullptr || timeLabel == nullptr) + return; + // 更新血氧数据 uint16_t spo2 = BloodOxygenModel::GetInstance()->GetSPO2data(); if (spo2 != 0) // 判断是否为默认数据 diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp index 8959d10a6..d10167b33 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp @@ -42,6 +42,9 @@ namespace OHOS /* -------------------------------------------------------------------------- */ void BloodCardView::UpSPO2Text() { + if (bloodLabel == nullptr || timeLabel == nullptr) + return; + // 更新血氧数据 uint16_t spo2 = BloodOxygenModel::GetInstance()->GetSPO2data(); if (spo2 != 0) // 判断是否为默认数据