Index: sources/ApplicationPost.cpp =================================================================== diff -u -r20453ac382a122d1dde3c399ed9fcaf8a39b4ad6 -re4a0e2fc4c7ae0cbce0d670772276bf7f5ff3845 --- sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision 20453ac382a122d1dde3c399ed9fcaf8a39b4ad6) +++ sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision e4a0e2fc4c7ae0cbce0d670772276bf7f5ff3845) @@ -18,8 +18,8 @@ #include // Project +#include "Logger.h" #include "FileHandler.h" -#include "StorageGlobals.h" /*! * \brief ApplicationPost::ApplicationPost @@ -36,21 +36,35 @@ */ void ApplicationPost::start() { - bool ok = false; - if (Storage::FileHandler::read(qApp->applicationDirPath() + "/" + Storage::POST_LOG, _content) ) { - ok = checkFileSystem () - && checkCANBus () - && checkDisplay () - && checkTouch () - && checkSDCard () - && RTC () - && checkWiFi () - && checkBluetooth () - && checkEthernet () - && checkSound () - ; + QString postLogFileName = qApp->applicationDirPath() + "/" + Storage::POST_LOG; + if (Storage::FileHandler::read(postLogFileName, _content) ) { + _isFileSystem = checkFileSystem (); + _isCANBus = checkCANBus (); + _isDisplay = checkDisplay (); + _isTouch = checkTouch (); + _isSDCard = checkSDCard (); + _isRtc = checkRtc (); + _isWiFi = checkWiFi (); + _isBluetooth = checkBluetooth (); + _isEthernet = checkEthernet (); + _isSound = checkSound (); + // Please take care that, all of the checks have to be done so they need to be assigned to a variable and then, and them, + // otherwise on the first fail rest will not run by compiler optimization. + _isDone = _isFileSystem && + _isCANBus && + _isDisplay && + _isTouch && + _isSDCard && + _isRtc && + // _isWiFi && // is not mandatory and the device can still be used without it. Alarm will be triggered to notify user in Active Alarm List., + // _isBluetooth && // is not mandatory and the device can still be used without it. Alarm will be triggered to notify user in Active Alarm List., + _isEthernet && + _isSound ; } - emit didPOSTDone(ok); + else { + LOG_EVENT(tr("The POST log file could not be read.")); + } + emit didDone(_isDone); } /*! @@ -61,8 +75,9 @@ bool ApplicationPost::checkFileSystem() { bool ok = true; - // it will be done after consulting as part of CyberSecurity - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_FILESYSTEM); + //TODO: it will be done after consulting as part of CyberSecurity + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_FILESYSTEM); + else emit didFileSystem(); return ok; } @@ -74,7 +89,8 @@ bool ApplicationPost::checkCANBus() { bool ok = _content.contains(_postmsg_canbus); - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_CANBUS); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_CANBUS); + else emit didCANBus(); return ok; } @@ -86,8 +102,9 @@ bool ApplicationPost::checkDisplay() { bool ok = true; - // do the test : not a good test has been found yet. - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_DISPLAY); + //TODO: do the test : not a good test has been found yet. + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_DISPLAY); + else emit didDisplay(); return ok; } @@ -99,7 +116,8 @@ bool ApplicationPost::checkTouch() { bool ok = _content.contains(_postmsg_touch); - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_TOUCH); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_TOUCH); + else emit didTouch(); return ok; } @@ -111,7 +129,8 @@ bool ApplicationPost::checkSDCard() { bool ok = _content.contains(_postmsg_sdcard); - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SDCARD); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SDCARD); + else emit didSDCard(); return ok; } @@ -120,10 +139,11 @@ * \details Checks the RTC driver is loaded and functional * \return false if there is an issue */ -bool ApplicationPost::RTC() +bool ApplicationPost::checkRtc() { bool ok = _content.contains(_postmsg_rtc); - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_RTC); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_RTC); + else emit didRtc(); return ok; } @@ -134,9 +154,9 @@ */ bool ApplicationPost::checkWiFi() { - bool ok = true; - // do the test - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_WIFI); + bool ok = true; //TODO: _content.contains(_postmsg_wifi); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_WIFI); + else emit didWiFi(); return ok; } @@ -147,10 +167,9 @@ */ bool ApplicationPost::checkBluetooth() { - bool ok = true; // This should not stop the FW POST and is only a warning that will show up in the alarm list. - // do the test - // Test : if (! ok) - emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_BLUETOOTH); + bool ok = _content.contains(_postmsg_bluetooth); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_BLUETOOTH); + else emit didBluetooth(); return ok; } @@ -163,7 +182,8 @@ { bool ok = true; // do the test : we are not using this for now since it has been removed from the PRS. - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_ETHERNET); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_ETHERNET); + else emit didEthernet(); return ok; } @@ -176,7 +196,8 @@ { bool ok = true; // do the test - if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SOUND); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SOUND); + else emit didSound(); return ok; }