Index: sources/ApplicationController.cpp =================================================================== diff -u -r20453ac382a122d1dde3c399ed9fcaf8a39b4ad6 -r3e64d98e243484505a44d99b13826097cb6b01eb --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 20453ac382a122d1dde3c399ed9fcaf8a39b4ad6) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) @@ -18,7 +18,6 @@ #include // Project -#include "ApplicationPost.h" #include "MainTimer.h" #include "MessageDispatcher.h" #include "Logger.h" @@ -27,15 +26,18 @@ #include "GuiController.h" #include "Settings.h" #include "MSettings.h" +#include "WifiInterface.h" +#include "BluetoothInterface.h" - /*! * \brief ApplicationController::ApplicationController * \details Constructor * \param parent - QObject parent owner object. * Qt handles the children destruction by their parent objects life-cycle. */ -ApplicationController::ApplicationController(QObject *parent) : QObject(parent) { } +ApplicationController::ApplicationController(QObject *parent) : QObject(parent) { + _post.setParent(this); +} /*! * \brief ApplicationController initializer @@ -46,7 +48,7 @@ _init = true; initConnections(); - LOG_DEBUG("UI," + tr("%1 Initialized").arg(metaObject()->className())); + LOG_DEBUG(tr("%1 Initialized").arg(metaObject()->className())); return true; } @@ -86,6 +88,17 @@ */ void ApplicationController::initConnections() { + + connect(&_post , SIGNAL( didWiFi (bool)), + this , SLOT(onPOSTWiFi (bool))); + connect(&_post , SIGNAL( didBluetooth(bool)), + this , SLOT(onPOSTBluetooth(bool))); + + connect(&_post , SIGNAL( didFail (Gui::GuiAlarmID )), + this , SLOT(onPOSTFail (Gui::GuiAlarmID ))); + connect(&_post , SIGNAL( didDone (bool )), + this , SLOT (onPOSTDone (bool ))); + connect(&_MainTimer , SIGNAL( didTimeout()), this , SLOT(onMainTimerTimeout())); @@ -155,7 +168,7 @@ /*! * \brief ApplicationController::quitThread - * \details Moves this object to main thread to be handled by QApplicaiton + * \details Moves this object to main thread to be handled by QApplication * And to be destroyed there. */ void ApplicationController::quitThread() @@ -489,7 +502,53 @@ onActionReceive(SettingsData()); } + /*! + * \brief ApplicationController::onPOSTWiFi + * \details Starts the WiFi Interface + */ +void ApplicationController::onPOSTWiFi(bool vPass) { + if (vPass) { + _WifiInterface.doStart(); + } +} + +/*! + * \brief ApplicationController::onPOSTBluetooth + * \details Starts the Bluetooth Interface + */ +void ApplicationController::onPOSTBluetooth(bool vPass) { + if (vPass) { + _BluetoothInterface.valid(true); + _BluetoothInterface.doStart(); + } + else { + _BluetoothInterface.doNotifyStatePOSTError(); + } +} + + +/*! + * \brief ApplicationController::onPOSTFail + * \details sends the Alarm Trigger message, used when the POST Failed. + * \param vAlarmID + */ +void ApplicationController::onPOSTFail(GuiAlarmID vAlarmID) { + emit didActionTransmit(GuiActionType::ID_AlarmTriggered, { vAlarmID ,0,0,0,0}); +} + +/*! + * \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"); +} + +/*! * \brief ApplicationController::settingsInit * \details The Settings read function is called in this method. * This callback function for the QCuncurrnent run. @@ -510,15 +569,7 @@ * \return void */ void ApplicationController::onstartPOST() { + LOG_DEBUG("ApplicationPost Start"); emit didActionTransmit(GuiActionType::ID_KeepAlive, {}); - ApplicationPost post; - connect(&post, &ApplicationPost::didPOSTFail, [=] (Gui::GuiAlarmID vAlarmID) { - emit didActionTransmit(GuiActionType::ID_AlarmTriggered, { vAlarmID ,0,0,0,0}); - }); - connect(&post, &ApplicationPost::didPOSTDone, [=] (bool vResult) { - AdjustUIPostFinalResultRequestData data; - data.mResult = vResult; - emit didAdjustment(data); - }); - post.start(); + _post.start(); }