Index: sources/ApplicationPost.cpp =================================================================== diff -u -r80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803 -r5a9b7ff46df9cecc258f7cb18019a51bca76bce3 --- sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision 80b5e8f1ebb90c03c37d90d90cd2da3bd95d6803) +++ sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision 5a9b7ff46df9cecc258f7cb18019a51bca76bce3) @@ -38,6 +38,8 @@ { QString postLogFileName = QDir::tempPath() + "/" + Storage::POST_LOG; if (Storage::FileHandler::read(postLogFileName, _content)) { + + _isOSVersion = checkOSVersion (); _isShaSum = checkShaSum (); _isCANBus = checkCANBus (); _isDisplay = checkDisplay (); @@ -55,7 +57,9 @@ // 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 () && + _isDone = + isOSVersion () && + isShaSum () && isCANBus () && isDisplay () && isTouch () && @@ -67,7 +71,7 @@ // isEthernet () && // it is being executed to get the information but is not part of the POST failure. // isSound () && isYearCheck () - ; + ; } else { // TODO: Ignored for now but this could be a FileSystem check failure, and the post.log has to always exist. @@ -78,10 +82,55 @@ } /*! - * \brief ApplicationPost::checkShaSum - * \details Checks the File System Integrity - * \return false if there is an issue [Not effects the UI Final POST result for now (always true)]. + * \brief ApplicationPost::checkOSVersion + * \details Checks the OS version + * \return false if the OS version is lower than 0.0.40 which is released for the Cybersecurity.. */ +bool ApplicationPost::checkOSVersion() +{ + QString exrVer("%1\\s*\"\\d+\\.\\d+\\.\\d+\""); + QString exrBld("%1\\s*\"\\d+\""); + + QRegExp regVer(exrVer.arg(_postmsg_osversion)); + QRegExp regBld(exrBld.arg(_postmsg_osbuild )); + QString version; + QString build; + QStringList versions; + quint16 major; + quint16 minor; + quint16 micro; + + // check the statement exists in the long + int rowVer = _content.indexOf (regVer); + int rowBld = _content.indexOf (regBld); Q_UNUSED(rowBld); + bool ok = rowVer >= 0; // found + if ( ! ok ) goto lOut; + + // check the Os version is compatible + version = regVer.cap(0).replace(_postmsg_osversion,"").replace("\"",""); // 0 is the first captured and next if any are the subsets. + build = regBld.cap(0).replace(_postmsg_osbuild ,"").replace("\"",""); // 0 is the first captured and next if any are the subsets. + versions = version.split("."); + major = versions[0].toUInt(); // type, existance, count has been already tested by regex, and was rejected in first check section. + minor = versions[1].toUInt(); // type, existance, count has been already tested by regex, and was rejected in first check section. + micro = versions[2].toUInt(); // type, existance, count has been already tested by regex, and was rejected in first check section. + ok = major >= Storage::OS_VERSION_MAJOR && + minor >= Storage::OS_VERSION_MINOR && + micro >= Storage::OS_VERSION_MICRO ; + if ( ! ok ) goto lOut; + + _osVersion = version + "." + build; + +lOut: + if ( !ok ) emit didFail(Gui::GuiAlarmID::ALARM_ID_HD_UI_POST_FAILURE_OS_VERSION); + emit didOSVersion(ok); + return ok; +} + +/*! + * \brief ApplicationPost::checkOSInfo + * \details Checks if the + * \return it is false if the + */ bool ApplicationPost::checkShaSum() { bool ok = _content.contains(_postmsg_shasum + _postmsg_postfix_passed);