--- /dev/null
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: bloodOxygen view
+ * Author:
+ * Create: 2021-08-01
+ */
+
+#include "heart_blood/CheckAbnormalPresenter.h"
+#include "common/task_manager.h"
+#include "BloodOxygenModel.h"
+
+#include "bloodoxygen/include/BloodDetectionView.h"
+#include "heart_blood/CheckAbnormalView.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 CheckAbnormalPresenter *g_pCheckAbnormalPresenter;
+
+ CheckAbnormalPresenter::CheckAbnormalPresenter()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CheckAbnormalPresenter::new CheckAbnormalPresenter");
+ g_pCheckAbnormalPresenter = this;
+ }
+ CheckAbnormalPresenter::~CheckAbnormalPresenter()
+ {
+ g_pCheckAbnormalPresenter = nullptr;
+ }
+ CheckAbnormalPresenter *CheckAbnormalPresenter::GetInstance()
+ {
+ return g_pCheckAbnormalPresenter;
+ }
+ void CheckAbnormalPresenter::OnStart()
+ {
+ Presenter<CheckAbnormalView>::OnStart();
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CheckAbnormalPresenter::On Start ");
+ }
+ void CheckAbnormalPresenter::OnPause(void) {}
+
+ void CheckAbnormalPresenter::OnResume(void) {}
+
+ void CheckAbnormalPresenter::OnStop(void) {}
+
+ bool CheckAbnormalPresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPresenter::OnClick");
+
+ if (strcmp(view.GetViewId(), CLICK_BLOOD_STOP) == 0)
+ {
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_ZOOM);
+ }
+ if (strcmp(view.GetViewId(), CLICK_BLOOD_RE) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_BLOODOXY_CHECK, TransitionType::TRANSITION_ZOOM);
+ }
+ return true;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/***
+ * @Date: 2024-07-30 11:22:09
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-30 16:39:17
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalPresenter.h
+ */
+
+#ifndef CHECK_ABNORMAL_PRESENTER_H
+#define CHECK_ABNORMAL_PRESENTER_H
+
+#include "Presenter.h"
+#include "ModelListenerSample.h"
+#include "components/ui_circle_progress.h"
+#include "ohos_types.h"
+#include "KeyInputListener.h"
+#include "common/key_code.h"
+#include "heart_blood/CheckAbnormalView.h"
+
+namespace OHOS
+{
+ static constexpr const char *CLICK_BLOOD_STOP = "clickbloodstop"; // 血氧检测暂停
+ static constexpr const char *CLICK_BLOOD_RE = "clickbloodre"; // 血氧检测重新
+
+ class CheckAbnormalView;
+ class CheckAbnormalPresenter : public Presenter<CheckAbnormalView>,
+ public UIView::OnClickListener,
+
+ public UIView::OnDragListener
+ {
+ public:
+ CheckAbnormalPresenter();
+ virtual ~CheckAbnormalPresenter();
+ static CheckAbnormalPresenter *GetInstance(void);
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ };
+}
+
+#endif
--- /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/CheckAbnormalView.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/CheckAbnormalPresenter.h"
+#include "heart_blood/CheckAbnormalView.h"
+
+#include "vibrator_service.h"
+extern "C" void custom_VibratorFunc(OHOS::VibratorType vibratorType);
+namespace OHOS
+{
+ static CheckAbnormalView *g_pCheckAbnormalView{nullptr};
+ static const char *BLOOD_PATH_NOTE = "/user/res/Blood/Error.bin";
+
+ CheckAbnormalView::CheckAbnormalView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::CheckAbnormalView");
+ g_pCheckAbnormalView = this;
+ }
+
+ CheckAbnormalView::~CheckAbnormalView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::~CheckAbnormalView");
+ DeInit();
+ g_pCheckAbnormalView = nullptr;
+ }
+
+ CheckAbnormalView *CheckAbnormalView::GetInstance()
+ {
+ return g_pCheckAbnormalView;
+ }
+
+ /* -------------------------------------------------------------------------- */
+ /***
+ * @description:
+ * @return 添加按键是否成功
+ */
+ bool CheckAbnormalView::AddButton()
+ {
+ InitButtonExt(StButton, 58, 320, 170, 90, CLICK_BLOOD_STOP, STR_STOP, 30);
+ StButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); // 设置按键颜色
+ StButton->SetOnClickListener(presenter_);
+
+ InitButtonExt(ReButton, 238, 320, 170, 90, CLICK_BLOOD_RE, STR_RECHECK, 30);
+ ReButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); // 设置按键颜色
+ ReButton->SetOnClickListener(presenter_);
+
+ container_->Add(StButton);
+ container_->Add(ReButton);
+ return true;
+ }
+ /***
+ * @description:
+ * @return 初始化标签是否成功
+ */
+ bool CheckAbnormalView::InitLable()
+ {
+ /*初始化title*/
+ InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKERROR, DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabelExt(noteLabel, 53, 230, 360, 70, "time", STR_WAERKEEP, DEFAULT_VECTOR_FONT_FILENAME, 30);
+ // 设置来回滚动属性
+ noteLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ noteLabel->SetRollSpeed(70);
+
+ container_->Add(titleLabel);
+ container_->Add(noteLabel);
+ return true;
+ }
+ /***
+ * @description:
+ * @return 初始化背景是否成功
+ */
+ bool CheckAbnormalView::Initbackground()
+ {
+
+ noteimage = new UIImageView();
+ noteimage->SetPosition(193, 120, 80, 80);
+ noteimage->SetSrc(BLOOD_PATH_NOTE);
+
+ container_->Add(noteimage);
+ return true;
+ }
+ /***
+ * @description:
+ * @return 是否初始化成功
+ */
+ bool CheckAbnormalView::CheckAbnormalViewInit()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bool CheckAbnormalView::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 CheckAbnormalView::DeInit()
+ {
+ if (StButton != nullptr)
+ {
+ delete StButton;
+ StButton = nullptr;
+ }
+ if (ReButton != nullptr)
+ {
+ delete ReButton;
+ ReButton = nullptr;
+ }
+ if (noteLabel != nullptr)
+ {
+ delete noteLabel;
+ noteLabel = nullptr;
+ }
+ if (titleLabel != nullptr)
+ {
+ delete titleLabel;
+ titleLabel = nullptr;
+ }
+ if (noteimage != nullptr)
+ {
+ delete noteimage;
+ noteimage = nullptr;
+ }
+ }
+
+ void CheckAbnormalView::OnStart()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::OnStart");
+ View<CheckAbnormalPresenter>::OnStart();
+
+ SetContainerView(new UIViewGroup());
+ container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+
+ if (!CheckAbnormalViewInit())
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::InitBloodView fail");
+ }
+
+ 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::CheckAbnormalPresenter::GetInstance();
+ RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ }
+ void CheckAbnormalView::OnSetUpView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::OnSetUpView");
+ View<CheckAbnormalPresenter>::OnSetUpView();
+ Draw();
+ }
+ void CheckAbnormalView::OnTearDownView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::OnTearDownView");
+ View<CheckAbnormalPresenter>::OnTearDownView();
+ return;
+ }
+
+ void CheckAbnormalView::OnStop()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::OnStop");
+ View<CheckAbnormalPresenter>::OnStop();
+ if (container_ != nullptr)
+ {
+ container_->RemoveAll();
+ delete container_;
+ container_ = nullptr;
+ }
+ return;
+ }
+}
--- /dev/null
+/***
+ * @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/CheckAbnormalView.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/CheckAbnormalView.h
+ */
+/*
+ * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
+ * Description: bloodResult view
+ * Author:
+ * Create: 2021-08-01
+ */
+
+#ifndef CHECK_ABNORMAL_VIEW_H
+#define CHECK_ABNORMAL_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 "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/CheckAbnormalPresenter.h"
+
+#include "components/ui_scroll_view.h"
+#include "components/ui_label_button_ext.h"
+namespace OHOS
+{
+ class CheckAbnormalPresenter;
+ class CheckAbnormalView : public View<CheckAbnormalPresenter>
+ {
+ public:
+ CheckAbnormalView();
+ virtual ~CheckAbnormalView();
+ static CheckAbnormalView *GetInstance(void);
+
+ void OnStop() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStart() override;
+
+ bool CheckAbnormalViewInit();
+
+ void DeInit();
+ bool AddButton();
+ bool InitLable();
+ bool Initbackground();
+
+ private:
+ // 提醒图标
+ UIImageView *noteimage = nullptr;
+ // 按键
+ UILabelButtonExt *StButton = nullptr;
+ UILabelButtonExt *ReButton = nullptr;
+ // 提醒label
+ UILabelExt *titleLabel = nullptr;
+ UILabelExt *noteLabel = nullptr;
+ };
+}
+
+#endif // 血氧主界面
\ No newline at end of file