#define MAX_UNWARE_COUNT 10
#define MAX_VALID_SPO2_COUNT 30
#define MAX_DISVALID_SPO2_COUNT 100
-static uint16 CalibrationFlag = 0;
+ static uint16 CalibrationFlag = 0;
// 声明定时器变量
static osTimerId_t g_timer = nullptr;
static BPModel instance;
return &instance;
}
- int16_t BPModel::GetCalibrationFlag()
+ int16_t BPModel::GetCalibrationFlag()
{
-
+
return CalibrationFlag;
}
if (set_value)
{
if (type == BP_VALUE_TYPE::SBP)
- custom_sbp++;
- else
- custom_dbp++;
+ if (custom_sbp < 250)
+ custom_sbp++;
+ else if (custom_dbp < 150)
+ custom_dbp++;
}
else
{
if (type == BP_VALUE_TYPE::SBP)
- custom_sbp--;
- else
- custom_dbp--;
+ if (custom_sbp > 50)
+ custom_sbp--;
+ else if (custom_dbp > 30)
+ custom_dbp--;
}
}
int16_t BPModel::GetValue(BP_VALUE_TYPE type)
/*定时器到期时的处理*/
static void BP_TimerCallbackProc(int data)
{
-
// 倒计时
Time--;
BPMainView::GetInstance()->ChangeView(BPUNDERCALIBRATIONVIEW, BPCALIBRATIONMINDVIEW);
CalibrationFlag++;
}
- else if (BPMainView::GetInstance() && ( CalibrationFlag == 1 || CalibrationFlag == 3)) // 分析完
+ else if (BPMainView::GetInstance() && (CalibrationFlag == 1 || CalibrationFlag == 3)) // 分析完
{
// 校准成功
BPMainView::GetInstance()->ChangeView(BPRESULTANALYSISVIEW, BPCALIBRATIONPASSVIEW);
static const char *BPBACKPATH = "/user/res/BPCalibration/W.bin";
static const char *LEFTPATH = "/user/res/BPCalibration/decrease_button.bin";
static const char *RIGHTPATH = "/user/res/BPCalibration/increase_button.bin";
-
-
BPValueView::BPValueView()
{
}
void BPValueView::DeInit()
{
- if(group)
+ if (group)
{
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
if (background != nullptr)
{
delete background;
delete valuecheckButton;
valuecheckButton = nullptr;
}
- if (SBPLeft != nullptr)
+ if (SBPLeft != nullptr)
{
delete SBPLeft;
SBPLeft = nullptr;
}
- if (SBPRight != nullptr)
+ if (SBPRight != nullptr)
{
delete SBPRight;
SBPRight = nullptr;
}
- if (DBPLeft != nullptr)
+ if (DBPLeft != nullptr)
{
delete DBPLeft;
DBPLeft = nullptr;
}
- if (DBPRight != nullptr)
+ if (DBPRight != nullptr)
{
delete DBPRight;
DBPRight = nullptr;
delete DBPValue;
DBPValue = nullptr;
}
- group->RemoveAll();
- delete group;
- group = nullptr;
- }
}
/***
*/
bool BPValueView::InitLable()
{
-
+
InitLabel(titleLabel, 109, 38, 239, 35, "title", "请输入血压计量", DEFAULT_VECTOR_FONT_FILENAME, 30);
InitLabel(SBPLabel, 63, 170, 100, 29, "SBP", "收缩压", DEFAULT_VECTOR_FONT_FILENAME, 30);
InitLabel(DBPLabel, 63, 270, 100, 29, "DBP", "舒张压", DEFAULT_VECTOR_FONT_FILENAME, 30);
SBPValue->SetTextColor(Color::Red());
DBPValue->SetTextColor(Color::Red());
-
/*初始化检测时间*/
group->Add(titleLabel);
group->Add(SBPLabel);
void BPValueView::UpDateVauleText(BP_VALUE_TYPE type)
{
- if(SBPValue == nullptr || DBPValue == nullptr)
+ if (SBPValue == nullptr || DBPValue == nullptr)
{
return;
}
bool BPValueView::Initbackground()
{
background = new UIImageView();
- background->SetPosition(0, 62, 466,342);
+ background->SetPosition(0, 62, 466, 342);
background->SetSrc(BPBACKPATH);
SBPLeft = new UIImageView();
SBPLeft->SetPosition(199, 160, 31, 35);
- SBPLeft->SetSrc(LEFTPATH);
- SBPLeft->SetViewId("SBPLeft");
+ SBPLeft->SetSrc(LEFTPATH);
+ SBPLeft->SetViewId("SBPLeft");
SBPLeft->SetTouchable(true);
UIView::OnClickListener *clickListener_SBPLeft = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance();
- SBPLeft->SetOnClickListener(clickListener_SBPLeft);
-
+ SBPLeft->SetOnClickListener(clickListener_SBPLeft);
SBPRight = new UIImageView();
SBPRight->SetPosition(385, 160, 31, 35);
- SBPRight->SetSrc(RIGHTPATH);
- SBPRight->SetViewId("SBPRight");
+ SBPRight->SetSrc(RIGHTPATH);
+ SBPRight->SetViewId("SBPRight");
SBPRight->SetTouchable(true);
UIView::OnClickListener *clickListener_SBPRight = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance();
- SBPRight->SetOnClickListener(clickListener_SBPRight);
+ SBPRight->SetOnClickListener(clickListener_SBPRight);
DBPLeft = new UIImageView();
- DBPLeft->SetPosition(199, 278, 31, 35);
- DBPLeft->SetSrc(LEFTPATH);
- DBPLeft->SetViewId("DBPLeft");
+ DBPLeft->SetPosition(199, 278, 31, 35);
+ DBPLeft->SetSrc(LEFTPATH);
+ DBPLeft->SetViewId("DBPLeft");
DBPLeft->SetTouchable(true);
UIView::OnClickListener *clickListener_DBPLeft = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance();
DBPLeft->SetOnClickListener(clickListener_DBPLeft);
DBPRight = new UIImageView();
- DBPRight->SetPosition(385, 278, 31, 35);
- DBPRight->SetSrc(RIGHTPATH);
+ DBPRight->SetPosition(385, 278, 31, 35);
+ DBPRight->SetSrc(RIGHTPATH);
DBPRight->SetViewId("DBPRight");
DBPRight->SetTouchable(true);
UIView::OnClickListener *clickListener_DBPRight = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance();
if (!Initbackground())
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Initbackground error!");
- return nullptr;
+ return nullptr;
};
if (!InitLable())
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "InitLable error!");
- return nullptr;
+ return nullptr;
};
if (!AddButton())
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddButton error!");
- return nullptr;
+ return nullptr;
};
-
+
return group;
}
-
+
}