Index: sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp =================================================================== diff -u -ra5760947d3ed0d2748ba023a1c25e3c6aa0b1de1 -r0ced87f43c28bcc9f3402e19284030ad1405e9e8 --- sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp (.../VCommonAdjustmentVitals.cpp) (revision a5760947d3ed0d2748ba023a1c25e3c6aa0b1de1) +++ sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp (.../VCommonAdjustmentVitals.cpp) (revision 0ced87f43c28bcc9f3402e19284030ad1405e9e8) @@ -20,41 +20,33 @@ // Project #include "GuiController.h" #include "TreatmentLog.h" -#include "BluetoothInterface.h" -VIEW_DEF_CLASS_ADJUSTMENT(VTreatmentVitals) +VIEW_DEF_CLASS(VTreatmentVitals) /*! * \brief Connection Initializer * \details All the class signal/slot connections are defined here. */ void View::VTreatmentVitals::initConnections() { - ACTION_RECEIVE_BRIDGE_CONNECTION(_BluetoothInterface, UIBloodPressureData); - connect(this, SIGNAL( intervalChanged (const quint8 &)), this, SLOT(onIntervalChanged ( ))); + ACTION_VIEW_CONNECTION( TreatmentVitalsData ); } /*! * \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. + * \details The data handler which gets the data from the integreated Blood Pressure cuff. + * \param TreatmentVitalsData - Vital values + * \note the accepted and reason in this case should be the integreated Blood Pressure cuff status which may not necessarily comes from the cuff itself. */ -void View::VTreatmentVitals::onActionReceive(const UIBloodPressureData &vData) +void View::VTreatmentVitals::onActionReceive(const TreatmentVitalsData &vData) { - // Not used yet. - // adjustment_Accepted ( vData.mAccepted ); - // adjustment_Reason ( vData.mReason ); + update_rt (vData.mSystolic, vData.mDiastolic, vData.mHeartRate); - update_rt (vData.mSystolic, vData.mDiastolic, vData.mPulseRate); - emit didTrigger(vData.mSystolic, vData.mDiastolic, vData.mPulseRate); - // if the vitals is disabled it means Gui is probably in an incorrect state and is unable to handle the vital information. LOG_APPED_UI(tr("Vital received,%1,%2,%3") - .arg(vData.mSystolic ) - .arg(vData.mDiastolic) - .arg(vData.mPulseRate)); + .arg(vData.mSystolic ) + .arg(vData.mDiastolic) + .arg(vData.mHeartRate)); } /*! @@ -67,9 +59,6 @@ void View::VTreatmentVitals::doConfirm( quint16 vSystolic, quint16 vDiastolic, quint16 vHeartRate) { - adjustment_Accepted ( true ); - adjustment_Reason ( 0 ); - update(vSystolic, vDiastolic, vHeartRate); treatmentLog(); LOG_APPED_UI(tr("Vital Confirmed,%1,%2,%3") @@ -86,8 +75,10 @@ */ void View::VTreatmentVitals::doSkip() { - LOG_APPED_UI(tr("Vital Skipped")); - timerReset(); + if ( enableDialog() ) { + LOG_APPED_UI(tr("Vital Skipped")); + timerReset(); + } } /*! @@ -112,6 +103,7 @@ emit systolicChanged ( 0 ); emit diastolicChanged ( 0 ); emit heartRateChanged ( 0 ); + emit totalCountChanged ( 0 ); } /*! @@ -129,10 +121,6 @@ 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); } /*! @@ -174,13 +162,13 @@ if ( ! _timerId ) return; // No timer started or failed starting if ( ! _interval ) return; // if interval is 0/OFF return - // DEBUG: qDebug() << __FUNCTION__ << _counter_sec << _counter_min << _interval << _timerId; _counter_sec++; + emit totalCountChanged(++_totalCount); min_left(_counter_min ); sec_left(60 - _counter_sec); - countdown(QString("%1:%2").arg(_min_left,2,10,QChar('0')).arg(_sec_left,2,10,QChar('0'))); + countdown(QStringLiteral("%1:%2").arg(_min_left,2,10,QChar('0')).arg(_sec_left,2,10,QChar('0'))); if ( _counter_sec % 60 ) return; // only check every minute @@ -194,9 +182,13 @@ } } +/*! + * \brief View::VTreatmentVitals::onIntervalChanged + * \details Resets or stops the timer depending on whether an interval + * is currently set. + */ void View::VTreatmentVitals::onIntervalChanged() { - // DEBUG: qDebug() << __FUNCTION__ << _counter_sec << _counter_min << _interval << _timerId; if ( _interval ) timerReset(); else timerStop (); // Timer stop is resetting timer too. } @@ -210,12 +202,14 @@ { if ( _timerId ) killTimer(_timerId); // this typically should not happen. if ( ! _interval ) return; // if interval is 0/OFF return - // DEBUG: qDebug() << __FUNCTION__ << _counter_sec << _counter_min << _interval << _timerId; timerReset(); _timerId = startTimer(1000); // 1 sec interval which will used as 1 min in timerEvent (easier to debug) } - +/*! + * \brief View::VTreatmentVitals::timerReset + * \details Resets the timer counters based on the current interval. + */ void View::VTreatmentVitals::timerReset() { if ( _interval ) { @@ -226,7 +220,7 @@ _counter_min = 0; } _counter_sec = 0; - // DEBUG: qDebug() << __FUNCTION__ << _counter_sec << _counter_min << _interval << _timerId; + _totalCount = 0; } /*! @@ -236,7 +230,6 @@ void View::VTreatmentVitals::timerStop() { if ( ! _timerId ) return; // No timer started or failed starting - // DEBUG: qDebug() << __FUNCTION__ << _counter_sec << _counter_min << _interval << _timerId; killTimer(_timerId); _timerId = 0; timerReset();