Index: sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentVitals.qml =================================================================== diff -u -r9bd436782039b50ac45eb38f561a36706517271b -rae31b8fc6d423cdcbe99c60c711d6175da6be8fb --- sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentVitals.qml (.../TreatmentAdjustmentVitals.qml) (revision 9bd436782039b50ac45eb38f561a36706517271b) +++ sources/gui/qml/pages/treatment/adjustments/TreatmentAdjustmentVitals.qml (.../TreatmentAdjustmentVitals.qml) (revision ae31b8fc6d423cdcbe99c60c711d6175da6be8fb) @@ -166,7 +166,10 @@ } Connections { target: vTreatmentVitals - function onDidTrigger () { vTreatmentAdjustmentVitals.doRequest() } + function onDidTrigger () { + vTreatmentAdjustmentVitals.doRequest() + vTreatmentVitals.doTimerStart() + } } Connections { target: vTreatmentAdjustmentVitals @@ -187,6 +190,9 @@ } notificationText = notificationTextString } + + // FW no response timeout + function onTimedOutTriggered ( vValue ) { vTreatmentVitals.doSkip(); } } Behavior on x { NumberAnimation { duration: Variables.keybardAnimationDuration } } Index: sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp =================================================================== diff -u -r9bd436782039b50ac45eb38f561a36706517271b -rae31b8fc6d423cdcbe99c60c711d6175da6be8fb --- sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp (.../VCommonAdjustmentVitals.cpp) (revision 9bd436782039b50ac45eb38f561a36706517271b) +++ sources/view/hd/adjustment/common/VCommonAdjustmentVitals.cpp (.../VCommonAdjustmentVitals.cpp) (revision ae31b8fc6d423cdcbe99c60c711d6175da6be8fb) @@ -76,7 +76,6 @@ void View::VTreatmentVitals::doSkip() { LOG_APPED_UI(tr("Vital Skipped")); - timerReset(); } /*! @@ -171,8 +170,7 @@ */ void View::VTreatmentVitals::onIntervalChanged() { - if ( _interval ) timerReset(); - else timerStop (); // Timer stop is resetting timer too. + if ( ! _interval ) timerStop (); } /*! @@ -185,10 +183,13 @@ if ( _timerId ) killTimer(_timerId); // this typically should not happen. if ( ! _interval ) return; // if interval is 0/OFF return - timerReset(); _timerId = startTimer(1000); // 1 sec interval which will used as 1 min in timerEvent (easier to debug) } +/*! + * \brief View::VTreatmentVitals::updateTimer + * \details Update timer from current time with set interval and update UI data + */ void View::VTreatmentVitals::updateTimer() { _now = QDateTime::currentDateTime(); @@ -206,7 +207,6 @@ if (_total_sec_left <= 1 ) { timerStop(); emit didTrigger(); - _total_sec_left = _interval * 60; } // construct count down string @@ -217,23 +217,6 @@ } /*! - * \brief View::VTreatmentVitals::timerReset - * \details Resets the timer counters based on the current interval. - */ -void View::VTreatmentVitals::timerReset() -{ - if ( _interval && _canStartInterval && _timerId ) { // get time past interval - updateTimer(); - } - else { // if _interval == 0, clear counters - _counter_sec = 0; - _counter_min = 0; - _totalCount = 0; - _total_sec_left = 0; - } -} - -/*! * \brief View::VTreatmentVitals::stop * \details stops the timer and resets the interval */ @@ -242,5 +225,4 @@ if ( ! _timerId ) return; // No timer started or failed starting killTimer(_timerId); _timerId = 0; - timerReset(); } Index: sources/view/hd/adjustment/common/VCommonAdjustmentVitals.h =================================================================== diff -u -r9bd436782039b50ac45eb38f561a36706517271b -rae31b8fc6d423cdcbe99c60c711d6175da6be8fb --- sources/view/hd/adjustment/common/VCommonAdjustmentVitals.h (.../VCommonAdjustmentVitals.h) (revision 9bd436782039b50ac45eb38f561a36706517271b) +++ sources/view/hd/adjustment/common/VCommonAdjustmentVitals.h (.../VCommonAdjustmentVitals.h) (revision ae31b8fc6d423cdcbe99c60c711d6175da6be8fb) @@ -80,7 +80,6 @@ // timer void timerStart(); - void timerReset(); void timerStop (); void updateTimer(); Index: sources/view/td/adjustment/treatment/VTreatmentAdjustmentVitals.cpp =================================================================== diff -u -r73da05e9b761c559cd4d6741e574fc0f40475ebc -rae31b8fc6d423cdcbe99c60c711d6175da6be8fb --- sources/view/td/adjustment/treatment/VTreatmentAdjustmentVitals.cpp (.../VTreatmentAdjustmentVitals.cpp) (revision 73da05e9b761c559cd4d6741e574fc0f40475ebc) +++ sources/view/td/adjustment/treatment/VTreatmentAdjustmentVitals.cpp (.../VTreatmentAdjustmentVitals.cpp) (revision ae31b8fc6d423cdcbe99c60c711d6175da6be8fb) @@ -27,6 +27,12 @@ void View::VTreatmentAdjustmentVitals::initConnections() { ACTION_VIEW_CONNECTION(AdjustVitalsResponseData); ADJUST_VIEW_CONNECTION(AdjustVitalsRequestData ); + + // set singleshot timer when requesting and stop if responded from fw. + // if timeout is emited then let QML know to skip measurement + _timeoutTimer.setSingleShot(true); + _timeoutTimer.setInterval(2 * 60 * 1000); // 2 min timeout + connect(&_timeoutTimer, &QTimer::timeout, this, [this]() { timedOut(true); }); } /*! @@ -36,6 +42,8 @@ */ void View::VTreatmentAdjustmentVitals::onActionReceive(const AdjustVitalsResponseData &vData) { + _timeoutTimer.stop(); + adjustment_Accepted ( vData.mAccepted ); adjustment_Reason ( vData.mReason ); @@ -50,6 +58,8 @@ */ void View::VTreatmentAdjustmentVitals::doRequest() { + _timeoutTimer.start(); + AdjustVitalsRequestData data; emit didAdjustment(data); } Index: sources/view/td/adjustment/treatment/VTreatmentAdjustmentVitals.h =================================================================== diff -u -r31b1e7a5d69f014398827e16286f28515cd60e35 -rae31b8fc6d423cdcbe99c60c711d6175da6be8fb --- sources/view/td/adjustment/treatment/VTreatmentAdjustmentVitals.h (.../VTreatmentAdjustmentVitals.h) (revision 31b1e7a5d69f014398827e16286f28515cd60e35) +++ sources/view/td/adjustment/treatment/VTreatmentAdjustmentVitals.h (.../VTreatmentAdjustmentVitals.h) (revision ae31b8fc6d423cdcbe99c60c711d6175da6be8fb) @@ -16,6 +16,7 @@ // Qt #include +#include // Project #include "main.h" // Doxygen : do not remove @@ -36,8 +37,11 @@ Q_OBJECT AdjustVitalsRequestData _data; + QTimer _timeoutTimer; + TRIGGER( bool , adjustment , 0 ) + TRIGGER( bool , timedOut , 0 ) VIEW_DEC_CLASS_ADJUSTMENT(VTreatmentAdjustmentVitals, AdjustVitalsResponseData)