Index: sources/applicationcontroller.cpp =================================================================== diff -u -r5c5fa01738826261e0b3647db6b7b3fc26b04251 -r846a9ebc350e33be4affab3cc4c136248900015d --- sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 5c5fa01738826261e0b3647db6b7b3fc26b04251) +++ sources/applicationcontroller.cpp (.../applicationcontroller.cpp) (revision 846a9ebc350e33be4affab3cc4c136248900015d) @@ -1,29 +1,34 @@ /*! * * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. - * \copyright \n - * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, \n - * IN PART OR IN WHOLE, \n - * WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. \n + * \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 applicationcontroller.cpp - * \date 2019/09/30 - * \author Behrouz NematiPour + * \file applicationcontroller.cpp + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 + * \author (original) Behrouz NematiPour + * \date (original) 24-Sep-2019 * */ #include "applicationcontroller.h" // Qt +#include +#include // Project -#include "guiglobals.h" #include "maintimer.h" -#include "guicontroller.h" #include "messagedispatcher.h" #include "logger.h" -#include "usbwatcher.h" +#include "DriveWatcher.h" #include "filehandler.h" +#include "guicontroller.h" + +using namespace Storage; + /*! * \brief ApplicationController::ApplicationController * \details Constructor @@ -47,7 +52,7 @@ // coco begin validated: The class ApplicationPost has not been implemented Yet. if (!_applicationPost->init()) return false; // coco end - LOG_EVENT(QObject::tr("%1 Initialized").arg(metaObject()->className())); + LOG_EVENT("UI," + tr("%1 Initialized").arg(metaObject()->className())); return true; } @@ -98,25 +103,30 @@ connect(&_MessageDispatcher, SIGNAL(didActionReceive(GuiActionType, const QVariantList &)), this , SLOT( onActionReceive(GuiActionType, const QVariantList &))); + connect(&_MessageDispatcher, SIGNAL(didFailedTransmit(Sequence)), + this , SLOT( onFailedTransmit(Sequence))); + + // USB drive connect(&_GuiController , SIGNAL(didUSBDriveUmount()), this , SLOT( onUSBDriveUmount())); - connect(&_USBWatcher , SIGNAL(didUSBDriveMount ()), + connect(&_DriveWatcher , SIGNAL(didUSBDriveMount ()), this , SLOT( onUSBDriveMount ())); - connect(&_USBWatcher , SIGNAL(didUSBDriveRemove()), + connect(&_DriveWatcher , SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + // SD Card + connect(&_DriveWatcher , SIGNAL(didSDCardStateChange(bool, bool)), + this , SLOT( onSDCardStateChange(bool, bool))); + + connect(&_GuiController , SIGNAL(didExportLog()), this , SLOT( onExportLog())); - connect(&_Logger , SIGNAL(didExport()), + connect(&_Logger , SIGNAL(didExportLogs()), this , SLOT( onExport())); - connect(&_GuiController , SIGNAL(didAdjustBloodDialysateFlows(quint32, quint32)), - this , SLOT( onAdjustBloodDialysateFlows(quint32, quint32))); - - connect(&_GuiController , SIGNAL(didAdjustDuration(quint32)), - this , SLOT( onAdjustDuration(quint32))); - + // ---- Signal/Slots + ADJUST_TRANSMT_MODEL_BRIDGE_CONNECTIONS(_GuiController ) ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(_MessageDispatcher) } @@ -156,6 +166,16 @@ // coco end /*! + * \brief ApplicationController::onFailedTransmit + * Called when we failed to get a response back from the HD + * \param seq - The sequence that failed to send to the HD. + */ +void ApplicationController::onFailedTransmit(Sequence seq) +{ + emit didFailedTransmit(seq); +} + +/*! * \brief Process the requested action * \details Processes the requested action * \param vAction - User requested Action @@ -190,7 +210,7 @@ /*! * \brief ApplicationController::onUSBDriveMount - * \details This is the slot which connects to the _USBWatcher didUSBDriveMount signal + * \details This is the slot which connects to the _DriveWatcher didUSBDriveMount signal * and notifies the other classes (GuiController) by emitting its signal didUSBDriveMount */ void ApplicationController::onUSBDriveMount () @@ -204,7 +224,7 @@ /*! * \brief ApplicationController::onUSBDriveRemove * \details This is the slot which connects to the _GuiController didUSBDriveUmount signal - * and notifies the other classes (USBWatcher) by emitting its signal didUSBDriveUmount + * and notifies the other classes (DriveWatcher) by emitting its signal didUSBDriveUmount */ void ApplicationController::onUSBDriveUmount() { @@ -216,7 +236,7 @@ /*! * \brief ApplicationController::onUSBDriveRemove - * \details This is the slot which connects to the _USBWatcher didUSBDriveRemove signal + * \details This is the slot which connects to the _DriveWatcher didUSBDriveRemove signal * and notifies the other classes (GuiController) by emitting its signal didUSBDriveRemove */ void ApplicationController::onUSBDriveRemove() @@ -228,6 +248,21 @@ // coco end /*! + * \brief ApplicationController::onSDCardStateChange + * \details This is the slot which connects to the _DriveWatcher didSDCardStateChange signal + * and notifies the other classes (GuiController) by emitting its signal didSDCardStateChange + * \param vIsReady - SdCard is Ready + * \param vIsReadOnly - SdCard is ReadOnly + */ +void ApplicationController::onSDCardStateChange(bool vIsReady, bool vIsReadOnly) +{ + // coco begin validated: This needs user interaction to plug-in SD Card + // has been tested manually + emit didSDCardStateChange(vIsReady, vIsReadOnly); +} +// coco end + +/*! * \brief ApplicationController::onExportLog * \details the slot which will be called by UI to so the log export. */ @@ -252,34 +287,6 @@ // coco end /*! - * \brief ApplicationController::onAdjustBloodDialysateFlows - * \details This method transmits the Blood/Dialysate Adjustment Denali message. - * \param vBloodFlow - Blood Flow Rate - * \param vDialysateFlow - Dialysate Flow Rate - * \return void - */ -void ApplicationController::onAdjustBloodDialysateFlows(quint32 vBloodFlow, quint32 vDialysateFlow) -{ - QVariantList mData; - mData += vBloodFlow; - mData += vDialysateFlow; - onActionTransmit(GuiActionType::AdjustBloodDialysateReq, mData); -} - -/*! - * \brief ApplicationController::onAdjustDuration - * \details This method transmits the Blood/Dialysate Adjustment Denali message. - * \param vDuration - Treatment duration adjustment value in minuts - * \return void - */ -void ApplicationController::onAdjustDuration(quint32 vDuration) -{ - QVariantList mData; - mData += vDuration; - onActionTransmit(GuiActionType::AdjustDurationReq, mData); -} - -/*! * \brief ApplicationController::keepAlive * \details This is the message which has to be send over the CANBUS * as an monitor for other nodes on the bus to notify UI is alive @@ -303,7 +310,7 @@ else { mData += static_cast(GuiActionData::NoData); } - onActionTransmit(GuiActionType::KeepAlive, mData); + onActionTransmit(GuiActionType::ID_KeepAlive, mData); #endif }