Index: .gitignore =================================================================== diff -u -rd5ed5f9460543b58a9195a6e33668b8058f9893a -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- .gitignore (.../.gitignore) (revision d5ed5f9460543b58a9195a6e33668b8058f9893a) +++ .gitignore (.../.gitignore) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -1,4 +1,4 @@ *.autosave -common +/common tags scripts/denali Index: denali.pro =================================================================== diff -u -r13d6a4fae2f910ab6e289ac9280258a94f734405 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- denali.pro (.../denali.pro) (revision 13d6a4fae2f910ab6e289ac9280258a94f734405) +++ denali.pro (.../denali.pro) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -73,6 +73,7 @@ sources/view \ sources/view/settings \ sources/view/pretreatment \ + sources/view/hd/adjustment/common \ sources/view/hd/adjustment \ sources/view/hd/adjustment/pretreatment \ sources/view/hd/adjustment/treatment \ @@ -245,6 +246,8 @@ sources/view/hd/alarm/VAlarmActiveList.h \ \ # ---------- Views - HD - Adjustment sources/view/VAdjustmentResponseBase.h \ + \ # ---------- Views - HD - Adjustment - common + sources/view/hd/adjustment/common/VCommonAdjustmentVitals.h \ \ # ---------- Views - HD - Adjustment - Pre-Treatment sources/view/hd/adjustment/pretreatment/VPreTreatmentAdjustmentInitTreatment.h \ sources/view/hd/adjustment/pretreatment/VPreTreatmentAdjustmentWaterSample.h \ @@ -466,6 +469,8 @@ sources/view/settings/VAdjustmentService.cpp \ \ # ---------- Views - HD - Adjustment sources/view/VAdjustmentResponseBase.cpp \ + \ # ---------- Views - HD - Adjustment - common + sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp \ \ # ---------- Views - HD - Adjustment - Pre-Treatment sources/view/hd/adjustment/pretreatment/VPreTreatmentAdjustmentInitTreatment.cpp \ sources/view/hd/adjustment/pretreatment/VPreTreatmentAdjustmentWaterSample.cpp \ Index: denali.pro.user =================================================================== diff -u -r42c029b1704455433cb095d2e76dcd540c1f0046 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- denali.pro.user (.../denali.pro.user) (revision 42c029b1704455433cb095d2e76dcd540c1f0046) +++ denali.pro.user (.../denali.pro.user) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -1,6 +1,6 @@ - + EnvironmentId Index: sources/gui/GuiController.h =================================================================== diff -u -r97d593e2e7adb36f2f9f97f9bb9958dcef740bc1 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/GuiController.h (.../GuiController.h) (revision 97d593e2e7adb36f2f9f97f9bb9958dcef740bc1) +++ sources/gui/GuiController.h (.../GuiController.h) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -101,7 +101,6 @@ void didExportLog(); void didExport (); - // Device controller signal slots connection DEVICE_GUI_BRIDGE_DEFINITION_LIST Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -r13d6a4fae2f910ab6e289ac9280258a94f734405 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 13d6a4fae2f910ab6e289ac9280258a94f734405) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -43,6 +43,8 @@ #include "VHDTreatmentStatesData.h" #include "VPostTreatmentStatesData.h" #include "VDisinfectStatesData.h" +// Common treatment +#include "VCommonAdjustmentVitals.h" // Pre-treatment #include "VPreTreatmentAdjustmentInitTreatment.h" #include "VDGFilterFlushData.h" Index: sources/gui/qml/components/EntryDialog.qml =================================================================== diff -u -r42c029b1704455433cb095d2e76dcd540c1f0046 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/qml/components/EntryDialog.qml (.../EntryDialog.qml) (revision 42c029b1704455433cb095d2e76dcd540c1f0046) +++ sources/gui/qml/components/EntryDialog.qml (.../EntryDialog.qml) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -30,6 +30,7 @@ default property alias content : _backgroundRect.data + signal autoHidden () signal closeClicked() signal confirmClicked() @@ -82,6 +83,7 @@ duration: autoHideDuration onFinished: { _root.close() + autoHidden() } } Index: sources/gui/qml/main.qml =================================================================== diff -u -rac23b968f565c2beeb153ca2d554b8f868634512 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/qml/main.qml (.../main.qml) (revision ac23b968f565c2beeb153ca2d554b8f868634512) +++ sources/gui/qml/main.qml (.../main.qml) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -42,6 +42,8 @@ import VPostTreatmentStates 0.1 import VDisinfectStates 0.1 +// Treatment - Common +import VTreatmentVitals 0.1 // In-Treatment - Data import VTreatmentBloodFlow 0.1 import VTreatmentDialysateFlow 0.1 @@ -129,44 +131,8 @@ VDisinfectStates { id: vDisinfectStates } VTreatmentBloodFlow { id: vTreatmentBloodFlow } - Item /*VTreatmentVitals*/ /* Test View */ { id: vTreatmentVitals - property int systolic : 0 - property int systolicMin : 60 - property int systolicMax : 250 - property int diastolic : 0 - property int diastolicMin : 40 - property int diastolicMax : 200 - property int heartRate : 0 - property int heartRateMin : 40 - property int heartRateMax : 180 - property int interval : vTreatmentCreate.bloodPressureMeasureInterval - property string lastRead : "none" - property string notificationText: - qsTr("Interval:") + " " + (interval ? (interval + qsTr("min")):qsTr("off")) - + " , " - + qsTr("Last Read:") + " " + lastRead - - signal didTimeout() - - Timer { id: _timer - interval: vTreatmentVitals.interval * 60000 // to minuts - onTriggered: vTreatmentVitals.didTimeout() - } - onIntervalChanged: if (interval) _timer.start() - - function doConfirm(vSystolic, vDiastolic, vHeartReate) { - let currentDateTime = new Date() - systolic = vSystolic - diastolic = vDiastolic - heartRate = vHeartReate - lastRead = currentDateTime.toLocaleString(Qt.locale(), "yyyy/MMM/dd , HH:mm") - console.debug(vSystolic, vDiastolic, vHeartReate) - } - - function doRead(vSystolic, vDiastolic, vHeartReate) { - // simulated BLE read - doConfirm(vSystolic, vDiastolic, vHeartReate) - } + VTreatmentVitals { id: vTreatmentVitals + interval : vTreatmentCreate.bloodPressureMeasureInterval } VTreatmentDialysateFlow { id: vTreatmentDialysateFlow } Index: sources/gui/qml/pages/posttreatment/PostTreatmentStack.qml =================================================================== diff -u -r8a5dbf556a66524fbe4b60ac1573182a0bd27617 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/qml/pages/posttreatment/PostTreatmentStack.qml (.../PostTreatmentStack.qml) (revision 8a5dbf556a66524fbe4b60ac1573182a0bd27617) +++ sources/gui/qml/pages/posttreatment/PostTreatmentStack.qml (.../PostTreatmentStack.qml) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -84,7 +84,9 @@ onPatientDisconnectionConfirm : { vPostTreatmentAdjustmentPatientDisconnectionConfirm .doConfirm( ) /* No wait for Rsp, so navigates => */ page( _treatmentReviewConfirm ) /* After navigate ask for Tx data */ vPostTreatmentAdjustmentTreatmentLog .doRequest( )} - onTreatmentReviewConfirm : { page( _disposablesRemovalConfirm )} + onTreatmentReviewConfirm : { page( _disposablesRemovalConfirm ) + vTreatmentVitals.doReset() + } onDisposablesRemovalConfirm : { vPostTreatmentAdjustmentDisposablesRemovalConfirm .doConfirm( )} onDisposablesRemovalBack : { page( _treatmentReviewConfirm )} Index: sources/gui/qml/pages/pretreatment/connection/PreTreatmentConnectionStack.qml =================================================================== diff -u -rac23b968f565c2beeb153ca2d554b8f868634512 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/qml/pages/pretreatment/connection/PreTreatmentConnectionStack.qml (.../PreTreatmentConnectionStack.qml) (revision ac23b968f565c2beeb153ca2d554b8f868634512) +++ sources/gui/qml/pages/pretreatment/connection/PreTreatmentConnectionStack.qml (.../PreTreatmentConnectionStack.qml) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -57,7 +57,15 @@ _bphrEntry.heartRate ) } + else { + vTreatmentVitals.doSkip() // only for logging + + } } + onVisibleChanged: { + if ( visible ) + vTreatmentVitals.doReset() + } } PreTreatmentBase { id: _preTreatmentPatientConnection @@ -102,9 +110,7 @@ Connections { target: _preTreatmentVitals onBackClicked : { page( _preTreatmentUltrafiltration )} - onConfirmClicked : { - // vVitals.doConfirm() - page( _preTreatmentPatientConnection ) + onConfirmClicked : { page( _preTreatmentPatientConnection ) } } Index: sources/gui/qml/pages/treatment/TreatmentHome.qml =================================================================== diff -u -rac23b968f565c2beeb153ca2d554b8f868634512 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/qml/pages/treatment/TreatmentHome.qml (.../TreatmentHome.qml) (revision ac23b968f565c2beeb153ca2d554b8f868634512) +++ sources/gui/qml/pages/treatment/TreatmentHome.qml (.../TreatmentHome.qml) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -76,7 +76,11 @@ onClicked: { sectionVitalsClicked() } - notification.text: vTreatmentVitals.notificationText + notification.text: qsTr("Interval:" ) + + " " + (vTreatmentVitals.interval ? (vTreatmentVitals.interval + qsTr("min")) : qsTr("off")) + + " , " + + qsTr("Last Read:") + + " " + vTreatmentVitals.lastRead } Line { x: 0; y: row2LineY; length: lineLength } TreatmentPressures { id: _pressuresTouchArea @@ -131,6 +135,8 @@ } onVisibleChanged: { + vTreatmentVitals.enabled = visible + if (visible) { _mainMenu.hidden = true _treatmentMenu.hidden = false Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -r42c029b1704455433cb095d2e76dcd540c1f0046 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 42c029b1704455433cb095d2e76dcd540c1f0046) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -64,7 +64,6 @@ _treatmentAdjustmentFlow.open() } onSectionVitalsClicked : { - // DEBUG: vTreatmentVitals.doRead(10,10,10) _vitalEntry.open() } onSectionPressuresClicked: { @@ -87,7 +86,7 @@ EntryDialog { id: _vitalEntry titleText : qsTr("VITALS") autoHide : true - autoHideDuration : 1 * 60000 + autoHideDuration : vTreatmentVitals.timeout * 60000 // min => ms confirmEnabled : _bphrEntry.isValid onConfirmClicked : { vTreatmentVitals.doConfirm( @@ -97,6 +96,13 @@ ) _vitalEntry.close() } + + onCloseClicked : + vTreatmentVitals.doSkip() // only for logging + + onAutoHidden : + vTreatmentVitals.doTimeout() // only for logging + BPHREntry { id : _bphrEntry contentRectHeight : _vitalEntry.contentRect.height onClicked : { @@ -190,7 +196,7 @@ } Connections { target: vTreatmentVitals - onDidTimeout : { _vitalEntry.open() } + onDidTrigger : { _vitalEntry.open() } } } Index: sources/model/hd/data/treatmentlog/MTreatmentLogAvrgeData.h =================================================================== diff -u -rdd6c876521e397ff990f81e7363b4f007fe3e2d9 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/model/hd/data/treatmentlog/MTreatmentLogAvrgeData.h (.../MTreatmentLogAvrgeData.h) (revision dd6c876521e397ff990f81e7363b4f007fe3e2d9) +++ sources/model/hd/data/treatmentlog/MTreatmentLogAvrgeData.h (.../MTreatmentLogAvrgeData.h) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -76,15 +76,15 @@ QString infoText () const override { return QString("TreatmentLogAvrge") ; } struct Data { - quint64 mTimeStamp ; ///< Timestamp of the received message in secs since epoch - quint32 mBloodFlowRate ; ///< Blood Flow Rate (mL/min) - quint32 mDialysateFlowRate ; ///< Dialysate Flow Rate (mL/min) - float mUFRate ; ///< Ultrafiltration Rate (mmHg) - float mArterialPressure ; ///< Arterial Pressure (mmHg) - float mVenousPressure ; ///< Venous Pressure (mmHg) - quint32 mSystolic = 0; ///< Systolic Blood Pressure - This value is not coming from FW and will be get from UI and User. - quint32 mDiastolic = 0; ///< Diastolic Blood Pressure - This value is not coming from FW and will be get from UI and User. - quint32 mHeartRate = 0; ///< Heart Rate - This value is not coming from FW and will be get from UI and User. + quint64 mTimeStamp = 0; ///< Timestamp of the received message in secs since epoch + quint32 mBloodFlowRate = 0; ///< Blood Flow Rate (mL/min) + quint32 mDialysateFlowRate = 0; ///< Dialysate Flow Rate (mL/min) + float mUFRate = 0; ///< Ultrafiltration Rate (mmHg) + float mArterialPressure = 0; ///< Arterial Pressure (mmHg) + float mVenousPressure = 0; ///< Venous Pressure (mmHg) + quint32 mSystolic = 0; ///< Systolic Blood Pressure - This value is not coming from FW and will be get from UI and User. + quint32 mDiastolic = 0; ///< Diastolic Blood Pressure - This value is not coming from FW and will be get from UI and User. + quint32 mHeartRate = 0; ///< Heart Rate - This value is not coming from FW and will be get from UI and User. }; MTreatmentLogAvrgeData() { } Index: sources/view/VView.h =================================================================== diff -u -r13d6a4fae2f910ab6e289ac9280258a94f734405 -rab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4 --- sources/view/VView.h (.../VView.h) (revision 13d6a4fae2f910ab6e289ac9280258a94f734405) +++ sources/view/VView.h (.../VView.h) (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -115,6 +115,8 @@ REGISTER_TYPE( VAlarmActiveList ) \ /* Power off */ \ REGISTER_TYPE( VPowerOff ) \ + /* Treatment Common */ \ + REGISTER_TYPE( VTreatmentVitals ) \ /* Data - States */ \ REGISTER_TYPE( VHDOperationMode ) \ REGISTER_TYPE( VPreTreatmentStates ) \ Index: sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp =================================================================== diff -u --- sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp (revision 0) +++ sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -0,0 +1,203 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VAdjustmentAlarmVolume.h + * \author (last) Behrouz NematiPour + * \date (last) 06-Jun-2021 + * \author (original) Behrouz NematiPour + * \date (original) 06-Jun-2021 + * + */ +#include "VCommonAdjustmentVitals.h" + +// Qt +#include "QDateTime" + +// Project +#include "GuiController.h" +#include "TreatmentLog.h" + +VIEW_DEF_CLASS_ADJUSTMENT(VTreatmentVitals) + +/*! + * \brief Connection Initializer + * \details All the class signal/slot connections are defined here. +*/ +void View::VTreatmentVitals::initConnections() { + // TODO : Later we need to receive the data from BtCuff and update the data in the same way we update if user enters it. + // ACTION_VIEW_CONNECTION(AdjustVitalsResposeData); + + connect(this, SIGNAL( enabledChanged(const bool &)), + this, SLOT(onTimerChanged ( ))); + connect(this, SIGNAL( intervalChanged(const quint8 &)), + this, SLOT(onTimerChanged ( ))); + +} + +/*! + * \brief View::VTreatmentVitals::onActionReceive + * \details The data handler which gets the data form GuiControl and GuiController will get the data from BtCuff controller. + * \param vData - Vital values + * \note the accepted and reason in this case should be the BtCuff status which may not necessarily comes front BtCuff itself, + * and the intermediate controller like the GuiController or the BtCuffController can report from BtCuff behalf if it is connected or not responsive. + */ +void View::VTreatmentVitals::onActionReceive(const AdjustVitalsResposeData &vData) +{ + if ( ! _enabled ) { + // if the vitals is disabled it means Gui is probably in an incorrect state and is unable to handle the vital information. + LOG_EVENT(tr("Measured vital values ignored due to incorrect state")); + return; + } + + adjustment_Accepted ( vData.mAccepted ); + adjustment_Reason ( vData.mReason ); + + update(vData.mSystolic, vData.mDiastolic, vData.mHeartRate); + treatmentLog(); + LOG_EVENT(tr("Cuff Vital Measurement,%1,%2,%3") + .arg(_systolic ) + .arg(_diastolic) + .arg(_heartRate) + ); +} + +/*! + * \brief View::VPostTreatmentAdjustmentTreatmentLog::doVitalReceive + * \details Append the user measured BP/HR in to the list of the Treatment Log Average data + * \param vSystolic - Blood Pressure Systolic + * \param vDiastolic - Blood Pressure Diastolic + * \param vHeartRate - Heart Rate + */ +void View::VTreatmentVitals::doConfirm(quint32 vSystolic, quint32 vDiastolic, quint32 vHeartRate){ + adjustment_Accepted ( true ); + adjustment_Reason ( 0 ); + + update(vSystolic, vDiastolic, vHeartRate); + treatmentLog(); + LOG_EVENT(tr("User Vital Confirmation,%1,%2,%3") + .arg(_systolic ) + .arg(_diastolic) + .arg(_heartRate) + ); +} + +/*! + * \brief View::VTreatmentVitals::doSkip + * \details logs the vital entry skip + */ +void View::VTreatmentVitals::doSkip() +{ + LOG_EVENT(tr("User Skipped Vital Entry")); +} + +/*! + * \brief View::VTreatmentVitals::doTimeout + * \details logs the vital entry timeout + */ +void View::VTreatmentVitals::doTimeout() +{ + LOG_EVENT(tr("User Vital Entry Timed out")); +} + +/*! + * \brief View::VTreatmentVitals::doReset + * \details reset the previously read vital values + */ +void View::VTreatmentVitals::doReset() +{ + epoch ( 0 ); + lastRead ( ""); + systolic ( 0 ); + diastolic ( 0 ); + heartRate ( 0 ); + + // force notify the Gui + emit epochChanged ( 0 ); + emit lastReadChanged ( ""); + emit systolicChanged ( 0 ); + emit diastolicChanged ( 0 ); + emit heartRateChanged ( 0 ); +} + +/*! + * \brief View::VTreatmentVitals::update + * \details updating the properties and set the timestamp + * \param vSystolic - Blood Pressure Systolic + * \param vDiastolic - Blood Pressure Diastolic + * \param vHeartRate - Heart Rate + */ +void View::VTreatmentVitals::update(quint32 vSystolic, quint32 vDiastolic, quint32 vHeartRate) +{ + QDateTime currentDateTime = QDateTime::currentDateTime(); + epoch (currentDateTime.toSecsSinceEpoch()); + lastRead (currentDateTime.toString(_datetimeFormat)); + systolic ( vSystolic ); + diastolic ( vDiastolic ); + heartRate ( vHeartRate ); + + // *** has to be the last to let the information to be set and then emit the signal *** + // *** otherwise will use the previous values before being set. *** + adjustment(true); +} + +/*! + * \brief View::VTreatmentVitals::treatmentLog + * \details Appends the vitals values to the treatment log list (for later store in the TxLog at the end of Tx) + * \note the method update has to be called before calling this method to update the property values used in this method. + */ +void View::VTreatmentVitals::treatmentLog() +{ + TreatmentLogAvrgeData data ; + data.mTimeStamp = _epoch ; + data.mSystolic = _systolic ; + data.mDiastolic = _diastolic; + data.mHeartRate = _heartRate; + _TreatmentLog.append(data) ; +} + +/*! + * \brief View::VTreatmentVitals::timerEvent + * \details The override method to handle the timer for the vital measurement interval + */ +void View::VTreatmentVitals::timerEvent(QTimerEvent *) +{ + qDebug() << __FUNCTION__ << _timerCounter; + if ( _interval == _timerCounter ) { + _timerCounter = 0; + emit didTrigger(); + } + _timerCounter++; +} + +void View::VTreatmentVitals::onTimerChanged() +{ + if ( _interval && _enabled ) + start(); + else + stop(); +} + +/*! + * \brief View::VTreatmentVitals::start + * \details Starts the timer by 1 min interval + * \note the vital times are all minutes. + */ +void View::VTreatmentVitals::start() +{ + _timerId = startTimer(60000); // 1 min interval +} + +/*! + * \brief View::VTreatmentVitals::stop + * \details stops the timer + */ +void View::VTreatmentVitals::stop() +{ + killTimer(_timerId); + _timerId = 0; + _timerCounter = 0; +} Index: sources/view/hd/adjustment/common/VCommonAdjustmentVitals.h =================================================================== diff -u --- sources/view/hd/adjustment/common/VCommonAdjustmentVitals.h (revision 0) +++ sources/view/hd/adjustment/common/VCommonAdjustmentVitals.h (revision ab7ffd27ecea1277d8645a8b62ff48c0cb3f6ff4) @@ -0,0 +1,128 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file VTreatmentVitals.h + * \author (last) Behrouz NematiPour + * \author (original) Behrouz NematiPour + * \date (last) 22-Jun-2021 + * \date (original) 22-Jun-2021 + * + */ +#pragma once + +#include + +// Project +#include "main.h" // Doxygen : don't remove +#include "VAdjustmentResponseBase.h" + +namespace View { + +/*! + * \brief The VTreatmentVitals class + * \details View for Model's Data representation. + * + * \sa Model::TreatmentLogAvrgeData + * + */ +class VTreatmentVitals : public VAdjustmentResponseBase { + Q_OBJECT + + // friends + friend class ::tst_views; + + int _timerId = 0; + int _timerCounter = 0; + + // coco begin validated: + // The property adjustment_Triggered has to be always true + // and to always trigger the change event to work as a notifier for GUI + // has been manually tested that it works perfectly fine + TRIGGER( bool , adjustment , 0) + // coco end + + // Vitals data + // formatting + PROPERTY( QString , datetimeFormat ,"yyyy/MMM/dd - HH:mm") + + // constant range variables / units / ... + CONSTANT( quint16 , systolicMin , 60) + CONSTANT( quint16 , systolicMax , 250) + CONSTANT( quint16 , diastolicMin , 40) + CONSTANT( quint16 , diastolicMax , 200) + CONSTANT( quint16 , heartRateMin , 40) + CONSTANT( quint16 , heartRateMax , 180) + + + // timer + PROPERTY( bool , enabled , 0) // enable the vital screen timer + PROPERTY( quint8 , interval , 0) // show the vital screen in min + PROPERTY( quint8 , timeout , 1) // close the vital screen in min + + // timestamp + PROPERTY( quint64 , epoch , 0) + PROPERTY( QString , lastRead , "") + + // vitals + PROPERTY( quint32 , systolic , 0) + PROPERTY( quint32 , diastolic , 0) + PROPERTY( quint32 , heartRate , 0) + + // placeholder for later connection and receiving data from BtCuff [Not used Yet] + struct VitalsData_PlaceHolder { + quint32 mAccepted = 0; + quint32 mReason = 0; + + quint32 mSystolic = 0; + quint32 mDiastolic = 0; + quint32 mHeartRate = 0; + }; + typedef VitalsData_PlaceHolder AdjustVitalsResposeData; + + VIEW_DEC_CLASS_ADJUSTMENT(VTreatmentVitals, AdjustVitalsResposeData) + + void update (quint32 vSystolic, quint32 vDiastolic, quint32 vHeartRate); + void treatmentLog(); + + // timer + void start(); + void stop (); + + void timerEvent(QTimerEvent *) override; + +private slots: + void onTimerChanged(); + +public slots: + // vitals + void doConfirm (quint32 vSystolic, quint32 vDiastolic, quint32 vHeartRate); + void doSkip (); + void doTimeout (); + void doReset (); + +signals: + /*! + * \brief didAdjustment + * \details the notification signal to send the user's Request + * \param vData - data model includes request information + */ + void didAdjustment(const AdjustHDAlarmVolumeRequestData &vData); + + /*! + * \brief didTrigger + * \details the signal to trigger the Gui to notify the user for the vitals measurement + */ + void didTrigger(); + + /*! + * \brief didTrigger + * \details the signal to trigger the Gui to close the vitals measurement screen on no user interaction + */ + void didTimeout(); +}; + +}