--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: bloodOxygen view
+ * Author:
+ * Create: 2021-08-01
+ */
+
+#include "heart_blood/CheckInvalidPresenter.h"
+#include "common/task_manager.h"
+#include "BloodOxygenModel.h"
+
+#include "bloodoxygen/include/BloodDetectionView.h"
+#include "heart_blood/CheckInvalidView.h"
+
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+
+#include "ChangeSliceListener.h"
+#include "broadcast_service.h"
+#include <fstream>
+#include "iostream"
+#include <sstream>
+#include <string>
+#include <cstdlib>
+#include <ctime>
+#include "wearable_log.h"
+#include "cmsis_os.h"
+#include "securec.h"
+#include "broadcast_service.h"
+#include "graphic_service.h"
+#include <chrono>
+#include <thread>
+#include <sys/time.h>
+
+#include "ppg_service.h"
+#include "displaybrightness/include/DisplayBrightnessModel.h"
+#include "power_display_service.h"
+#include "custom_utils.h"
+#include "cywee_service.h"
+
+#include "MainModel.h"
+
+namespace OHOS
+{
+
+ static CheckInvalidPresenter *g_pCheckInvalidPresenter;
+
+ CheckInvalidPresenter::CheckInvalidPresenter()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CheckInvalidPresenter::new CheckInvalidPresenter");
+ g_pCheckInvalidPresenter = this;
+ }
+ CheckInvalidPresenter::~CheckInvalidPresenter()
+ {
+ g_pCheckInvalidPresenter = nullptr;
+ }
+ CheckInvalidPresenter *CheckInvalidPresenter::GetInstance()
+ {
+ return g_pCheckInvalidPresenter;
+ }
+ void CheckInvalidPresenter::OnStart()
+ {
+ Presenter<CheckInvalidView>::OnStart();
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CheckInvalidPresenter::On Start ");
+ }
+ void CheckInvalidPresenter::OnPause(void) {}
+
+ void CheckInvalidPresenter::OnResume(void) {}
+
+ void CheckInvalidPresenter::OnStop(void) {}
+
+ bool CheckInvalidPresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPresenter::OnClick");
+
+ if (strcmp(view.GetViewId(), CLICK_BLOOD_KONW) == 0)
+ {
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_ZOOM);
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-30 16:39:56
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/CheckInvalidView.cpp
+ */
+
+#include "common/image_cache_manager.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+#include "MainViewSample.h"
+#include "components/ui_view_group.h"
+#include "DialModelSPO2.h"
+#include "DialModelHeartRate.h"
+#include "BloodOxygenModel.h"
+
+#include "UiConfig.h"
+#include "uicomponents/UIComponents.h"
+#include "MainPresenterSample.h"
+
+#include "heart_blood/CheckInvalidPresenter.h"
+#include "heart_blood/CheckInvalidView.h"
+
+#include "heart_blood/health_service/health_service.h"
+
+#include "vibrator_service.h"
+extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType);
+
+namespace OHOS
+{
+ static CheckInvalidView *g_pCheckInvalidView{nullptr};
+ static const char *BLOOD_PATH_NOTE = "/user/res/Blood/Error.bin";
+
+ CheckInvalidView::CheckInvalidView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckInvalidView::CheckInvalidView");
+ g_pCheckInvalidView = this;
+ }
+
+ CheckInvalidView::~CheckInvalidView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckInvalidView::~CheckInvalidView");
+ DeInit();
+ g_pCheckInvalidView = nullptr;
+ }
+
+ CheckInvalidView *CheckInvalidView::GetInstance()
+ {
+ return g_pCheckInvalidView;
+ }
+
+ void CheckInvalidView::SetViewData()
+ {
+ HealthState healthState = HealthService::GetInstance()->GetHealthCurrent();
+
+ // 判断类型
+ if (healthState.checkType == BLOOD_CHECK)
+ {
+ titleLabel->SetTextId(STR_CHECKEWARN);
+
+ if (healthState.resultStatus == LOW)
+ {
+ SetNoteLabel(STR_BLOODSHORT, healthState.checkResult);
+ }
+ }
+ else if (healthState.checkType == HEART_CHECK)
+ {
+ titleLabel->SetTextId(STR_HEARTTITLE);
+ // 处理心率状态
+ switch (healthState.resultStatus)
+ {
+ case HIGH:
+ SetNoteLabel(STR_HEARTMAX, healthState.checkResult);
+ break;
+ case LOW:
+ SetNoteLabel(STR_HEARTMIN, healthState.checkResult);
+ break;
+ default:
+ SetNoteLabel(STR_HEARTMAX, healthState.checkResult);
+ break;
+ }
+ }
+ }
+
+ void CheckInvalidView::SetNoteLabel(UIResourceTextId viewId, int checkResult)
+ {
+ noteLabel->SetTextId(viewId);
+ UpdateLabel(noteLabel, checkResult, viewId);
+ }
+ /* -------------------------------------------------------------------------- */
+ /***
+ * @description:
+ * @return 添加按键是否成功
+ */
+ bool CheckInvalidView::AddButton()
+ {
+ /*初始化按键*/
+ InitButtonExt(kownButton, 0, 366, 466, 100, CLICK_BLOOD_KONW, STR_KONW, 30);
+ kownButton->SetImageSrc(PNG_466x100BUTTON_IMAGE, PNG_466x100BUTTON_IMAGE);
+ kownButton->SetOnClickListener(presenter_);
+
+ container_->Add(kownButton);
+ return true;
+ }
+ /***
+ * @description:
+ * @return 初始化标签是否成功
+ */
+ bool CheckInvalidView::InitLable()
+ {
+ /*初始化title*/
+ InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKEWARN, DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabelExt(remindLabel, 53, 270, 360, 70, "remindLabel", STR_HEARTNOTE, DEFAULT_VECTOR_FONT_FILENAME, 30);
+ // 设置来回滚动属性
+ InitLabelExt(noteLabel, 53, 230, 360, 70, "time", STR_HEARTNOTE, DEFAULT_VECTOR_FONT_FILENAME, 30);
+ noteLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ noteLabel->SetRollSpeed(70);
+
+ container_->Add(titleLabel);
+ container_->Add(remindLabel);
+ container_->Add(noteLabel);
+ return true;
+ }
+ /***
+ * @description:
+ * @return 初始化背景是否成功
+ */
+ bool CheckInvalidView::Initbackground()
+ {
+
+ noteimage = new UIImageView();
+ noteimage->SetPosition(193, 120, 80, 80);
+ noteimage->SetSrc(BLOOD_PATH_NOTE);
+
+ container_->Add(noteimage);
+ return true;
+ }
+ /***
+ * @description:
+ * @return 是否初始化成功
+ */
+ bool CheckInvalidView::CheckInvalidViewInit()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bool CheckInvalidView::InitView()");
+ if (!Initbackground())
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Initbackground error!");
+ };
+ if (!InitLable())
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLable error!");
+ };
+ if (!AddButton())
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddButton error!");
+ };
+ return true;
+ }
+ /***
+ * @description:
+ * @return 删除组件
+ */
+ void CheckInvalidView::DeInit()
+ {
+ if (kownButton != nullptr)
+ {
+ delete kownButton;
+ kownButton = nullptr;
+ }
+ if (noteLabel != nullptr)
+ {
+ delete noteLabel;
+ noteLabel = nullptr;
+ }
+ if (titleLabel != nullptr)
+ {
+ delete titleLabel;
+ titleLabel = nullptr;
+ }
+ if (remindLabel != nullptr)
+ {
+ delete remindLabel;
+ remindLabel = nullptr;
+ }
+ if (noteimage != nullptr)
+ {
+ delete noteimage;
+ noteimage = nullptr;
+ }
+ }
+
+ void CheckInvalidView::OnStart()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckInvalidView::OnStart");
+ View<CheckInvalidPresenter>::OnStart();
+
+ SetContainerView(new UIViewGroup());
+ container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+
+ if (!CheckInvalidViewInit())
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckInvalidView::InitBloodView fail");
+ }
+ SetViewData();
+
+ custom_VibratorFunc(VibratorType::VIBRATOR_TYPE_TWO); // 震动提醒
+
+ RootView::GetInstance()->Add(container_);
+ SetContainerView(container_);
+
+ container_->SetDraggable(true);
+ container_->SetTouchable(true);
+ container_->SetOnDragListener(presenter_);
+
+ // 增加按键监听
+ RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::CheckInvalidPresenter::GetInstance();
+ RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ }
+ void CheckInvalidView::OnSetUpView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckInvalidView::OnSetUpView");
+ View<CheckInvalidPresenter>::OnSetUpView();
+ Draw();
+ }
+ void CheckInvalidView::OnTearDownView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckInvalidView::OnTearDownView");
+ View<CheckInvalidPresenter>::OnTearDownView();
+ return;
+ }
+
+ void CheckInvalidView::OnStop()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckInvalidView::OnStop");
+ View<CheckInvalidPresenter>::OnStop();
+ if (container_ != nullptr)
+ {
+ container_->RemoveAll();
+ delete container_;
+ container_ = nullptr;
+ }
+ return;
+ }
+}
--- /dev/null
+/***
+ * @Date: 2024-07-30 11:22:29
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-30 17:39:46
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.h
+ */
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-30 11:46:23
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/CheckInvalidView.h
+ */
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-05-07 18:51:13
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/CheckInvalidView.h
+ */
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: bloodResult view
+ * Author:
+ * Create: 2021-08-01
+ */
+
+#ifndef CHECK_Invalid_VIEW_H
+#define CHECK_Invalid_VIEW_H
+
+#include "View.h"
+#include "BaseView.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include"ui_resource_string.h"
+
+#include "components/ui_button.h"
+#include "components/ui_label_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_circle_progress.h"
+#include "components/ui_view_group.h"
+#include "heart_blood/CheckInvalidPresenter.h"
+
+#include "components/ui_scroll_view.h"
+#include "components/ui_label_button_ext.h"
+namespace OHOS
+{
+ class CheckInvalidPresenter;
+ class CheckInvalidView : public View<CheckInvalidPresenter>
+ {
+ public:
+ CheckInvalidView();
+ virtual ~CheckInvalidView();
+ static CheckInvalidView *GetInstance(void);
+
+ void OnStop() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStart() override;
+
+ bool CheckInvalidViewInit();
+
+ void DeInit();
+ bool AddButton();
+ bool InitLable();
+ bool Initbackground();
+
+ void SetViewData();
+ void SetNoteLabel(UIResourceTextId viewId, int checkResult);
+
+ private:
+ // 提醒图标
+ UIImageView *noteimage = nullptr;
+ // 按键
+ UILabelButtonExt *kownButton = nullptr;
+ // 提醒label
+ UILabelExt *titleLabel = nullptr;
+ UILabelExt *noteLabel = nullptr;
+ UILabelExt *remindLabel = nullptr;
+ };
+}
+
+#endif // 血氧主界面
\ No newline at end of file