Index: sources/ApplicationController.cpp =================================================================== diff -u -rc73feffa73c7fe073a7a7581144f5806dfc91beb -r8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision c73feffa73c7fe073a7a7581144f5806dfc91beb) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 8d5fe7d63e3d86e9d89d5f824347d34479e4e9ec) @@ -7,7 +7,7 @@ * * \file ApplicationController.cpp * \author (last) Behrouz NematiPour - * \date (last) 19-Dec-2022 + * \date (last) 19-Jul-2023 * \author (original) Behrouz NematiPour * \date (original) 26-Aug-2020 * @@ -90,6 +90,8 @@ void ApplicationController::initConnections() { + connect(&_post , SIGNAL( didEthernet (bool)), + this , SLOT(onPOSTEthernet (bool))); connect(&_post , SIGNAL( didWiFi (bool)), this , SLOT(onPOSTWiFi (bool))); connect(&_post , SIGNAL( didBluetooth(bool)), @@ -108,6 +110,8 @@ // From GUI connect(&_GuiController , SIGNAL(didActionTransmit(GuiActionType, const QVariantList &)), this , SLOT( onActionTransmit(GuiActionType, const QVariantList &))); + connect(&_GuiController , SIGNAL(didQuitApplication()), + this , SLOT( onQuitApplication())); // From HD/DG connect(&_MessageDispatcher, SIGNAL(didActionReceive(GuiActionType, const QVariantList &)), @@ -134,6 +138,10 @@ connect(&_DeviceController , SIGNAL(didSDCardSpaceTooLow(quint8)), this , SLOT( onSDCardSpaceTooLow(quint8))); + // Configuration Partition + connect(&_DeviceController , SIGNAL(didCryptSetupMount(bool)), + this , SLOT( onCryptSetupMount(bool))); + connect(&_GuiController , SIGNAL(didExportLog (const GuiStringIndexMap &)), this , SLOT( onExportLog (const GuiStringIndexMap &))); connect(&_GuiController , SIGNAL(didExportService (const GuiStringIndexMap &)), @@ -519,6 +527,7 @@ _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]. + //TODO The Settings shall be the Singleton SettingsController and modify the MSettings like the others. Storage::Settings settings; settings.read(); }); @@ -534,12 +543,26 @@ { 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) - emit didSettingsDone(); + // HD POST request + postDoneRequest ( ); + versionsRequest (_post.isDone( )); + // UI is done, let's keep in touch + emit didKeepAliveBegin(); +} - emit didPOSTPass(_post.isDone()); +/*! + * \brief ApplicationController::onPOSTEthernet + * \details sends the Ethernet mac to device controller + */ +void ApplicationController::onPOSTEthernet(bool vPass) { + emit didPOSTEthernet (vPass); + emit didPOSTEthernetData(_post.macEthernet()); } /*! @@ -550,7 +573,10 @@ if (vPass) { _WifiInterface.doStart(); } - emit didPOSTWiFi(vPass); + emit didPOSTWireless (vPass); + emit didPOSTWirelessData(_post.macWireless()); + + //DEBUG qDebug() << " ---------- " << _post.macWireless(); } /*! @@ -564,8 +590,9 @@ } else { _BluetoothInterface.doNotifyStatePOSTError(); - emit didPOSTBluetooth(vPass); } + emit didPOSTBluetooth (vPass); + emit didPOSTBluetoothData (_post.macBluetooth()); } /*! @@ -574,7 +601,8 @@ */ void ApplicationController::onPOSTCloudSync(bool vPass) { - emit didPOSTCloudSync(vPass); + emit didPOSTCloudSync (vPass); + emit didPOSTCloudSyncData("000.000.000.000" /*_post.netCloudSync*/); // not needed and post is not getting it yet.[ApplicationController => DeviceController] } /*! @@ -590,14 +618,23 @@ * \brief ApplicationController::onPOSTDone * \details Sends the POST Final message */ -void ApplicationController::onPOSTDone(bool vPass) { +void ApplicationController::onPOSTDone(bool /*vPass*/) { LOG_DEBUG("ApplicationPOST Done"); + /// in manufacturing or update mode the configurations must reside in /root/home + /// therefore the settings can be initialized after POST. +#ifdef BUILD_FOR_DESKTOP initSettings(); +#else + if ( gEnableManufacturing || gEnableUpdating ) initSettings(); +#endif +} - postDoneRequest(); - - versionsRequest(vPass); +void ApplicationController::onQuitApplication() +{ + //DEBUG qDebug() << metaObject()->className() << __FUNCTION__ << QThread::currentThread(); + emit didQuitApplication(); + qApp->quit(); } /*! @@ -624,6 +661,16 @@ */ void ApplicationController::onstartPOST() { LOG_DEBUG("ApplicationPost Start"); - emit didActionTransmit(GuiActionType::ID_KeepAlive, {}); _post.start(); } + +/*! + * \brief ApplicationController::onCryptSetupMount + * \details It is the slot to handle _DeviceController::didCryptSetupMount signal. + * Tels the settings start initate. + */ +void ApplicationController::onCryptSetupMount(bool /*vPass*/) +{ + // if ( vPass ) // it needs more investigation + initSettings(); +}