Index: sources/ApplicationController.cpp =================================================================== diff -u -r689177edf29dee6f10bebfed42f6bbadeb7ce8a8 -r9febb7ea48512fb5cee8006a93e7cf030c86815d --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 689177edf29dee6f10bebfed42f6bbadeb7ce8a8) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 9febb7ea48512fb5cee8006a93e7cf030c86815d) @@ -89,7 +89,6 @@ */ void ApplicationController::initConnections() { - connect(&_post , SIGNAL( didEthernet (bool)), this , SLOT(onPOSTEthernet (bool))); connect(&_post , SIGNAL( didWiFi (bool)), @@ -112,6 +111,8 @@ this , SLOT( onActionTransmit(GuiActionType, const QVariantList &))); connect(&_GuiController , SIGNAL(didQuitApplication()), this , SLOT( onQuitApplication())); + connect(&_GuiController , SIGNAL(didTreatmentRangesDone(bool)), + this , SLOT( onTreatmentRangesDone(bool))); // From HD/DG connect(&_MessageDispatcher, SIGNAL(didActionReceive(GuiActionType, const QVariantList &)), @@ -159,7 +160,6 @@ connect(&_settingsWatcher, SIGNAL(finished ()), this , SLOT(onSettingsUpdate())); - // Device Signal/Slots DEVICE_APP_INIT_CONNECTIONS_LIST @@ -528,10 +528,10 @@ // which currently is Application_Thread, since the Settings is created in that thread. _Settings; - QFuture mFuture = QtConcurrent::run([=](){ // made the call a lambda to make sure there is no function to accidentally being called, out of thread [developer safety]. + QFuture mFuture = QtConcurrent::run( [=]() -> int { // made the call a lambda to make sure there is no function to accidentally being called, out of thread [developer safety]. //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. Storage::Settings settings; - settings.read(); + return settings.read(); }); _settingsWatcher.setFuture(mFuture); } @@ -546,16 +546,21 @@ onActionReceive(SettingsData()); /// POST /// - // call initialization functions when setting's ready. - _Settings.datetimeFormat(); - emit didSettingsDone( ); // MessageDispatcher -> MessageInterpreter : updateUnhandledMessages - emit didPOSTPass (_post.isDone( )); // GuiController -> GuiView : didPOSTPass(bool) + //call initialization functions when setting's ready. + //TODO move the initSettig in the Application POST since it is part of the post. + _settingsError = _settingsWatcher.result(); + //DEBUG qDebug() << " ***** " << sender() << _settingsError; + _post.isDone( ! _settingsError ); + if ( _settingsError ) { + LOG_APPED_PO(QString("Settings read failed")); + onPOSTFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); + } else { + _Settings.datetimeFormat(); + } - // HD POST request - postDoneRequest ( ); - versionsRequest (_post.isDone( )); - // UI is done, let's keep in touch - emit didKeepAliveBegin(); + // this singal can be emmited here [ others are postponed to the onTreatmentRangesDone ] + // here we know the CRC was fine with not empty configuration and all files can be read. + emit didSettingsDone( ); // MessageDispatcher -> MessageInterpreter : updateUnhandledMessages } /*! @@ -604,16 +609,27 @@ void ApplicationController::onPOSTCloudSync(bool vPass) { emit didPOSTCloudSync (vPass); - emit didPOSTCloudSyncData("000.000.000.000" /*_post.netCloudSync*/); // not needed and post is not getting it yet.[ApplicationController => DeviceController] + emit didPOSTCloudSyncData("" /*_post.netCloudSync*/); // not needed and post is not getting it yet.[ApplicationController => DeviceController] } /*! * \brief ApplicationController::onPOSTFail - * \details sends the Alarm Trigger message, used when the POST Failed. - * \param vAlarmID + * \details Sends the Alarm Trigger message, if the vSend is true, + * or + * Queues the alarms if vSend is false. + * \param vAlarmID - The alarm ID + * \param vSend - False to queue the ValarmID alarm ID, or True to send the list of the queued alarms. */ -void ApplicationController::onPOSTFail(GuiAlarmID vAlarmID) { - emit didActionTransmit(GuiActionType::ID_AlarmTriggered, {vAlarmID ,0,0,0,0,0,0,0}); +void ApplicationController::onPOSTFail(GuiAlarmID vAlarmID, bool vSend) { + static QVector failList; + if ( vSend ) { + for ( auto alarmID : failList ) { + emit didActionTransmit(Gui::GuiActionType::ID_AlarmTriggered, {alarmID ,0,0,0,0,0,0,0}); + } + } + else { + failList.append(vAlarmID); + } } /*! @@ -642,14 +658,11 @@ /*! * \brief ApplicationController::versionsRequest * \details Sends a version request - * \param vPass - condition to request for version if POST is done */ -void ApplicationController::versionsRequest(bool vPass) { - if (vPass) { - AdjustVersionsRequestData adjustVersionsRequestData; - emit didAdjustment(adjustVersionsRequestData); - LOG_DEBUG("POSTInfReq Sent"); - } +void ApplicationController::versionsRequest() { + AdjustVersionsRequestData adjustVersionsRequestData; + emit didAdjustment(adjustVersionsRequestData); + LOG_DEBUG("POSTVersionReq Sent"); } /*! @@ -671,8 +684,13 @@ * \details It is the slot to handle _DeviceController::didCryptSetupMount signal. * Tels the settings start initate. */ -void ApplicationController::onCryptSetupMount(bool /*vPass*/) +void ApplicationController::onCryptSetupMount(bool vPass) { + //DEBUG qDebug() << " ***** " << Q_FUNC_INFO << vPass; + if ( ! vPass ) { + _post.isDone(vPass); + onPOSTFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_SETTINGS_BAD); + } // if ( vPass ) // it needs more investigation initSettings(); } @@ -683,6 +701,29 @@ */ void ApplicationController::onLogIOFail() { - //DEBUG: qDebug()< GuiView : didPOSTPass(bool) +} +