+
+#ifndef BP_DetectEnd_VIEW_H
+#define BP_DetectEnd_VIEW_H
+
+#include "components/ui_button.h"
+#include "components/ui_label.h"
+#include "components/ui_label_button.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_view_group.h"
+namespace OHOS {
+
+class BPDetectEndView {
+public:
+ BPDetectEndView();
+ ~BPDetectEndView();
+ static BPDetectEndView *GetInstance();
+ UIViewGroup *BPDetectEndInit();
+ void UpdateText(); //更新文本数据
+
+private:
+ UILabelExt *DBPTitleLabel{nullptr};
+ UILabelExt *SBPTitleText{nullptr};
+ UILabelExt *NomalText{nullptr};//正常
+ UILabelExt *HighText{nullptr};//偏高
+ UILabelExt *AlertText{nullptr};//预警
+
+
+ UILabel *DBPText{nullptr};
+ UILabel *SBPText{nullptr};
+ UILabel *timeLabel{nullptr};
+
+
+ UIImageView *BPImageView{nullptr};
+ UIImageView *BgWImageView{nullptr};
+ UIImageView *BgUImageView{nullptr};
+ UIImageView *IconImageView{nullptr};
+
+ UILabelButtonExt *ReCheckButton{nullptr};
+
+ UIViewGroup *group{nullptr};
+
+ uint16_t m_dbp_{0};
+ uint16_t m_sbp_{0};
+};
+} // namespace OHOS
+
+#endif // 血压主界面
\ No newline at end of file
--- /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/BPDetectEndView.cpp
+ */
+
+#include "ui_resource_image.h"
+#include "UiConfig.h"
+#include "wearable_log.h"
+#include "uicomponents/UIComponents.h"
+#include "bloodpressure/include/BPDetectionPresenter.h"
+#include "bloodpressure/include/BPDetectionView.h"
+#include "bloodpressure/include/BPDetectEndView.h"
+#include "bloodpressure/include/BPModel.h"
+
+namespace OHOS
+{
+ static BPDetectEndView *g_pBPDetectEndView{nullptr};
+ static const char* image_bp = "/user/res/BPCalibration/measuring.bin";
+ static const char* image_bg_w = "/user/res/BPCalibration/W.bin";
+ static const char* image_bg_u = "/user/res/BPCalibration/U.bin";
+ static const char* image_icon = "/user/res/BPCalibration/R2.bin";
+
+
+ BPDetectEndView::BPDetectEndView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectEndView::BPDetectEndView");
+ g_pBPDetectEndView = this;
+ }
+ BPDetectEndView::~BPDetectEndView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectEndView::~BPDetectEndView");
+ if(group)
+ {
+ group->RemoveAll();
+ if(DBPTitleLabel)
+ {
+ delete DBPTitleLabel;
+ DBPTitleLabel = nullptr;
+ }
+ if(SBPTitleText)
+ {
+ delete SBPTitleText;
+ SBPTitleText = nullptr;
+ }
+ if(NomalText)
+ {
+ delete NomalText;
+ NomalText = nullptr;
+ }
+ if(HighText)
+ {
+ delete HighText;
+ HighText = nullptr;
+ }
+ if(AlertText)
+ {
+ delete AlertText;
+ AlertText = nullptr;
+ }
+ if(DBPText)
+ {
+ delete DBPText;
+ DBPText = nullptr;
+ }
+ if(SBPText)
+ {
+ delete SBPText;
+ SBPText = nullptr;
+ }
+ if(timeLabel)
+ {
+ delete timeLabel;
+ timeLabel = nullptr;
+ }
+ if(BPImageView)
+ {
+ delete BPImageView;
+ BPImageView = nullptr;
+ }
+ if(BgWImageView)
+ {
+ delete BgWImageView;
+ BgWImageView = nullptr;
+ }
+ if(BgUImageView)
+ {
+ delete BgUImageView;
+ BgUImageView = nullptr;
+ }
+ if(IconImageView)
+ {
+ delete IconImageView;
+ IconImageView = nullptr;
+ }
+ if(ReCheckButton)
+ {
+ delete ReCheckButton;
+ ReCheckButton = nullptr;
+ }
+ }
+ delete group;
+ group = nullptr;
+ g_pBPDetectEndView = nullptr;
+ }
+
+ BPDetectEndView *BPDetectEndView::GetInstance()
+ {
+ return g_pBPDetectEndView;
+ }
+
+ void BPDetectEndView::UpdateText()
+ {
+ if(DBPText == nullptr || SBPText == nullptr || timeLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DBPText or SBPText or timeLabel is null");
+ return;
+ }
+ //获取时间更新时间
+ std::string timeStr = BPModel::GetInstance()->GetCurrentTimeStr();
+ timeLabel->SetText(timeStr.c_str());
+ //获取上一次检测数据 ? 待定
+
+ }
+
+ /***
+ * @description:
+ * @return 是否初始化成功
+ */
+ UIViewGroup *BPDetectEndView::BPDetectEndInit()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bool BPDetectEndView::InitView()");
+ group = new UIViewGroup();
+ group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPDetectEndInit is begin");
+ /*初始化label*/
+ InitLabel(DBPTitleLabel, 20, 66, 200, 60, "calibration", "收缩压", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(SBPTitleText, 240, 66, 200, 60, "calibration", "舒张压", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(NomalText, 0, 295, 200, 60, "calibration", "正常", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(HighText, 133, 295, 200, 60, "calibration", "偏高", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(AlertText, 266, 295, 200, 60, "calibration", "预警", DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ InitUILabel(DBPText, 20, 120, 200, 60, "calibration", "---", DEFAULT_VECTOR_FONT_FILENAME, 50);
+ InitUILabel(SBPText, 240, 120, 200, 60, "calibration", "---", DEFAULT_VECTOR_FONT_FILENAME, 50);
+ InitUILabel(timeLabel, 133, 115, 200, 60, "calibration", "----/--/-- \n --:--", DEFAULT_VECTOR_FONT_FILENAME, 20);
+
+ InitImageView(BPImageView, 208, 10, 100, 100, "image_bp", image_bp);
+ InitImageView(BgWImageView, 0, -75, 100, 100, "image_bg_w", image_bg_w);
+ InitImageView(BgUImageView, 22, 220, 100, 100, "image_bg_u", image_bg_u);
+ InitImageView(IconImageView, 29, 249, 100, 100, "image_icon", image_icon);
+
+ InitButtonExt(ReCheckButton, 118, 360, 230, 80, RE_CLICK_BLOOD_PRESSURE,STR_RECHECK, 30);
+ ReCheckButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); // 设置按键颜色
+ UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::BPDetectionPresenter::GetInstance();
+ ReCheckButton->SetOnClickListener(clickListener);//设置按键监听
+
+ DBPText->SetTextColor(Color::GetColorFromRGBA(0xFF, 0x35, 0x00, 0xFF));
+ SBPText->SetTextColor(Color::GetColorFromRGBA(0xFF, 0x35, 0x00, 0xFF));
+
+ group->Add(DBPTitleLabel);
+ group->Add(SBPTitleText);
+ group->Add(NomalText);
+ group->Add(HighText);
+ group->Add(AlertText);
+
+ group->Add(DBPText);
+ group->Add(SBPText);
+ group->Add(timeLabel);
+
+ group->Add(BPImageView);
+ group->Add(BgWImageView);
+ group->Add(BgUImageView);
+ group->Add(ReCheckButton);
+
+ UpdateText();
+
+ return group;
+ }
+
+
+
+}
*/
BP_StopTimer();
ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON);
+ Time = BP_CHECK_TIME_MAX;
break;
}
case BPState::BP_DETECTING:
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BP_Control: Invalid state");
BP_SetState(BPState::BP_NORMAL);
BP_StopTimer();
+ Time = BP_CHECK_TIME_MAX;
return;
}
//更新状态
if (Time < 0)
{
BPModel::GetInstance()->BP_StopTimer();
+ BPModel::GetInstance()->BP_SetState(BPState::BP_NORMAL);
BPMainView* mainView = BPMainView::GetInstance();
if (mainView)
{
}
else if (BPDetectionView::GetInstance())
{
- BPDetectionView::GetInstance()->ChangeView(CALIBRATION_BPVIEW, MAIN_BPVIEW);
+ //到达结果界面
+ BPDetectionView::GetInstance()->ChangeView(CALIBRATION_BPVIEW, RESULT_BPVIEW);
}
return;
}
switch (current_state_time) {
case BPState::BP_NORMAL:
BPModel::GetInstance()->BP_StopTimer();
+ BPModel::GetInstance()->BP_SetState(BPState::BP_NORMAL);
return;
case BPState::BP_DETECTING: {
* @brief 回调函数
*/
static void BP_TimerCallback(int data) {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BP_TimerCallback %d", data);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BP_TimerCallback %d", data);
GraphicService::GetInstance()->PostGraphicEvent(
std::bind(BP_TimerCallbackProc, data));
}
"osTimerDelete failed, ret = %lx!!", ret);
}
g_timer = nullptr;
- Time = BP_CHECK_TIME_MAX;
}
}