Index: sources/ApplicationPost.h =================================================================== diff -u -r3f555c49ddd2c983f469709e3c001d0e76159248 -r6c6f1f5d466badd9b4fd67be7c907234c342b2a2 --- sources/ApplicationPost.h (.../ApplicationPost.h) (revision 3f555c49ddd2c983f469709e3c001d0e76159248) +++ sources/ApplicationPost.h (.../ApplicationPost.h) (revision 6c6f1f5d466badd9b4fd67be7c907234c342b2a2) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file ApplicationPost.h - * \author (last) Behrouz NematiPour - * \date (last) 26-Aug-2020 - * \author (original) Behrouz NematiPour - * \date (original) 26-Aug-2020 + * \file ApplicationPost.h + * \author (last) Vy + * \date (last) 13-Apr-2023 + * \author (original) Behrouz NematiPour + * \date (original) 26-Aug-2020 * */ #pragma once @@ -20,33 +20,135 @@ // Project #include "GuiGlobals.h" +/*! + * \brief The ApplicationPost class + * \details The Application POST class is checking for the list of POST items which has been done during the boot-up, + * from withing the run.sh and looks into the post.log to make sure the check items are passed. + * Among the list POST items: + * - Application checksum + * - CANBus + * - Display + * - Touch + * - SDCard + * - RTC + * - WiFi + * - Bluetooth + * - Ethernet + * - Sound + * + * Two items: + * - Ethernet + * - Sound + * are not faults and will not even send the AlarmTrigger. + * + * Two items: + * - WiFi + * - Bluetooth + * are two faults and will send the AlarmTrigger, but will not affect the UI POST final result. + * + * One item: + * - Application checksum + * for now is only done during boot-up and if the checksum is not correct then the UI Application will not even run. + * \todo Later could be a good idea to run another Application, that shows the Fault Screen only (something like a Red Screen Of Death). + * + */ class ApplicationPost : public QObject { Q_OBJECT QString _content; - const char *_postmsg_canbus ="CANBus passed" ; - const char *_postmsg_sdcard ="SD-CARD passed" ; - const char *_postmsg_touch ="Touch passed" ; - const char *_postmsg_rtc ="RTC passed" ; + // WARNING: these variables has to match with the ones in the run.sh. + const QString _postmsg_postfix_passed = " passed" ; // POSTMSG_POSTFIX_PASSED=" passed" + const QString _postmsg_postfix_failed = " failed" ; // POSTMSG_POSTFIX_FAILED=" failed" - // tests // Severity - bool checkFileSystem (); // HIGH : ALARM_ID_UI_POST_FAILURE_FILESYSTEM - bool checkCANBus (); // HIGH : ALARM_ID_UI_POST_FAILURE_CANBUS - bool checkDisplay (); // HIGH : ALARM_ID_UI_POST_FAILURE_DISPLAY - bool checkTouch (); // HIGH : ALARM_ID_UI_POST_FAILURE_TOUCH - bool checkSDCard (); // HIGH : ALARM_ID_UI_POST_FAILURE_SDCARD - bool RTC (); // MEDIUM : ALARM_ID_UI_POST_FAILURE_RTC - bool checkWiFi (); // LOW : ALARM_ID_UI_POST_FAILURE_WIFI - bool checkBluetooth (); // LOW : ALARM_ID_UI_POST_FAILURE_BLUETOOTH - bool checkEthernet (); // NONE : ALARM_ID_UI_POST_FAILURE_ETHERNET : this is not a Fault and not required the application to stop. - bool checkSound (); // NONE : ALARM_ID_UI_POST_FAILURE_SOUND : this is not a Fault and not required the application to stop. + const QString _postmsg_canbus = "CANBus" ; // POSTMSG_CANBUS="CANBus" + const QString _postmsg_sdcard = "SD-CARD" ; // POSTMSG_SDCARD="SD-CARD" + const QString _postmsg_touch = "Touch" ; // POSTMSG_TOUCH="Touch" + const QString _postmsg_rtc = "RTC" ; // POSTMSG_RTC="RTC" + const QString _postmsg_wifi = "WiFi" ; // POSTMSG_WIFI="WiFi" + const QString _postmsg_bluetooth = "Bluetooth" ; // POSTMSG_BLUETOOTH="Bluetooth" + const QString _postmsg_shasum = "App shasum" ; // POSTMSG_SHASUM="App shasum" + const QString _postmsg_cloudsync = "CloudSync" ; // POSTMSG_CLOUDSYNC="CloudSync" + const quint8 _macAddrssLen = 17 ; // ff:ff:ff:ff:ff:ff + const quint8 _macAppearLen = 200 ; // the mac address shall be found within the next 200 characters. + const QString _devEthernet = "eth0:" ; + const QString _devWireless = "wlan0:" ; + const QString _devBluetooth = "hci0:" ; + const QString _macEthernetLabel = "link/ether " ; // the last space is important + const QString _macWirelessLabel = "link/ether " ; // the last space is important + const QString _macBluetoothLabel = "BD Address: "; // the last space is important + QString _macEthernet = "" ; + QString _macWireless = "" ; + QString _macBluetooth = "" ; + + const int _yearMinimum = 2022 ; // The year to check for minimum + + // tests // Severity + bool _isShaSum = false ; // HIGH: fault: ALARM_ID_UI_POST_FAILURE_SHASUM + bool _isCANBus = false ; // HIGH: fault: ALARM_ID_UI_POST_FAILURE_CANBUS + bool _isDisplay = false ; // HIGH: fault: ALARM_ID_UI_POST_FAILURE_DISPLAY : Not known way to test, other than visual check + bool _isTouch = false ; // HIGH: fault: ALARM_ID_UI_POST_FAILURE_TOUCH + bool _isSDCard = false ; // HIGH: fault: ALARM_ID_UI_POST_FAILURE_SDCARD + bool _isRtc = false ; // HIGH: fault: ALARM_ID_UI_POST_FAILURE_RTC + bool _isWiFi = false ; // HIGH: : ALARM_ID_UI_POST_FAILURE_WIFI + bool _isBluetooth = false ; // HIGH: : ALARM_ID_UI_POST_FAILURE_BLUETOOTH + bool _isCloudSync = false ; // HIGH: : ALARM_ID_UI_POST_FAILURE_CLOUDSYNC + bool _isEthernet = false ; // HIGH: : ALARM_ID_UI_POST_FAILURE_ETHERNET : this is not a Fault and not required the application to stop. + bool _isSound = false ; // HIGH: : ALARM_ID_UI_POST_FAILURE_SOUND : this is not a Fault and not required the application to stop. + bool _isYearCheck = false ; // HIGH: : ALARM_ID_HD_UI_POST_FAILURE_INVALID_YEAR + bool _isDone = false ; + + bool checkShaSum (); + bool checkCANBus (); + bool checkDisplay (); + bool checkTouch (); + bool checkSDCard (); + bool checkRtc (); + bool checkWiFi (); + bool checkBluetooth (); + bool checkCloudSync (); + bool checkEthernet (); + bool checkSound (); + bool checkYear (); + public: + bool isShaSum () const { return _isShaSum ; } + bool isCANBus () const { return _isCANBus ; } + bool isDisplay () const { return _isDisplay ; } + bool isTouch () const { return _isTouch ; } + bool isSDCard () const { return _isSDCard ; } + bool isRtc () const { return _isRtc ; } + bool isWiFi () const { return _isWiFi ; } + bool isBluetooth () const { return _isBluetooth ; } + bool isCloudSync () const { return _isCloudSync ; } + bool isEthernet () const { return _isEthernet ; } + bool isSound () const { return _isSound ; } + bool isYearCheck () const { return _isYearCheck ; } + bool isDone () const { return _isDone ; } + + QString macEthernet () const { return _macEthernet ; } + QString macWireless () const { return _macWireless ; } + QString macBluetooth () const { return _macBluetooth ; } + +public: explicit ApplicationPost(QObject *parent = nullptr); void start(); signals: - void didPOSTFail(Gui::GuiAlarmID vAlarmID); - void didPOSTDone(bool vResult ); + void didShaSum (bool vPass); + void didCANBus (bool vPass); + void didDisplay (bool vPass); + void didTouch (bool vPass); + void didSDCard (bool vPass); + void didRtc (bool vPass); + void didWiFi (bool vPass); + void didBluetooth (bool vPass); + void didCloudSync (bool vPass); + void didEthernet (bool vPass); + void didSound (bool vPass); + void didYearCheck (bool vPass); + + void didFail(Gui::GuiAlarmID vAlarmID); + void didDone(bool vPass); };