${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/detection/BPDetectSOSView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/detection/BPDetectBeginView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/detection/BPDetectEndView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/detection/BPDetectErrorView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/detection/BPDetectFailView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPCalPosReqView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPLastCalibrationTimeView.cpp
+
+#ifndef BP_DetectError_VIEW_H
+#define BP_DetectError_VIEW_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_view_group.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label_button_ext.h"
+namespace OHOS
+{
+
+ class BPDetectErrorView
+ {
+ public:
+ BPDetectErrorView();
+ ~BPDetectErrorView();
+ static BPDetectErrorView *GetInstance();
+ UIViewGroup * BPDetectErrorInit();
+
+
+ void UpdateText();
+
+ private:
+ UIImageView *background = nullptr;
+
+ UILabelExt *notelabel = nullptr;
+ UILabelExt *alertlabel = nullptr;
+ UILabelExt *titlelabel = nullptr;
+ UILabelExt *soslabel = nullptr;
+ UILabelExt *exitlabel = nullptr;
+
+ UIViewGroup *group{nullptr};
+ };
+}
+
+#endif // 血压主界面
\ No newline at end of file
--- /dev/null
+
+#ifndef BP_DetectFial_VIEW_H
+#define BP_DetectFial_VIEW_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_view_group.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_label_button_ext.h"
+namespace OHOS
+{
+
+ class BPDetectFailView
+ {
+ public:
+ BPDetectFailView();
+ ~BPDetectFailView();
+ static BPDetectFailView *GetInstance();
+ UIViewGroup * BPDetectFailInit();
+
+
+ void UpdateText();
+
+ private:
+ UIImageView *icon_fail = nullptr;
+ UILabelExt *titlefail = nullptr;
+ UILabelButtonExt *ReCheckButton{nullptr};
+
+ UIViewGroup *group{nullptr};
+ };
+}
+
+#endif // 血压主界面
\ No newline at end of file
#include "bloodpressure/include/detection/BPDetectSOSView.h"
#include "bloodpressure/include/detection/BPDetectBeginView.h"
#include "bloodpressure/include/detection/BPDetectEndView.h"
+#include "bloodpressure/include/detection/BPDetectErrorView.h"
+#include "bloodpressure/include/detection/BPDetectFailView.h"
#define CLICK_BLOOD_PRESSURE "click_bloodpressure"
#define RE_CLICK_BLOOD_PRESSURE "re_click_bloodpressure"
+#define BP_SOS_CLICK "sos_click"
+#define EXIE_CLICK "exit_click"
+#define RE_CLICK_FAIL "re_click_fail"
namespace OHOS {
UNDER_CALIBRATION_BPVIEW,
//结果界面
RESULT_BPVIEW,
- //检测异常界面
- CALIBRATION_EXCEPTION_BPVIEW,
+ //预警值界面
+ ERROR_BPVIEW,
//sos求救界面
SOS_BPVIEW,
+ //测量失败界面
+ FAIL_BPVIEW,
MAX_BPDECETVIEW,
} BPDETECTVIEWID;
bool ChangeBPDetectSOSView(int16_t thisView);
bool ChangeBPDetectBeginView(int16_t thisView);
bool ChangeBPDetectEndView(int16_t thisView);
+ bool ChangeBPDetectErrorView(int16_t thisView);
+ bool ChangeBPDetectFailView(int16_t thisView);
private:
UIViewGroup *group[MAX_BPDECETVIEW]{nullptr};
BPDetectSOSView *g_pBPDetectSOSView = nullptr;
BPDetectBeginView *g_pBPDetectBeginView = nullptr;
BPDetectEndView *g_pBPDetectEndView = nullptr;
+ BPDetectErrorView *g_pBPDetectErrorView = nullptr;
+ BPDetectFailView *g_pBPDetectFailView = nullptr;
};
break;
}
case BPState::BP_DETECTING:
+ {
/*
开启定时器
开启传感器
*/
BP_StartTimer();
ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);//后期 周期被动状态 需要做区别
+
+ if(Time != BP_CHECK_TIME_MAX)
+ Time = BP_CHECK_TIME_MAX;//重置时间
+
break;
+ }
case BPState::BP_CALIBRATING_FIRSTTIME:
break;
case BPState::BP_CALIBRATING_SECONDTIME:
{
BPModel::GetInstance()->BP_StopTimer();
BPModel::GetInstance()->BP_SetState(BPState::BP_NORMAL);
- BPMainView* mainView = BPMainView::GetInstance();
- if (mainView)
+ if (BPMainView::GetInstance())
{
- mainView->ChangeView(BPUNDERCALIBRATIONVIEW, BPVALUEVIEW);
+ BPMainView::GetInstance()->ChangeView(BPUNDERCALIBRATIONVIEW, BPVALUEVIEW);
}
else if (BPDetectionView::GetInstance())
{
- //到达结果界面
- BPDetectionView::GetInstance()->ChangeView(CALIBRATION_BPVIEW, RESULT_BPVIEW);
+ //测试成功 -> 进入结果界面
+ // BPDetectionView::GetInstance()->ChangeView(CALIBRATION_BPVIEW, RESULT_BPVIEW);
+ //测试失败 -> 进入错误界面
+ BPDetectionView::GetInstance()->ChangeView(CALIBRATION_BPVIEW, ERROR_BPVIEW);
}
return;
}
--- /dev/null
+/***
+ * @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/fd230/nativeapp/nativeui/bloodpressure/src/BPDetectErrorView.cpp
+ */
+
+#include "ui_resource_image.h"
+#include "UiConfig.h"
+#include "wearable_log.h"
+#include "uicomponents/UIComponents.h"
+#include "bloodpressure/include/detection/BPDetectionPresenter.h"
+#include "bloodpressure/include/detection/BPDetectErrorView.h"
+#include "bloodpressure/include/BPModel.h"
+namespace OHOS
+{
+ static BPDetectErrorView *g_pBPDetectErrorView{nullptr};
+ static const char* image_bp = "/user/res/BPCalibration/error_bg.bin";
+
+ BPDetectErrorView::BPDetectErrorView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectErrorView::BPDetectErrorView");
+ g_pBPDetectErrorView = this;
+ }
+ BPDetectErrorView::~BPDetectErrorView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectErrorView::~BPDetectErrorView");
+ if(group)
+ {
+ group->RemoveAll();
+ if(background)
+ {
+ delete background;
+ background = nullptr;
+ }
+ if(titlelabel)
+ {
+ delete titlelabel;
+ titlelabel = nullptr;
+ }
+ if(alertlabel)
+ {
+ delete alertlabel;
+ alertlabel = nullptr;
+ }
+ if(notelabel)
+ {
+ delete notelabel;
+ notelabel = nullptr;
+ }
+ if(soslabel)
+ {
+ delete soslabel;
+ soslabel = nullptr;
+ }
+ if(exitlabel)
+ {
+ delete exitlabel;
+ exitlabel = nullptr;
+ }
+ }
+ delete group;
+ group = nullptr;
+ g_pBPDetectErrorView = nullptr;
+ }
+
+ BPDetectErrorView *BPDetectErrorView::GetInstance()
+ {
+ return g_pBPDetectErrorView;
+ }
+
+ void BPDetectErrorView::UpdateText()
+ {
+ if(titlelabel == nullptr ||alertlabel ==nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectErrorView::UpdateText titlelabel or alertlabel is nullptr");
+ return;
+ }
+ //进行label更新 需要判断是什么警报
+ /*
+ //if(错误判断)
+ {
+ titlelabel->SetText("收缩压偏高");
+ }
+ else
+ {
+ titlelabel->SetText("舒张压偏低");
+ }
+
+ //预警值拼接
+ uint8_t systolic = 0;
+ systolic = BPModel::GetInstance()->GetSystolic();
+ alertlabel->SetText("预警值:" + (std::to_string(systolic).c_str()));
+ */
+ }
+
+ /***
+ * @description:
+ * @return 是否初始化成功
+ */
+ UIViewGroup *BPDetectErrorView::BPDetectErrorInit()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bool BPDetectErrorView::InitView()");
+ group = new UIViewGroup();
+ group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+
+ InitImageView(background, 0, 0, 466, 466, "image_bp", image_bp);
+ group->Add(background);
+
+ /*初始化label*/
+ InitLabel(titlelabel, 133, 57, 200, 60, "titlelabel", "收缩压偏高", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(alertlabel, 133, 115, 200, 60, "alertlabel", "预警值:120", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(notelabel, 58, 180, 350, 150, "notelabel", "血压达到预警值,请密切关注 自身情况,如有不适或必要时, 请询问医生。", DEFAULT_VECTOR_FONT_FILENAME, 26);
+
+ InitLabel(soslabel, 54, 366, 200, 60, BP_SOS_CLICK, "SOS", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(exitlabel, 215, 366, 200, 60, EXIE_CLICK, "知道了", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ soslabel->SetTouchable(true);
+ exitlabel->SetTouchable(true);
+
+ UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::BPDetectionPresenter::GetInstance();
+ soslabel->SetOnClickListener(clickListener);//设置按键监听
+ exitlabel->SetOnClickListener(clickListener);
+
+ alertlabel->SetTextColor(Color::Red());
+
+ group->Add(titlelabel);
+ group->Add(alertlabel);
+ group->Add(notelabel);
+ group->Add(soslabel);
+ group->Add(exitlabel);
+
+ return group;
+ }
+
+
+
+}
--- /dev/null
+/***
+ * @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/fd230/nativeapp/nativeui/bloodpressure/src/BPDetectFailView.cpp
+ */
+
+#include "ui_resource_image.h"
+#include "UiConfig.h"
+#include "wearable_log.h"
+#include "uicomponents/UIComponents.h"
+#include "bloodpressure/include/detection/BPDetectionPresenter.h"
+#include "bloodpressure/include/detection/BPDetectFailView.h"
+#include "bloodpressure/include/BPModel.h"
+namespace OHOS
+{
+ static BPDetectFailView *g_pBPDetectFailView{nullptr};
+ static const char* image_bp = "/user/res/BPCalibration/error.bin";
+
+ BPDetectFailView::BPDetectFailView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectFailView::BPDetectFailView");
+ g_pBPDetectFailView = this;
+ }
+ BPDetectFailView::~BPDetectFailView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectFailView::~BPDetectFailView");
+ if(group)
+ {
+ group->RemoveAll();
+ if(icon_fail)
+ {
+ delete icon_fail;
+ icon_fail = nullptr;
+ }
+ if(titlefail)
+ {
+ delete titlefail;
+ titlefail = nullptr;
+ }
+ if(ReCheckButton)
+ {
+ delete ReCheckButton;
+ ReCheckButton = nullptr;
+ }
+ }
+ delete group;
+ group = nullptr;
+ g_pBPDetectFailView = nullptr;
+ }
+
+ BPDetectFailView *BPDetectFailView::GetInstance()
+ {
+ return g_pBPDetectFailView;
+ }
+
+
+
+ /***
+ * @description:
+ * @return 是否初始化成功
+ */
+ UIViewGroup *BPDetectFailView::BPDetectFailInit()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bool BPDetectFailView::InitView()");
+ group = new UIViewGroup();
+ group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+
+
+ InitImageView(icon_fail, 131, 131, 100, 100, "image_bp", image_bp);
+
+ InitLabel(titlefail, 133, 57, 200, 50, "titlefail","测量失败", DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ InitButtonExt(ReCheckButton, 118, 360, 230, 80, RE_CLICK_FAIL,STR_RECHECK, 30);
+ ReCheckButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); // 设置按键颜色
+ UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::BPDetectionPresenter::GetInstance();
+ ReCheckButton->SetOnClickListener(clickListener);//设置按键监听
+
+
+ group->Add(icon_fail);
+ group->Add(titlefail);
+ group->Add(ReCheckButton);
+
+
+ return group;
+ }
+
+
+
+}
BPDetectionView::GetInstance()->ChangeView(RESULT_BPVIEW,CALIBRATION_BPVIEW);
BPModel::GetInstance()->BP_StartTimer();//开始计时器,计时结束后自动切换到主界面
}
-
+ //预警界面->SOS
+ else if (strcmp(view.GetViewId(), BP_SOS_CLICK) == 0)
+ {
+ BPDetectionView::GetInstance()->ChangeView(ERROR_BPVIEW,SOS_BPVIEW);
+ }
+ //预警界面->退出
+ else if (strcmp(view.GetViewId(), EXIE_CLICK) == 0)
+ {
+ NavigateBack();
+ // BPDetectionView::GetInstance()->ChangeView(ERROR_BPVIEW,FAIL_BPVIEW);//test
+ }
+ //检测失败界面->重新检测
+ else if (strcmp(view.GetViewId(), RE_CLICK_FAIL) == 0)
+ {
+ //设置状态为检测状态
+ BPModel::GetInstance()->BP_Control(BPState::BP_DETECTING);
+ BPDetectionView::GetInstance()->ChangeView(FAIL_BPVIEW,CALIBRATION_BPVIEW);
+ BPModel::GetInstance()->BP_StartTimer();//开始计时器,计时结束后自动切换到主界面
+ }
return true;
}
g_pBPDetectEndView = nullptr;
}
+ if(g_pBPDetectErrorView)
+ {
+ delete g_pBPDetectErrorView;
+ g_pBPDetectErrorView = nullptr;
+ }
+
+ if(g_pBPDetectFailView)
+ {
+ delete g_pBPDetectFailView;
+ g_pBPDetectFailView = nullptr;
+ }
for(int i = 0; i < MAX_BPDECETVIEW; ++i)
return true;
}
+ bool BPDetectionView::ChangeBPDetectErrorView(int16_t thisView)
+ {
+ // 检查视图是否已初始化,避免重复创建
+ if (group[thisView] == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPDetectErrorView");
+ // 创建首次校准视图实例
+ g_pBPDetectErrorView = new BPDetectErrorView();
+ if (g_pBPDetectErrorView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+ "BloodPressureView::ChangeBPDetectErrorView new BPDetectErrorView fail");
+ return false;
+ }
+ // 初始化视图并添加到视图组
+ group[thisView] = g_pBPDetectErrorView->BPDetectErrorInit();
+ container_->Add(group[thisView]);
+ }
+ return true;
+ }
+
+ bool BPDetectionView::ChangeBPDetectFailView(int16_t thisView)
+ {
+ // 检查视图是否已初始化,避免重复创建
+ if (group[thisView] == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPDetectFailView");
+ // 创建首次校准视图实例
+ g_pBPDetectFailView = new BPDetectFailView();
+ if (g_pBPDetectFailView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,
+ "BloodPressureView::ChangeBPDetectFailView new BPDetectFailView fail");
+ return false;
+ }
+ // 初始化视图并添加到视图组
+ group[thisView] = g_pBPDetectFailView->BPDetectFailInit();
+ container_->Add(group[thisView]);
+ }
+ return true;
+ }
/**
* 视图映射结构体 - 将视图ID映射到对应的视图切换函数
{SOS_BPVIEW, &BPDetectionView::ChangeBPDetectSOSView},
{CALIBRATION_BPVIEW, &BPDetectionView::ChangeBPDetectBeginView},
{RESULT_BPVIEW, &BPDetectionView::ChangeBPDetectEndView},
+ {ERROR_BPVIEW, &BPDetectionView::ChangeBPDetectErrorView},
+ {FAIL_BPVIEW, &BPDetectionView::ChangeBPDetectFailView},
+
};
bool BPDetectionView::ClickFunc(int16_t interface)