Index: sources/ApplicationPost.cpp =================================================================== diff -u -r64d87d540594252e8039ab2595016d98f1e3cc28 -rcab6f784c0fa71adc3b69c9617da5721ea0daef2 --- sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision 64d87d540594252e8039ab2595016d98f1e3cc28) +++ sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision cab6f784c0fa71adc3b69c9617da5721ea0daef2) @@ -13,36 +13,170 @@ * */ #include "ApplicationPost.h" +// Qt +#include +#include +// Project +#include "FileHandler.h" +#include "StorageGlobals.h" + /*! * \brief ApplicationPost::ApplicationPost * \details Constructor * \param parent - QObject parent owner object. * Qt handles the children destruction by their parent objects life-cycle. */ -ApplicationPost::ApplicationPost(QObject *parent) : QObject(parent) +ApplicationPost::ApplicationPost(QObject *parent) : QObject(parent) { } + +/*! + * \brief ApplicationPost::start + * \details Starting the post application initialization + * \return + */ +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 () + ; + } + emit didPOSTDone(ok); +} +/*! + * \brief ApplicationPost::checkFileSystem + * \details Checks the File System Integrity + * \return false if there is an issue [No Implementation yet (always true)]. + */ +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); + return ok; } /*! - * \brief ApplicationPost::init - * \details Initialization - * \return true + * \brief ApplicationPost::checkCANBus + * \details Checks the CAN Bus driver is loaded and the bus is functional + * \return false if there is an issue. */ -bool ApplicationPost::init() +bool ApplicationPost::checkCANBus() { - return true; + bool ok = _content.contains(_postmsg_canbus); + if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_CANBUS); + return ok; } /*! - * \brief ApplicationPost::start - * \details Starting the post application initialization - * \return + * \brief ApplicationPost::checkDisplay + * \details Checks the display driver is loaded + * \return false if there is an issue [No Implementation yet (always true)]. */ -bool ApplicationPost::start() +bool ApplicationPost::checkDisplay() { - // coco begin validated: Is a placeholder and has not been implemented yet - return true; + 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); + return ok; } -// coco end + +/*! + * \brief ApplicationPost::checkTouchScreen + * \details Checks the touch driver is loaded + * \return false if there is an issue. + */ +bool ApplicationPost::checkTouch() +{ + bool ok = _content.contains(_postmsg_touch); + if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_TOUCH); + return ok; +} + +/*! + * \brief ApplicationPost::checkSDCard + * \details Checks the SD-Card drive is loaded and functional + * \return false if there is an issue. + */ +bool ApplicationPost::checkSDCard() +{ + bool ok = _content.contains(_postmsg_sdcard); + if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SDCARD); + return ok; +} + +/*! + * \brief ApplicationPost::CRC + * \details Checks the RTC driver is loaded and functional + * \return false if there is an issue + */ +bool ApplicationPost::RTC() +{ + bool ok = _content.contains(_postmsg_rtc); + if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_RTC); + return ok; +} + +/*! + * \brief ApplicationPost::checkWiFi + * \details Checks the WiFi driver is loaded and functional + * \return false if there is an issue [No Implementation yet (always true)]. + */ +bool ApplicationPost::checkWiFi() +{ + bool ok = true; + // do the test + if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_WIFI); + return ok; +} + +/*! + * \brief ApplicationPost::checkBluetooth + * \details Checks the Bluetooth driver is loaded and functional + * \return false if there is an issue [No Implementation yet (always false)]. + */ +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); + return ok; +} + +/*! + * \brief ApplicationPost::checkEthernet + * \details Checks the Ethernet driver is loaded and functional. + * \return false if there is an issue [No Implementation yet (always true)]. + */ +bool ApplicationPost::checkEthernet() +{ + 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); + return ok; +} + +/*! + * \brief ApplicationPost::checkSound + * \details Checks the sound driver is loaded. + * \return false if there is an issue [No Implementation yet (always true)]. + */ +bool ApplicationPost::checkSound() +{ + bool ok = true; + // do the test + if (! ok) emit didPOSTFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_SOUND); + return ok; +} +