Index: sources/ApplicationController.cpp =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -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 &)), @@ -146,9 +154,6 @@ connect(&_Logger , SIGNAL(didExportStat (quint32, const QString &, quint8)), this , SLOT( onExportStat (quint32, const QString &, quint8))); - // Settings - move to application thread - connect(this, SIGNAL(didSettingsInit()), - this, SLOT( onSettingsInit())); connect(&_settingsWatcher, SIGNAL(finished ()), this , SLOT(onSettingsUpdate())); @@ -502,31 +507,30 @@ } // disabled coco end + +void ApplicationController::postDoneRequest() +{ + AdjustUIPostFinalResultRequestData data; + data.mResult = _post.isDone(); + emit didAdjustment(data); +} + /*! * \brief ApplicationController::initSettings * \details The external method available to request for initializing the settings * To start the task in Application Tread, emits a signal which will call a slot to take care of the execution. */ void ApplicationController::initSettings() { - // this emit guaranties that the slot will be called in the application thread - // also the signal is private so it will be used internally only. - emit didSettingsInit({}); -} - -/*! - * \brief ApplicationController::onSettingsInit - * \details The slot which will be called to start the settings initialization in Application thread. - * This method also initializes the Settings model singleton object to let it live in the Application thread. - * To start the setting initialization QConcurrent is used with QFuture to signal the Application when it's done. - */ -void ApplicationController::onSettingsInit() -{ // That is enough to call to the I function here to create the object in the thread that Settings is leaving in, // which currently is Application_Thread, since the Settings is created in that thread. _Settings; - QFuture mFuture = QtConcurrent::run(this, &ApplicationController::settingsInit); + 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(); + }); _settingsWatcher.setFuture(mFuture); } @@ -539,21 +543,40 @@ { 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(); } /*! + * \brief ApplicationController::onPOSTEthernet + * \details sends the Ethernet mac to device controller + */ +void ApplicationController::onPOSTEthernet(bool vPass) { + emit didPOSTEthernet (vPass); + emit didPOSTEthernetData(_post.macEthernet()); +} + +/*! * \brief ApplicationController::onPOSTWiFi * \details Starts the WiFi Interface */ void ApplicationController::onPOSTWiFi(bool vPass) { if (vPass) { _WifiInterface.doStart(); } - emit didPOSTWiFi(vPass); + emit didPOSTWireless (vPass); + emit didPOSTWirelessData(_post.macWireless()); + + //DEBUG qDebug() << " ---------- " << _post.macWireless(); } /*! @@ -567,8 +590,9 @@ } else { _BluetoothInterface.doNotifyStatePOSTError(); - emit didPOSTBluetooth(vPass); } + emit didPOSTBluetooth (vPass); + emit didPOSTBluetoothData (_post.macBluetooth()); } /*! @@ -577,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] } /*! @@ -593,15 +618,21 @@ * \brief ApplicationController::onPOSTDone * \details Sends the POST Final message */ -void ApplicationController::onPOSTDone(bool vPass) { - AdjustUIPostFinalResultRequestData data; - data.mResult = vPass; - emit didAdjustment(data); - LOG_DEBUG("ApplicationPost Done"); +void ApplicationController::onPOSTDone(bool /*vPass*/) { + LOG_DEBUG("ApplicationPOST Done"); - versionsRequest(vPass); + /// in manufacturing mode the configurations must reside in /root/home + /// therefore the settings can be initialized after POST. + if ( gEnableManufacturing ) initSettings(); } +void ApplicationController::onQuitApplication() +{ + //DEBUG qDebug() << metaObject()->className() << __FUNCTION__ << QThread::currentThread(); + emit didQuitApplication(); + qApp->quit(); +} + /*! * \brief ApplicationController::versionsRequest * \details Sends a version request @@ -616,17 +647,6 @@ } /*! - * \brief ApplicationController::settingsInit - * \details The Settings read function is called in this method. - * This callback function for the QCuncurrnent run. - */ -void ApplicationController::settingsInit() -{ - Storage::Settings settings; - settings.read(); -} - -/*! * \brief ApplicationController::onstartPOST * \details The POST entry point * - Sends the first async check-in to the HD to let HD know it can start it's POST and UI is ready to communicate. @@ -637,6 +657,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(); +}