Index: sources/view/VBluetooth.cpp =================================================================== diff -u -r757a01c42a7a611704a67869a74c68f53edab20f -ra47e7059c91c50cee3e05972fe5d96c053cdfb31 --- sources/view/VBluetooth.cpp (.../VBluetooth.cpp) (revision 757a01c42a7a611704a67869a74c68f53edab20f) +++ sources/view/VBluetooth.cpp (.../VBluetooth.cpp) (revision a47e7059c91c50cee3e05972fe5d96c053cdfb31) @@ -11,7 +11,13 @@ using namespace Storage; // coco begin validated: This class cannot be tested on the server, but has been validated manually -VBluetooth::VBluetooth(QObject *parent) : QObject(parent) +VIEW_DEF_CLASS(VBluetooth) + +/*! + * \brief VBluetooth::initConnections + * Makes the necessary connections. Called inside VIEW_DEF_CLASS + */ +void VBluetooth::initConnections() { // incoming connect(&_BLEScanner, SIGNAL(didReceiveScanForDevicesError(QBluetoothDeviceDiscoveryAgent::Error)), Index: sources/view/VBluetooth.h =================================================================== diff -u -r757a01c42a7a611704a67869a74c68f53edab20f -ra47e7059c91c50cee3e05972fe5d96c053cdfb31 --- sources/view/VBluetooth.h (.../VBluetooth.h) (revision 757a01c42a7a611704a67869a74c68f53edab20f) +++ sources/view/VBluetooth.h (.../VBluetooth.h) (revision a47e7059c91c50cee3e05972fe5d96c053cdfb31) @@ -7,6 +7,7 @@ #include // Project +#include "VView.h" #include "VBluetoothDeviceInfo.h" #include "GuiController.h" @@ -28,9 +29,9 @@ class VBluetooth : public QObject { Q_OBJECT -public: - explicit VBluetooth(QObject *parent = nullptr); +VIEW_DEC_CLASS(VBluetooth) + protected: Q_PROPERTY(QVariant devices READ doGetDevices NOTIFY didDevicesChanged) Q_PROPERTY(QVariant pairedDevices READ doGetPairedDevices NOTIFY didPairedDevicesChanged) Index: sources/view/VVitals.cpp =================================================================== diff -u -r510ea07f96362a18f9961f41b5b91740df075c1f -ra47e7059c91c50cee3e05972fe5d96c053cdfb31 --- sources/view/VVitals.cpp (.../VVitals.cpp) (revision 510ea07f96362a18f9961f41b5b91740df075c1f) +++ sources/view/VVitals.cpp (.../VVitals.cpp) (revision a47e7059c91c50cee3e05972fe5d96c053cdfb31) @@ -9,8 +9,13 @@ using namespace View; using namespace Gui; +VIEW_DEF_CLASS(VVitals) -VVitals::VVitals(QObject *parent) : QObject(parent) +/*! + * \brief VVitals::initConnections + * Makes the necessary connections. Called inside VIEW_DEF_CLASS + */ +void VVitals::initConnections() { // incoming connect(&_BLEScanner, SIGNAL(didReceiveBPMeasurement(BLEMeasurementData)), @@ -19,9 +24,6 @@ connect(&_GuiController, SIGNAL(didActionReceive(HDOperationModeData)), this, SLOT(onHDOperationModeUpdate(HDOperationModeData))); - connect(&_MainTimer, SIGNAL(didTimeout()), - this, SLOT(onTimeout())); - connect(&_GuiController, SIGNAL(didAlertResponse(GuiAlertResponseData)), this, SLOT(onReceiveAlertResponse(GuiAlertResponseData))); @@ -30,9 +32,22 @@ // outgoing connect(this, SIGNAL(didRequestShowAlert(GuiAlertRequestData)), &_GuiController, SLOT(doAlertRequest(GuiAlertRequestData))); + + _timerID = startTimer(_timerInterval); } /*! + * \brief VVitals::timerEvent + * Called every _timerInterval (s) + * \param event (QTimerEvent*) the timer event + */ +void VVitals::timerEvent(QTimerEvent *event) +{ + Q_UNUSED(event); + notifyTakeMeasurement(); +} + +/*! * \brief VVitals::doUpdateBPMeasureInterval * Updates the blood pressure and hr measurement interval during a treatment * Called whenever a new treatment parameters request is issued @@ -93,7 +108,7 @@ * \brief VVitals::onTimeout * Notifies the user to take a measurement */ -void VVitals::onTimeout() +void VVitals::notifyTakeMeasurement() { // coco begin validated: Has been validated manually if (bloodPressureMeasureIntervalMinutes() == 0) Index: sources/view/VVitals.h =================================================================== diff -u -r510ea07f96362a18f9961f41b5b91740df075c1f -ra47e7059c91c50cee3e05972fe5d96c053cdfb31 --- sources/view/VVitals.h (.../VVitals.h) (revision 510ea07f96362a18f9961f41b5b91740df075c1f) +++ sources/view/VVitals.h (.../VVitals.h) (revision a47e7059c91c50cee3e05972fe5d96c053cdfb31) @@ -6,6 +6,7 @@ #include // Project +#include "VView.h" #include "BLEScanner.h" #include "main.h" #include "GuiController.h" @@ -31,10 +32,14 @@ bool _inTreatmentMode = false; bool _enterManually = false; QDateTime _lastNotification; + int _timerInterval = 1000; // ms + int _timerID = -1; -public: - explicit VVitals(QObject *parent = nullptr); + void timerEvent(QTimerEvent *event); + void notifyTakeMeasurement(); +VIEW_DEC_CLASS(VVitals) + protected: // coco begin validated: Has been validated manually PROPERTY(quint32, bloodPressureSystolic, 0) @@ -53,6 +58,5 @@ void onReceiveAlertResponse(const GuiAlertResponseData &vResponse); void onActionReceive(const TreatmentStartResponseData &vResponse); void onHDOperationModeUpdate(const HDOperationModeData &vHDOpMode); - void onTimeout(); }; }