Index: sources/gui/guicontroller.cpp =================================================================== diff -u -r057d3ef4e29c63235040c5cfe8c6421ef7787d6a -r846a9ebc350e33be4affab3cc4c136248900015d --- sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 057d3ef4e29c63235040c5cfe8c6421ef7787d6a) +++ sources/gui/guicontroller.cpp (.../guicontroller.cpp) (revision 846a9ebc350e33be4affab3cc4c136248900015d) @@ -1,15 +1,16 @@ /*! - * + * * 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 - * - * \file guicontroller.cpp - * \date 2019/09/30 - * \author Behrouz NematiPour - * + * \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 guicontroller.cpp + * \author (last) Behrouz NematiPour + * \date (last) 25-Aug-2020 + * \author (original) Behrouz NematiPour + * \date (original) 24-Sep-2019 + * */ #include "guicontroller.h" @@ -56,7 +57,7 @@ { // coco begin validated: Application termination is not correctly done in coco!!! // it has been tested and works perfectly fine in normal run. - quitThread(); + quitThread(); // validated } // coco end @@ -73,14 +74,25 @@ // From OS : USB Drive has been removed physically. + // USB drive connect(&_ApplicationController, SIGNAL(didUSBDriveMount ()), this , SLOT( onUSBDriveMount ())); connect(&_ApplicationController, SIGNAL(didUSBDriveRemove()), this , SLOT( onUSBDriveRemove())); + // SD card + connect(&_ApplicationController, SIGNAL(didSDCardStateChange(bool,bool)), + this , SLOT( onSDCardStateChange(bool,bool))); + + // Export connect(&_ApplicationController, SIGNAL(didExport()), this , SLOT( onExport())); + // transmission fail + connect(&_ApplicationController, SIGNAL(didFailedTransmit(Sequence)), + this , SLOT( onFailedTransmit(Sequence))); + + // ---- Signal/Slots ACTION_RECEIVE_MODEL_BRIDGE_CONNECTIONS(_ApplicationController) } @@ -117,7 +129,7 @@ if ( ! _thread ) return; // runs in thread - moveToThread(qApp->thread()); + moveToThread(qApp->thread()); // validated } // coco end @@ -131,7 +143,7 @@ initConnections(); - LOG_EVENT(QObject::tr("%1 Initialized").arg(metaObject()->className())); + LOG_EVENT("UI," + tr("%1 Initialized").arg(metaObject()->className())); return true; } @@ -148,7 +160,10 @@ */ void GuiController::doActionTransmit(GuiActionType vAction, const QVariantList &vData) { + // coco begin validated: This is a sample code and currently does nothing + // The handleTransmit is a place holder and currently has not been used. if (! handleTransmit(vAction, vData)) { + // coco end emit didActionTransmit(vAction, vData); } } @@ -173,7 +188,7 @@ // Process the GuiView Request. // It can be processed in GuiController take action and notify GuiView switch (vAction) { - case GuiActionType::PowerOff: + case GuiActionType::ID_PowerOff: //qApp->quit(); // GUI Controller decides (loop back) @@ -249,6 +264,21 @@ // coco end /*! + * \brief GuiController::onSDCardStateChange + * \details emits didSDCardStateChange signal to notify other classes (GuiView) + * , the SD Card state has been changed. + * \param vIsReady - SdCard is Ready + * \param vIsReadOnly - SdCard is ReadOnly + */ +void GuiController::onSDCardStateChange(bool vIsReady, bool vIsReadOnly) +{ + // coco begin validated: This needs user interaction to plug-out the SD Card + // has been tested manually + emit didSDCardStateChange(vIsReady, vIsReadOnly); +} +// coco end + +/*! * \brief GuiController::onExport * \details The slot which will be called to notify the export is done * by emitting the didExport signal. @@ -273,3 +303,20 @@ emit didExportLog(); } // coco end + +/*! + * \brief GuiController::didFailedTransmit + * Raises an HD communication timeout alarm if communication with HD is lost. + * \param seq - Sequence that failed to transmit + */ +void GuiController::onFailedTransmit(Sequence seq) +{ + Q_UNUSED(seq); + AlarmStatusData data; + data.mState = GuiAlarmPriority::ALARM_PRIORITY_HIGH; // Alarm priority + data.mTop = GuiAlarmID::ALARM_ID_HD_COMM_TIMEOUT; // Alarm ID + data.mMuteTimeout = 0; // Alarm timeout + data.mEscalatesIn = 0; // Alarm Escalate Time Period + data.mFlags = QBitArray(16, false); // 16 QBitArray of flags, if needed + emit didActionReceive(data); +}