Index: denali.pro =================================================================== diff -u -r3e2866b98a67e772686d5190eacfd4ee437bcd0f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- denali.pro (.../denali.pro) (revision 3e2866b98a67e772686d5190eacfd4ee437bcd0f) +++ denali.pro (.../denali.pro) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -115,6 +115,7 @@ sources/gui/GuiView.h \ sources/gui/GuiController.h \ \ # ---------- Views ---------- + sources/view/VAlert.h \ sources/view/VBluetooth.h \ sources/view/VBluetoothDeviceInfo.h \ sources/view/VTreatmentCreate.h \ @@ -232,6 +233,7 @@ sources/gui/GuiView.cpp \ sources/gui/GuiController.cpp \ \ # ---------- Views ---------- + sources/view/VAlert.cpp \ sources/view/VBluetooth.cpp \ sources/view/VBluetoothDeviceInfo.cpp \ sources/view/VTreatmentCreate.cpp \ Index: denali.pro.user =================================================================== diff -u -r5220c64dd3a0fc9c322a68884e73503bb7893d12 -r666594860f4ea32da9a2bd362d40325b881b11f9 --- denali.pro.user (.../denali.pro.user) (revision 5220c64dd3a0fc9c322a68884e73503bb7893d12) +++ denali.pro.user (.../denali.pro.user) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -1,6 +1,6 @@ - + EnvironmentId Index: denali.qrc =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- denali.qrc (.../denali.qrc) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ denali.qrc (.../denali.qrc) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -11,6 +11,7 @@ sources/gui/qml/dialogs/PowerOff.qml sources/gui/qml/dialogs/AutoHideInfo.qml sources/gui/qml/dialogs/NotificationDialog.qml + sources/gui/qml/dialogs/Alert.qml resources/images/Settings_gear_setting_tools-128.png @@ -22,6 +23,7 @@ resources/images/logo d Dark Transparent.png resources/images/Close.png resources/images/alarm.png + resources/images/alert.png resources/images/bell.png resources/images/bell-off.png resources/images/Back.png Index: resources/images/alert.png =================================================================== diff -u Binary files differ Index: sources/bluetooth/BLEScanner.cpp =================================================================== diff -u -r5220c64dd3a0fc9c322a68884e73503bb7893d12 -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/bluetooth/BLEScanner.cpp (.../BLEScanner.cpp) (revision 5220c64dd3a0fc9c322a68884e73503bb7893d12) +++ sources/bluetooth/BLEScanner.cpp (.../BLEScanner.cpp) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -323,13 +323,13 @@ */ void BLEScanner::doParseMeasurement(const QByteArray &byteArray) { - bp_measurement_t measurement; + BLEMeasurementData measurement; // for debugging /* const char *data = "\x16t\x00M\x00Z\x00\xE4\x07\t\x04\n\x05""8@\x00\x00\x00"; - QByteArray byteArray = QByteArray::fromRawData(data, sizeof(bp_measurement)); + QByteArray byteArray = QByteArray::fromRawData(data, sizeof(BLEMeasurementData)); */ const uint8_t *d = reinterpret_cast(byteArray.constData()); Index: sources/bluetooth/BLEScanner.h =================================================================== diff -u -r5220c64dd3a0fc9c322a68884e73503bb7893d12 -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/bluetooth/BLEScanner.h (.../BLEScanner.h) (revision 5220c64dd3a0fc9c322a68884e73503bb7893d12) +++ sources/bluetooth/BLEScanner.h (.../BLEScanner.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -32,7 +32,7 @@ public: // 19 total bytes - struct bp_measurement { + struct BLEMeasurementData { uint8_t flags; // 1 byte uint16_t systolic; // 2 bytes uint16_t diastolic; // 2 bytes @@ -48,7 +48,6 @@ uint16_t measurement_status; // 2 bytes }; - typedef bp_measurement bp_measurement_t; private: @@ -85,7 +84,7 @@ void updateBLECuffCheckinType(bool retryConnection); signals: - void didReceiveBPMeasurement(bp_measurement_t); + void didReceiveBPMeasurement(BLEMeasurementData); void didReceiveScanForDevicesError(QBluetoothDeviceDiscoveryAgent::Error error); void didFinishScan(); void didDiscoverDevice(const QBluetoothDeviceInfo &device); @@ -130,4 +129,6 @@ void onRetryConnectToDevice(); }; +typedef BLEScanner::BLEMeasurementData BLEMeasurementData; + #endif // BLESCANNER_H Index: sources/canbus/MessageDispatcher.cpp =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -393,7 +393,6 @@ onActionTransmit(GuiActionType::ID_TreatmentCreateReq, mData); } - /*! * \brief MessageDispatcher::actionTransmit * \details This method is called by slot MessageDispatcher::onActionTransmit Index: sources/gui/GuiController.cpp =================================================================== diff -u -r67371c6a2861c5e8a2328984ae999bf8df4b0bb7 -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 67371c6a2861c5e8a2328984ae999bf8df4b0bb7) +++ sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -320,3 +320,23 @@ data.mFlags = QBitArray(16, false); // 16 QBitArray of flags, if needed emit didActionReceive(data); } + +/*! + * \brief GuiController::doAlertRequest + * Handles a request to show a new alert + * \param alert - (GuiAlert) The alert information to show + */ +void GuiController::doAlertRequest(const GuiAlertRequestData &alertRequest) +{ + emit didAlertRequest(alertRequest); +} + +/*! + * \brief GuiController::doAlertResponse + * Handles a user response to an alert + * \param alertResponse - (GuiAlertResponse) the alert response + */ +void GuiController::doAlertResponse(const GuiAlertResponseData &alertResponse) +{ + emit didAlertResponse(alertResponse); +} Index: sources/gui/GuiController.h =================================================================== diff -u -rb61d8a3e01fef66eee8095c9cddf835d9bb32b66 -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/gui/GuiController.h (.../GuiController.h) (revision b61d8a3e01fef66eee8095c9cddf835d9bb32b66) +++ sources/gui/GuiController.h (.../GuiController.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -74,6 +74,9 @@ void doUSBDriveUmount(); // UI => OS void doExportLog (); // UI => OS + void doAlertRequest (const GuiAlertRequestData &alertRequest); + void doAlertResponse(const GuiAlertResponseData &alertResponse); + private slots: // Should be private for thread safety and is connected internally. void onActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG @@ -98,6 +101,9 @@ void didExportLog(); void didExport (); + void didAlertRequest (GuiAlertRequestData); + void didAlertResponse(GuiAlertResponseData); + // ---- Signal/Slots ADJUST_TRANSMT_MODEL_BRIDGE_DEFINITIONS_PUBLIC ACTION_RECEIVE_MODEL_BRIDGE_DEFINITIONS Index: sources/gui/GuiGlobals.cpp =================================================================== diff -u -r3e2866b98a67e772686d5190eacfd4ee437bcd0f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 3e2866b98a67e772686d5190eacfd4ee437bcd0f) +++ sources/gui/GuiGlobals.cpp (.../GuiGlobals.cpp) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -61,6 +61,7 @@ #include "VTreatmentAdjustmentUltrafiltrationConfirm.h" #include "VTreatmentAdjustmentSaline.h" #include "VVitals.h" +#include "VAlert.h" namespace Gui { MainView *_viewer = nullptr; Index: sources/gui/GuiGlobals.h =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ sources/gui/GuiGlobals.h (.../GuiGlobals.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -92,6 +92,9 @@ ID_AlarmUserAckReq = 0x3F00, // 63 ID_AlarmSilenceReq = 0x3200, // 50 + ID_AlertReq = ID_Unknown, + ID_AlertUserReq = ID_Unknown, + ID_TreatmentCreateReq = 0x3500, // 53 ID_TreatmentCreateRsp = 0x3600, // 54 ID_TreatmentStartReq = 0x3800, // 56 @@ -148,6 +151,15 @@ Timeout = 0x01, }; + struct AlertRequest { + QString title; + QString description; + }; + + struct AlertResponse { + bool confirmed = false; + }; + Q_ENUM(GuiActionsType_Enum) Q_ENUM(GuiActionsData_Enum) @@ -188,6 +200,9 @@ typedef GuiActions::UF_States GuiUFStates; typedef GuiActions::Saline_Bolus_States GuiSalineStates; + typedef GuiActions::AlertRequest GuiAlertRequestData; + typedef GuiActions::AlertResponse GuiAlertResponseData; + void registerTypes(); void registerQmlTypes(); Index: sources/gui/qml/dialogs/Alert.qml =================================================================== diff -u --- sources/gui/qml/dialogs/Alert.qml (revision 0) +++ sources/gui/qml/dialogs/Alert.qml (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -0,0 +1,108 @@ +/*! + * + * 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 Alert.qml + * \author (last) Peter Lucia + * \date (last) 30-Nov-2020 + * \author (original) Peter Lucia + * \date (original) 30-Nov-2019 + * + */ + +// Qt +import QtQuick 2.12 + +// Project +// Qml imports +import "qrc:/globals" +import "qrc:/components" + +/*! + * \brief Contains the Alert Dialog Implementation + */ +ModalDialog { id : _root + contentItem.objectName: "Alert" //SquishQt testability + + Rectangle { id: _titleBar; + color: "transparent"; + height: _root.height / 4; + width: _root.width; + radius: _root.radius; + + Image { id: _icon + source: "qrc:/images/iAlert" + anchors { + horizontalCenter: _alert.horizontalCenter + verticalCenter: _alert.verticalCenter; + horizontalCenterOffset: -_alert.width; + } + sourceSize.height: Variables.dialogIconHeight; + sourceSize.width: Variables.dialogIconWidth; + } + + Text { id: _alert + color: Colors.textMain + font.pixelSize: Fonts.fontPixelTitle + text: qsTr("Alert") + anchors.centerIn: _titleBar; + } + } + + Text { id: _titleText + anchors { + horizontalCenter: parent.horizontalCenter; + top: _titleBar.bottom; + } + color: Colors.textMain + font.pixelSize: 36 + text: vAlert.title + } + + Text { id: _message + anchors { + horizontalCenter: parent.horizontalCenter; + verticalCenter: parent.verticalCenter; + } + color: Colors.textMain + font.pixelSize: Fonts.fontPixelButton + text: vAlert.description + } + + Row { id: _buttons + spacing: Variables.buttonSpacing; + anchors { + horizontalCenter: parent.horizontalCenter; + bottom: parent.bottom; + bottomMargin: Variables.dialogMargin / 2; + } + + TouchRect { id: _confirm + width: _root.width / 3; + text.text: qsTr("CONFIRM") + button.onPressed: { + vAlert.doAlertResponse(true) + close() + } + } + + TouchRect { id: _cancel + width: _root.width / 3; + text.text: qsTr("CANCEL") + button.onPressed: { + vAlert.doAlertResponse(false) + close() + } + } + } + + Connections { + target: vAlert + onDidRequestShowAlert: { + _root.open() + } + } +} Index: sources/gui/qml/main.qml =================================================================== diff -u -r3e2866b98a67e772686d5190eacfd4ee437bcd0f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/gui/qml/main.qml (.../main.qml) (revision 3e2866b98a67e772686d5190eacfd4ee437bcd0f) +++ sources/gui/qml/main.qml (.../main.qml) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -50,6 +50,7 @@ import VTreatmentBegin 0.1; import VTreatmentEnd 0.1; import VVitals 0.1; +import VAlert 0.1; // Qml imports import "qrc:/globals" @@ -110,6 +111,7 @@ VTreatmentBegin { id: vTreatmentBegin } VTreatmentEnd { id: vTreatmentEnd } VVitals { id: vVitals } + VAlert { id: vAlert } // ----- Follow the below Z order ----- // 1 - Screens @@ -290,6 +292,8 @@ } } + Alert { id: _alert } + Connections { target: vAlarmStatus onRaiseAlarm: { updateAlarm(); Index: sources/gui/qml/pages/treatment/TreatmentStack.qml =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ sources/gui/qml/pages/treatment/TreatmentStack.qml (.../TreatmentStack.qml) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -118,7 +118,7 @@ TreatmentBegin { id: _treatmentBegin onClickedBack : {vTreatmentCreate.doRequestPop() } - onClickedStart : {vTreatmentCreate.doStartTreatment(); } + onClickedStart : {vTreatmentBegin.doStartTreatment(); } } Index: sources/model/MModel.h =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/model/MModel.h (.../MModel.h) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ sources/model/MModel.h (.../MModel.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -221,6 +221,7 @@ REGISTER_METATYPE( AdjustUltrafiltrationConfirmRequestData ) \ REGISTER_METATYPE( AdjustSalineRequestData ) \ REGISTER_METATYPE( AdjustTreatmentParametersRequestData ) \ + REGISTER_METATYPE( GuiAlertRequestData ) \ /* Response */ \ REGISTER_METATYPE( TreatmentStartResponseData ) \ REGISTER_METATYPE( TreatmentEndResponseData ) \ @@ -231,7 +232,8 @@ REGISTER_METATYPE( AdjustUltrafiltrationEditResponseData ) \ REGISTER_METATYPE( AdjustUltrafiltrationConfirmResponseData ) \ REGISTER_METATYPE( AdjustSalineResponseData ) \ - REGISTER_METATYPE( AdjustTreatmentParametersResponseData ) + REGISTER_METATYPE( AdjustTreatmentParametersResponseData ) \ + REGISTER_METATYPE( GuiAlertResponseData ) //===============================================================================// /*! @@ -445,5 +447,6 @@ ACTION_RECEIVE_SIGNAL( AdjustUltrafiltrationConfirmResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustTreatmentParametersResponseData ) \ ACTION_RECEIVE_SIGNAL( AdjustSalineResponseData ) + //--------------------------------------------------------------------------------// //--------------------------------------------------------------------------------// Index: sources/model/hd/adjustment/MTreatmentAdjustRequests.h =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ sources/model/hd/adjustment/MTreatmentAdjustRequests.h (.../MTreatmentAdjustRequests.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -491,7 +491,6 @@ return MModel::toString("AdjustTreatmentParametersRequest", vParameters); } }; - } typedef Model:: MAdjustPowerOffReq AdjustPowerOffRequestData; Index: sources/view/VAlert.cpp =================================================================== diff -u --- sources/view/VAlert.cpp (revision 0) +++ sources/view/VAlert.cpp (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -0,0 +1,56 @@ +/*! + * + * 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 VAlert.cpp + * \author (last) Peter Lucia + * \date (last) 30-Nov-2020 + * \author (original) Peter Lucia + * \date (original) 30-Nov-2020 + * + */ +#include "VAlert.h" + +// Project + +using namespace Gui; +using namespace View; + +VAlert::VAlert(QObject *parent) : QObject(parent) +{ + // incoming + connect(&_GuiController, SIGNAL(didAlertRequest(GuiAlertRequestData)), + this, SLOT(onActionReceive(GuiAlertRequestData))); + + // outgoing + connect(this, SIGNAL(didAlertResponse(GuiAlertResponseData)), + &_GuiController, SLOT(doAlertResponse(GuiAlertResponseData))); +} + +/*! + * \brief VAlert::doUserAlertRequest + * Called when the user makes a request through an alert dialog + * \param confirmed - (bool) true if user confirms, false if they cancel + */ +void VAlert::doAlertResponse(const bool &confirmed) +{ + GuiAlertResponseData data; + data.confirmed = confirmed; + emit didAlertResponse(data); +} + +/*! + * \brief VAlert::onActionReceive + * Called when a new alert request to show has been received + * \param request - (GuiAlertRequest) the alert data to be shown + */ +void VAlert::onActionReceive(const GuiAlertRequestData &request) +{ + title(request.title); + description(request.description); + didRequestShowAlert(); +} + Index: sources/view/VAlert.h =================================================================== diff -u --- sources/view/VAlert.h (revision 0) +++ sources/view/VAlert.h (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -0,0 +1,60 @@ +/*! + * + * 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 VAlert.h + * \author (last) Peter Lucia + * \date (last) 30-Nov-2020 + * \author (original) Peter Lucia + * \date (original) 30-Nov-2020 + * + */ +#pragma once + +// Qt +#include + +// Project +#include "main.h" +#include "GuiController.h" + +using namespace Model; + +// forward declarations +class tst_views; + +namespace View { + +/*! + * \brief The VAlert class + * \details View for the VAlert Dialog + * + */ +class VAlert: public QObject +{ + Q_OBJECT + + // friends + friend class::tst_views; + +public: + explicit VAlert(QObject *parent = NULL); + +private: + PROPERTY(QString , title, "") + PROPERTY(QString , description, "") + +signals: + void didRequestShowAlert(); + void didAlertResponse(GuiAlertResponseData); + +public slots: + void doAlertResponse(const bool &confirmed); + +private slots: + void onActionReceive(const GuiAlertRequestData &request); +}; +} Index: sources/view/VTreatmentBegin.cpp =================================================================== diff -u -r53134008481fd775533e8988b7436f2f75e47336 -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/view/VTreatmentBegin.cpp (.../VTreatmentBegin.cpp) (revision 53134008481fd775533e8988b7436f2f75e47336) +++ sources/view/VTreatmentBegin.cpp (.../VTreatmentBegin.cpp) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -1,9 +1,35 @@ #include "VTreatmentBegin.h" +// Project +#include "BLEScanner.h" +#include "VTreatmentCreate.h" + +using namespace Gui; using namespace View; -VTreatmentBegin::VTreatmentBegin(QObject *parent) : QObject(parent) { } +VTreatmentBegin::VTreatmentBegin(QObject *parent) : QObject(parent) +{ + // incoming + connect(&_BLEScanner, SIGNAL(didDisconnectFromDevice(QBluetoothDeviceInfo)), + this , SLOT(onDeviceDisconnected())); + connect(&_BLEScanner, SIGNAL(didConnectToDevice(QBluetoothDeviceInfo)), + this , SLOT(onDeviceConnected())); + + connect(&_GuiController, SIGNAL(didActionReceive(HDOperationModeData)), + this, SLOT(onAdjustment(HDOperationModeData))); + + connect(&_GuiController, SIGNAL(didAlertResponse(GuiAlertResponseData)), + this, SLOT(onAdjustment(GuiAlertResponseData))); + + // outgoing + connect(this, SIGNAL(didRequestShowAlert(GuiAlertRequestData)), + &_GuiController, SLOT(doAlertRequest(GuiAlertRequestData))); + + connect(this, SIGNAL(didStartNewTreatment(TreatmentStartRequestData)), + &_GuiController, SLOT(doAdjustment(TreatmentStartRequestData))); +} + /** * \brief VTreatmentBegin::doUserModifiedParameters * Manages enabling / disabling the start treatment button @@ -13,3 +39,71 @@ continueEnabled(true); emit continueEnabledChanged(continueEnabled()); } + +/** + * \brief VCreateTreatment::start + * Called when user is ready to begin a new treatment. + * Implements SRSUI 253, 695 + */ +void VTreatmentBegin::doStartTreatment() { + qDebug() << "Requesting to start a treatment..."; + + GuiAlertRequestData request; + if (!_bleConnected) + { + request.title = tr("The Blood Pressure Cuff is Not Connected"); + request.description = tr("Press 'Confirm' to continue treatment without taking vitals."); + emit didRequestShowAlert(request); + return; + } + + request.title = tr("Ready for Blood Pressure Measurement"); + request.description = tr("Press 'Confirm' once the blood pressure measurement has been taken."); + emit didRequestShowAlert(request); + +} + +/*! + * \brief VTreatmentBegin::doActionReceive + * Slot called when we receive an HD operation mode update + * \param messageData - (HDOperationModeData) contains the HD operation mode + */ +void VTreatmentBegin::onAdjustment(const HDOperationModeData &messageData) +{ + _hdOperationMode = messageData.mOpMode; +} + +/*! + * \brief VTreatmentBegin::onDeviceConnected + * Called when a BLE BP Cuff is connected + */ +void VTreatmentBegin::onDeviceConnected() +{ + _bleConnected = true; +} + +/*! + * \brief VTreatmentBegin::onDeviceDisconnected + * Called when a BLE BP Cuff is disconnected + */ +void VTreatmentBegin::onDeviceDisconnected() +{ + _bleConnected = false; +} + +/*! + * \brief VTreatmentBegin::onAdjustment + * Called when the user has responded to the blood pressure prompt + * \param messageData - (AlertUserRequestData) the message data + */ +void VTreatmentBegin::onAdjustment(const GuiAlertResponseData &messageData) +{ + qDebug() << "Blood Pressure Prompt response: " << messageData.confirmed; + + if (messageData.confirmed) + { + startTreatmentRequest.request = TreatmentStartRequestData::eStartTreatment; + emit didStartNewTreatment(startTreatmentRequest); + } +} + Index: sources/view/VTreatmentBegin.h =================================================================== diff -u -r1f8abdd821041623392d18cf4f80cad9ae1bf246 -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/view/VTreatmentBegin.h (.../VTreatmentBegin.h) (revision 1f8abdd821041623392d18cf4f80cad9ae1bf246) +++ sources/view/VTreatmentBegin.h (.../VTreatmentBegin.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -6,6 +6,7 @@ // Project #include "main.h" +#include "GuiController.h" // forward declarations class tst_views; @@ -24,6 +25,11 @@ // friends friend class ::tst_views; + bool _bleConnected = false; + quint32 _hdOperationMode ; + + TreatmentStartRequestData startTreatmentRequest; + public: explicit VTreatmentBegin(QObject *parent = nullptr); @@ -34,9 +40,18 @@ // coco end protected: PROPERTY(bool, continueEnabled, false) +signals: + void didStartNewTreatment(const TreatmentStartRequestData &data); + void didRequestShowAlert(GuiAlertRequestData); +public slots: + void doStartTreatment(); private slots: void doUserModifiedParameters(); + void onDeviceDisconnected(); + void onDeviceConnected(); + void onAdjustment(const HDOperationModeData &messageData); + void onAdjustment(const GuiAlertResponseData &messageData); }; } #endif // VTREATMENTSTART_H Index: sources/view/VTreatmentCreate.cpp =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ sources/view/VTreatmentCreate.cpp (.../VTreatmentCreate.cpp) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -569,16 +569,6 @@ } /** - * \brief VCreateTreatment::start - * Called when user is ready to begin a new treatment. - */ -void VTreatmentCreate::doStartTreatment() { - qDebug() << "Requesting to start a treatment..."; - startTreatmentRequest.request = TreatmentStartRequestData::eStartTreatment; - emit requestSelectParameters(startTreatmentRequest); -} - -/** * \brief VCreateTreatment::validate * Validates the create new treatment input. * \param vData - the selected TreatmentParametersData Index: sources/view/VTreatmentCreate.h =================================================================== diff -u -rc3a1e077ddeba65709084f9af5dd756741db8b4f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/view/VTreatmentCreate.h (.../VTreatmentCreate.h) (revision c3a1e077ddeba65709084f9af5dd756741db8b4f) +++ sources/view/VTreatmentCreate.h (.../VTreatmentCreate.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -275,7 +275,6 @@ void doFinishedCreate(); void doFinishedConfirm(); void doFinishedPrime(); - void doStartTreatment(); bool doActionReceive(AdjustTreatmentParametersResponseData data); void doActionReceive(const TreatmentStartResponseData &messageData); void doUserModifiedParameters(); Index: sources/view/VView.h =================================================================== diff -u -r3e2866b98a67e772686d5190eacfd4ee437bcd0f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/view/VView.h (.../VView.h) (revision 3e2866b98a67e772686d5190eacfd4ee437bcd0f) +++ sources/view/VView.h (.../VView.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -136,6 +136,7 @@ REGISTER_TYPE( VTreatmentBegin ) \ REGISTER_TYPE( VTreatmentEnd ) \ REGISTER_TYPE( VTreatmentAdjustmentSaline ) \ - REGISTER_TYPE( VVitals ) + REGISTER_TYPE( VVitals ) \ + REGISTER_TYPE( VAlert ) //--------------------------------------------------------------------------------// Index: sources/view/VVitals.cpp =================================================================== diff -u -r3e2866b98a67e772686d5190eacfd4ee437bcd0f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/view/VVitals.cpp (.../VVitals.cpp) (revision 3e2866b98a67e772686d5190eacfd4ee437bcd0f) +++ sources/view/VVitals.cpp (.../VVitals.cpp) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -11,16 +11,16 @@ VVitals::VVitals(QObject *parent) : QObject(parent) { // incoming - connect(&_BLEScanner, SIGNAL(didReceiveBPMeasurement(BLEScanner::bp_measurement)), - this, SLOT(onReceiveBPMeasurement(BLEScanner::bp_measurement))); + connect(&_BLEScanner, SIGNAL(didReceiveBPMeasurement(BLEMeasurementData)), + this, SLOT(onReceiveBPMeasurement(BLEMeasurementData))); } /*! * \brief VVitals::onReceiveBPMeasurement * Private slot that is called when we recieve a blood pressure measurement * \param measurement - (BLEScanner::bp_measurement) the blood pressure measurement */ -void VVitals::onReceiveBPMeasurement(BLEScanner::bp_measurement measurement) +void VVitals::onReceiveBPMeasurement(BLEMeasurementData measurement) { bloodPressureDiastolic (measurement.diastolic); bloodPressureSystolic (measurement.systolic); Index: sources/view/VVitals.h =================================================================== diff -u -r3e2866b98a67e772686d5190eacfd4ee437bcd0f -r666594860f4ea32da9a2bd362d40325b881b11f9 --- sources/view/VVitals.h (.../VVitals.h) (revision 3e2866b98a67e772686d5190eacfd4ee437bcd0f) +++ sources/view/VVitals.h (.../VVitals.h) (revision 666594860f4ea32da9a2bd362d40325b881b11f9) @@ -38,7 +38,7 @@ PROPERTY(quint32, pulseBPM, UNSET) private slots: - void onReceiveBPMeasurement(BLEScanner::bp_measurement measurement); + void onReceiveBPMeasurement(BLEMeasurementData measurement); }; } #endif // VVITALS_H