Index: main.cpp =================================================================== diff -u -r84c5373209a1a488c00917995f5553d442d159a4 -r5c15c47de2e809f385e91e6136526020d227cb43 --- main.cpp (.../main.cpp) (revision 84c5373209a1a488c00917995f5553d442d159a4) +++ main.cpp (.../main.cpp) (revision 5c15c47de2e809f385e91e6136526020d227cb43) @@ -7,7 +7,7 @@ * * \file main.cpp * \author (last) Behrouz NematiPour - * \date (last) 03-Aug-2020 + * \date (last) 16-Oct-2020 * \author (original) Behrouz NematiPour * \date (original) 24-Sep-2019 * @@ -79,6 +79,7 @@ bool gDisableUnhandledReport = false ; bool gDisableTimeout = false ; +bool gConsoleoutLogs = false ; bool gConsoleoutFrameInterface = false ; bool gConsoleoutCanInterface = false ; @@ -89,19 +90,26 @@ * Denali * * Options: - * -h, --help Displays this help. - * -v, --version Displays version information. - * -c, --canOut Show the Can Frame Output - * -m, --msgOut Show the Message Output - * -0, --enable-keep-awake Enable send low priority, empty message on - * the CANBus just to keep UI board CAN driver - * awake - * -i, --fake-interval Test fake message interval(ms) - * -f, --fake-message Test fake message data - * will use default sequenced long fake message - * if set to 00(default) - * will used only if correct integer value - * assigned for interval option + * -h, --help Displays this help. + * -v, --version Displays version information. + * -c, --canOut Show the Can Frame Output + * -m, --msgOut Show the Message Output + * -l, --logOut Show the Logs Output + * -0, --enable-keep-awake Enable send low priority, empty message on + * the CANBus just to keep UI board CAN driver + * awake + * -i, --fake-interval Test fake message interval(ms) + * -f, --fake-message Test fake message data + * will use default sequenced long fake message + * if set to 00(default) + * will used only if correct integer value + * assigned for interval option + * -b, --fake-message-seq-at-begin Test fake message sequence at the beginning + * of the frame + * -u, --disable-unhandled-report Disable unhandled messages report as an + * error in the log + * -q, --disable-timeout Disables HD communication timeout + * * \endverbatim */ /*! @@ -127,6 +135,11 @@ QCoreApplication::translate("main", "Show the Message Output")); parser.addOption(optionConsoleoutFrameInterface); + // --- -m : msgOut + QCommandLineOption optionConsoleoutLogs( + QStringList() << "l" << "logOut", + QCoreApplication::translate("main", "Show the Logs Output")); + parser.addOption(optionConsoleoutLogs); // --- -0 : enable-keep-awake (the fast mode) QCommandLineOption optionSendEmptyKeepAwake(QStringList() << "0" << "enable-keep-awake", @@ -145,13 +158,13 @@ QStringList() << "f" << "fake-message", QCoreApplication::translate("main", "Test fake message data\n" "will use default sequenced long fake message if set to 00(default)\n" - "will used only if correct intger value assigned for interval option"), + "will used only if correct integer value assigned for interval option"), QCoreApplication::translate("main", "data")); parser.addOption(optionFakeData); - // --- -b : fake-message-seq-atbegin + // --- -b : fake-message-seq-at-begin QCommandLineOption optionFakeSeqAtBegin( - QStringList() << "b" << "fake-message-seq-atbegin", + QStringList() << "b" << "fake-message-seq-at-begin", QCoreApplication::translate("main", "Test fake message sequence at the beginning of the frame")); parser.addOption(optionFakeSeqAtBegin); @@ -165,12 +178,12 @@ QCoreApplication::translate("main", "Disables HD communication timeout")); parser.addOption(optionDisableTimeout); - // --- parse command lines parser.process(*qApp); gConsoleoutCanInterface = parser.isSet(optionConsoleoutCanInterface ); gConsoleoutFrameInterface = parser.isSet(optionConsoleoutFrameInterface ); + gConsoleoutLogs = parser.isSet(optionConsoleoutLogs ); gDisableUnhandledReport = parser.isSet(optionDisableUnhandledReport ); gDisableTimeout = parser.isSet(optionDisableTimeout ); @@ -193,42 +206,46 @@ } } } + /*! * \brief setApplicationVersion * \details sets up the application version regarding the environment variables * which are set by bamboo and if those are not set value of 0 will be used * and revision(build) version will be set to current date/time. */ void setApplicationVersion() { + bool ver_revis_empty = false; QString ver_major = QString("%1").arg(VER_MAJOR ); QString ver_minor = QString("%1").arg(VER_MINOR ); QString ver_micro = QString("%1").arg(VER_MICRO ); QString ver_revis = QString("%1").arg(VER_REVIS ); QString ver_branch = QString("%1").arg(VER_BRANCH ); - bool isOnMaster = !ver_branch.compare("master"); + if (ver_revis.isEmpty()) { + ver_revis = VER_REVIS_DEV; + ver_revis_empty = true; + } + + const char * masterbranch = "master"; + bool isOnMaster = !ver_branch.compare(masterbranch); if (isOnMaster) { - ver_branch = ""; + ver_branch = ver_revis_empty ? masterbranch : ""; ver_major += '.'; ver_minor += '.'; ver_micro += '.'; - ver_revis += '.'; } else { ver_branch = VER_BRANCH ; - ver_branch += '.'; - ver_major = VER_MAJOR_DEV ; - ver_minor = VER_MINOR_DEV ; - ver_micro = VER_MICRO_DEV ; ver_revis = VER_REVIS_DEV ; } + if ( ! ver_branch.isEmpty()) ver_branch += '.'; QCoreApplication::setApplicationVersion( - QString("%1%2.%3.%4.%5") - .arg(ver_branch) - .arg(ver_major) - .arg(ver_minor) - .arg(ver_micro) - .arg(ver_revis)); + QString("%1%2%3%4%5") + .arg(ver_branch) + .arg(ver_major) + .arg(ver_minor) + .arg(ver_micro) + .arg(ver_revis)); } #ifdef UNIT_TEST @@ -278,7 +295,9 @@ Threads::registerTypes(); //! - Initializing Logger - _Logger.init(Threads::_Logger_Thread); + if(_Logger.init(Threads::_Logger_Thread)) { + _Logger.enableConsoleOut(gConsoleoutLogs); + } LOG_EVENT("UI," + QObject::tr("Application %1 Started,%2") .arg(app.applicationName ()) @@ -321,7 +340,6 @@ //! - Initializing Main Timer _MainTimer.init(); - //! - Initialize the QML Viewer and starts GUI int app_exec = -1; LOG_DEBUG("UI Initializing");