Index: sources/ApplicationController.cpp =================================================================== diff -u -r4fd6a7d7801d91ffbce9e8d4b54900224f6a0fac -r0eb3d05f90d7ed90eadfab6c0c1db76fa2a70fb6 --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 4fd6a7d7801d91ffbce9e8d4b54900224f6a0fac) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 0eb3d05f90d7ed90eadfab6c0c1db76fa2a70fb6) @@ -111,8 +111,8 @@ this , SLOT( onActionTransmit(GuiActionType, const QVariantList &))); connect(&_GuiController , SIGNAL(didQuitApplication()), this , SLOT( onQuitApplication())); - connect(&_GuiController , SIGNAL(didTreatmentRangesIncorrect()), - this , SLOT(onTreatmentRangesIncorrect())); + connect(&_GuiController , SIGNAL(didTreatmentRangesDone(bool)), + this , SLOT( onTreatmentRangesDone(bool))); // From HD/DG connect(&_MessageDispatcher, SIGNAL(didActionReceive(GuiActionType, const QVariantList &)), @@ -528,11 +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; - int settingReadErr = settings.read(); - _settingsReadComplete = (settingReadErr == Storage::Settings::Settings_Error::eError_None); + return settings.read(); }); _settingsWatcher.setFuture(mFuture); } @@ -547,17 +546,21 @@ onActionReceive(SettingsData()); /// POST /// - // call initialization functions when setting's ready. - bool isPOSTComplete = _post.isDone() && _settingsReadComplete; - _Settings.datetimeFormat(); - emit didSettingsDone( ); // MessageDispatcher -> MessageInterpreter : updateUnhandledMessages - emit didPOSTPass (isPOSTComplete); // 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 (isPOSTComplete); - // 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 } /*! @@ -606,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); + } } /*! @@ -644,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"); } /*! @@ -673,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(); } @@ -685,17 +701,29 @@ */ void ApplicationController::onLogIOFail() { - //DEBUG: qDebug()< GuiView : didPOSTPass(bool) }