#include "VTreatmentBegin.h" // Project #include "BLEScanner.h" #include "VTreatmentCreate.h" using namespace Gui; using namespace View; 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 */ void VTreatmentBegin::doUserModifiedParameters() { continueEnabled(true); emit continueEnabledChanged(continueEnabled()); } /** * \brief VCreateTreatment::doCheckBLE * Called when the user is ready to check the BLE connection * Implements SRSUI 253, 695, PRS 50 */ void VTreatmentBegin::doCheckBLE() { LOG_DEBUG("Checking BLE Connection..."); GuiAlertRequestData request; request.id = GuiAlertID::ID_Alert_BLE_Connection; // coco begin validated: Has been validated manually if (!_bleConnected) { request.title = tr("The Blood Pressure Cuff is Not Connected"); request.description = tr("Press 'Confirm' to proceed with treatment using a non-Bluetooth connected Blood Pressure Cuff."); 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); } // coco end /*! * \brief VTreatmentBegin::doStartTreatment * Called when the user is ready to start a treatment */ void VTreatmentBegin::doStartTreatment() { LOG_DEBUG("Requesting to start a treatment..."); startTreatmentRequest.request = TreatmentStartRequestData::eStartTreatment; emit didStartNewTreatment(startTreatmentRequest); } /*! * \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() { // coco begin validated: Has been validated manually _bleConnected = true; } // coco end /*! * \brief VTreatmentBegin::onDeviceDisconnected * Called when a BLE BP Cuff is disconnected */ void VTreatmentBegin::onDeviceDisconnected() { // coco begin validated: Has been validated manually _bleConnected = false; } // coco end /*! * \brief VTreatmentBegin::onAdjustment * Called when the user has responded to the blood pressure conection alert * \param messageData - (GuiAlertResponseData) the message data */ void VTreatmentBegin::onAdjustment(const GuiAlertResponseData &messageData) { qDebug() << __FUNCTION__ << messageData.id; // coco begin validated: Has been validated manually if (messageData.id != GuiAlertID::ID_Alert_BLE_Connection) return; // coco end LOG_DEBUG(QString("Blood Pressure Prompt response: %1").arg(messageData.confirmed)); // coco begin validated: Has been validated manually if (messageData.confirmed) { emit didConfirmReadyToStartTreament(); } // coco end }