Index: sources/ApplicationPost.cpp =================================================================== diff -u -raa8f2c87c14c68d1fda6da2540d47144990a596c -r3e64d98e243484505a44d99b13826097cb6b01eb --- sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision aa8f2c87c14c68d1fda6da2540d47144990a596c) +++ sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) @@ -37,48 +37,48 @@ void ApplicationPost::start() { 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 ; + if (Storage::FileHandler::read(postLogFileName, _content)) { + _isShaSum = checkShaSum (); // This is a fault. Will always return true for now. Alarm will be triggered to notify user in Active Alarm List. There is a comment in the class definition about some ideas later. + _isCANBus = checkCANBus (); + _isDisplay = checkDisplay (); + _isTouch = checkTouch (); + _isSDCard = checkSDCard (); + _isRtc = checkRtc (); + _isWiFi = checkWiFi (); // is not mandatory and the device can still be used without it. Alarm will be triggered to notify user in Active Alarm List. + _isBluetooth = checkBluetooth (); // is not mandatory and the device can still be used without it. Alarm will be triggered to notify user in Active Alarm List. + _isEthernet = checkEthernet (); // this is not a Fault and not required the application to stop. No Alarm will be triggered. + _isSound = checkSound (); // this is not a Fault and not required the application to stop. No Alarm will be triggered. + // WARNING: + // all of the checks have to be done, + // although some are not failing the final result, + // so they need to be assigned to a variable and then, AND(&&) them, + // otherwise on the first fail rest of the checks will not run by compiler optimization. + _isDone = _isShaSum && + _isCANBus && + _isDisplay && + _isTouch && + _isSDCard && + _isRtc ; } else { + // TODO: Ignored for now but this could be a FileSystem check failure, and the post.log has to always exist. + // _done = false; LOG_EVENT(tr("The POST log file could not be read.")); } emit didDone(_isDone); } /*! - * \brief ApplicationPost::checkFileSystem + * \brief ApplicationPost::checkShaSum * \details Checks the File System Integrity - * \return false if there is an issue [No Implementation yet (always true)]. + * \return false if there is an issue [Not effects the UI Final POST result for now (always true)]. */ -bool ApplicationPost::checkFileSystem() +bool ApplicationPost::checkShaSum() { - bool ok = true; - //TODO: it will be done after consulting as part of CyberSecurity - if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_FILESYSTEM); - emit didFileSystem(ok); - return ok; + bool ok = _content.contains(_postmsg_shasum); + if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SHASUM); + emit didShaSum(ok); + return true;// ok; //TODO: always true for now. Look at the class to-do note. } /*! @@ -150,11 +150,11 @@ /*! * \brief ApplicationPost::checkWiFi * \details Checks the WiFi driver is loaded and functional - * \return false if there is an issue [No Implementation yet (always true)]. + * \return false if there is an issue. */ bool ApplicationPost::checkWiFi() { - bool ok = true; //TODO: _content.contains(_postmsg_wifi); + bool ok = _content.contains(_postmsg_wifi); if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_WIFI); emit didWiFi(ok); return ok; @@ -163,7 +163,7 @@ /*! * \brief ApplicationPost::checkBluetooth * \details Checks the Bluetooth driver is loaded and functional - * \return false if there is an issue [No Implementation yet (always false)]. + * \return false if there is an issue. */ bool ApplicationPost::checkBluetooth() { @@ -176,7 +176,7 @@ /*! * \brief ApplicationPost::checkEthernet * \details Checks the Ethernet driver is loaded and functional. - * \return false if there is an issue [No Implementation yet (always true)]. + * \return false if there is an issue [Removed from the PRS (always true)]. */ bool ApplicationPost::checkEthernet() { @@ -200,4 +200,3 @@ emit didSound(ok); return ok; } -