Index: denali.pro.user =================================================================== diff -u -r9ae3b0d6624904693329309aaf8ff02784c17184 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- denali.pro.user (.../denali.pro.user) (revision 9ae3b0d6624904693329309aaf8ff02784c17184) +++ denali.pro.user (.../denali.pro.user) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -1,14 +1,14 @@ - + EnvironmentId {67370740-e20f-4fc6-be45-6652e866a8bf} ProjectExplorer.Project.ActiveTarget - 1 + 0 ProjectExplorer.Project.EditorSettings @@ -89,7 +89,7 @@ Qt 5.12.5 (iMX8) Qt 5.12.5 (iMX8) {5d6458ef-f917-4aef-a092-c77bbe106149} - 1 + 0 0 0 @@ -373,7 +373,7 @@ 1 false - -u + -u -c 3768 false true @@ -1490,7 +1490,7 @@ true false - /home/denali/Projects/tmp/build/denali-Desktop_Qt_5_12_5_GCC_64bit-Debug + 1 Index: main.cpp =================================================================== diff -u -r9ae3b0d6624904693329309aaf8ff02784c17184 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- main.cpp (.../main.cpp) (revision 9ae3b0d6624904693329309aaf8ff02784c17184) +++ main.cpp (.../main.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -371,7 +371,7 @@ LOG_DEBUG("UI Initializing"); if ( startGui() ) { LOG_DEBUG("UI Initialized"); - _ApplicationController .startPOST(); + // _ApplicationController .startPOST(); app_exec = app.exec(); } Index: sources/ApplicationController.cpp =================================================================== diff -u -r338575f7f1856c99fbc3c0cb59391fc23601c89b -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 338575f7f1856c99fbc3c0cb59391fc23601c89b) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -130,6 +130,9 @@ connect(&_GuiController , SIGNAL(didExportLog()), this , SLOT( onExportLog())); + connect(&_GuiController , SIGNAL(didGuiReadyNotify()), + this , SLOT( onGuiReadyNotify())); + connect(&_Logger , SIGNAL(didExportLogs()), this , SLOT( onExport ())); @@ -574,3 +577,11 @@ emit didActionTransmit(GuiActionType::ID_KeepAlive, {}); _post.start(); } + +void ApplicationController::onGuiReadyNotify() +{ + LOG_DEBUG("ApplicationPost Start"); + emit didActionTransmit(GuiActionType::ID_KeepAlive, {}); + _MainTimer.start(); + _post.start(); +} Index: sources/ApplicationController.h =================================================================== diff -u -rcbb246d6efa242f927f88ac5da518dedb2d63320 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/ApplicationController.h (.../ApplicationController.h) (revision cbb246d6efa242f927f88ac5da518dedb2d63320) +++ sources/ApplicationController.h (.../ApplicationController.h) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -98,6 +98,8 @@ void onExportLog (); void onExport (); + void onGuiReadyNotify(); + void onFailedTransmit(Sequence seq); void onSettingsInit(); Index: sources/ApplicationPost.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/ApplicationPost.cpp (.../ApplicationPost.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -36,36 +36,40 @@ */ void ApplicationPost::start() { - QString postLogFileName = qApp->applicationDirPath() + "/" + Storage::POST_LOG; - 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.")); - } + // QString postLogFileName = qApp->applicationDirPath() + "/" + Storage::POST_LOG; + _isDone = true; emit didDone(_isDone); + return; + + // 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); } /*! @@ -115,7 +119,7 @@ */ bool ApplicationPost::checkTouch() { - bool ok = _content.contains(_postmsg_touch); + bool ok = true; // _content.contains(_postmsg_touch); if (! ok) emit didFail(Gui::GuiAlarmID::ALARM_ID_UI_POST_FAILURE_TOUCH); emit didTouch(ok); return ok; Index: sources/MainTimer.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/MainTimer.cpp (.../MainTimer.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/MainTimer.cpp (.../MainTimer.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -115,6 +115,8 @@ */ void MainTimer::timerEvent(QTimerEvent *) { + if ( ! _running ) return; + #ifndef DISABLE_ACKNOW_CHECKIN_MESSAGE_LOG emit didTimeout(); #endif Index: sources/MainTimer.h =================================================================== diff -u -rfc329c788fe9453983072bee937ccbc95b4ed6e4 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/MainTimer.h (.../MainTimer.h) (revision fc329c788fe9453983072bee937ccbc95b4ed6e4) +++ sources/MainTimer.h (.../MainTimer.h) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -36,9 +36,14 @@ static const int _interval = 1000; //ms + bool _running = false; + public: bool init(); void quit(); + inline void start() { + _running = true; + } private: bool isDateChanged(bool vIncludeTime = false); Index: sources/canbus/CanInterface.cpp =================================================================== diff -u -r59fc5195a10eeb83ac60cf32a9123fb9c9f8ec8e -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/canbus/CanInterface.cpp (.../CanInterface.cpp) (revision 59fc5195a10eeb83ac60cf32a9123fb9c9f8ec8e) +++ sources/canbus/CanInterface.cpp (.../CanInterface.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -17,6 +17,7 @@ // Qt #include #include +#include // stl #include @@ -286,10 +287,10 @@ view = _canDevice->interpretErrorFrame(vFrame); } else { - view = vFrame.payload().toHex('.').replace(QByteArray("a5"),QByteArray("\033[1;33mA5\033[0m")); + view = vFrame.payload().toHex('.').replace(QByteArray("A5"),QByteArray("\033[1;33mA5\033[0m")); } // the fprintf is used for the colored output - fprintf(stderr, "%s %s %s %i %s\n", vFrameCount.toLatin1().constData(), time.toLatin1().constData(), flags.toLatin1().constData(), vFrame.frameId(), view.toLatin1().constData()); + fprintf(stderr, "%s %s %s %s %i %s\n", QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzzzzz").toLatin1().constData(), vFrameCount.toLatin1().constData(), time.toLatin1().constData(), flags.toLatin1().constData(), vFrame.frameId(), view.toLatin1().constData()); } // coco end Index: sources/canbus/MessageBuilder.cpp =================================================================== diff -u -rfc329c788fe9453983072bee937ccbc95b4ed6e4 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/canbus/MessageBuilder.cpp (.../MessageBuilder.cpp) (revision fc329c788fe9453983072bee937ccbc95b4ed6e4) +++ sources/canbus/MessageBuilder.cpp (.../MessageBuilder.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -15,6 +15,7 @@ #include "MessageBuilder.h" // Qt +#include // Project #include "Logger.h" @@ -442,31 +443,36 @@ qDebug() << " "; return; } + QString datetime = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss.zzzzzz"); QByteArray view; + view.append(datetime); // coco begin validated: printPayload and specially vUseColor is for debugging purposes and has been validated manually. if (vUseColor) { QList byteList; - byteList = vPayload.toHex('.').split('.'); + byteList = vPayload.toHex('.').toUpper().split('.'); for (int i = 0; i < byteList.length(); i++) { if (vIsHeader) { - if(i == 0) { + if(i == 0) { // A5 byteList[i] = QByteArray("\033[32m") + byteList[i].constData(); } - if (i == 1 || i == 2) { + if (i == 1 || i == 2) { // sequence byteList[i] = QByteArray("\033[33m") + byteList[i].constData(); } - if (i > 2) { + if (i == 3 || i == 4) { // message id + byteList[i] = QByteArray("\033[35m") + byteList[i].constData(); + } + if (i > 4) { byteList[i] = QByteArray("\033[36m") + byteList[i].constData() + QByteArray("\033[0m"); } } else { byteList[i] = QByteArray("\033[36m") + byteList[i].constData() + QByteArray("\033[0m"); } } - view = Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + byteList.join('.'); + view += Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + byteList.join(' '); // the fprintf is used for the colored output fprintf(stderr, "%s\n", view.constData()); } else { - view = Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + vPayload.toHex('.'); + view += Format::toHexString(vCan_Id, false, eLenChannelDigits).toLatin1() + " " + vPayload.toHex(' '); // the fprintf is used for the colored output fprintf(stderr, "%s\n", view.constData()); } Index: sources/canbus/MessageDispatcher.cpp =================================================================== diff -u -rcbb246d6efa242f927f88ac5da518dedb2d63320 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision cbb246d6efa242f927f88ac5da518dedb2d63320) +++ sources/canbus/MessageDispatcher.cpp (.../MessageDispatcher.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -17,6 +17,7 @@ // Qt #include #include +#include // Project #include "Logger.h" @@ -159,6 +160,7 @@ */ void MessageDispatcher::onFrameReceive(Can_Id vCan_Id, const QByteArray &vPayload) { + //DEBUG: qDebug().noquote() << QDateTime::currentDateTime().toString("(yyyy-MM-dd HH:mm:ss.zzzzzz)") + " can0 " + QString::number(vCan_Id,16).rightJustified(3, '0') + " [8] " + Format::toHexByteArray(vPayload, ' '); // Append a message to the list // coco begin validated: if empty (first condition) is true, it must never check for the complete (second condition) // because if the list is empty there is no last() item Index: sources/gui/GuiController.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/gui/GuiController.cpp (.../GuiController.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/gui/GuiController.cpp (.../GuiController.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -325,6 +325,11 @@ } // coco end +void GuiController::doGuiReadyNotify() +{ + emit didGuiReadyNotify(); +} + /*! * \brief GuiController::didFailedTransmit * \details Raises an HD communication timeout alarm if communication with HD is lost. Index: sources/gui/GuiController.h =================================================================== diff -u -rfc329c788fe9453983072bee937ccbc95b4ed6e4 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/gui/GuiController.h (.../GuiController.h) (revision fc329c788fe9453983072bee937ccbc95b4ed6e4) +++ sources/gui/GuiController.h (.../GuiController.h) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -74,6 +74,7 @@ void doUSBDriveUmount(); // UI => OS void doExportLog (); // UI => OS + void doGuiReadyNotify(); private slots: // Should be private for thread safety and is connected internally. void onActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG @@ -101,6 +102,8 @@ void didExportLog(); void didExport (); + void didGuiReadyNotify(); + // Device controller signal slots connection DEVICE_GUI_BRIDGE_DEFINITION_LIST Index: sources/gui/GuiView.cpp =================================================================== diff -u -rfc329c788fe9453983072bee937ccbc95b4ed6e4 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/gui/GuiView.cpp (.../GuiView.cpp) (revision fc329c788fe9453983072bee937ccbc95b4ed6e4) +++ sources/gui/GuiView.cpp (.../GuiView.cpp) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -72,6 +72,9 @@ // From UI : Export Log connect(this , SIGNAL(didExportLog()), &_GuiController, SLOT( doExportLog())); + + connect(this , SIGNAL(didGuiReadyNotify()), + &_GuiController, SLOT( doGuiReadyNotify())); } /*! @@ -224,6 +227,11 @@ } // coco end +void GuiView::doGuiReadyNotify() +{ + emit didGuiReadyNotify(); +} + /*! * \brief GuiView::onSDCardSpaceChange * \details SD Card storage space parameter change slot. Index: sources/gui/GuiView.h =================================================================== diff -u -r61f16c988a159401c92730b4cbfca5085c77222f -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/gui/GuiView.h (.../GuiView.h) (revision 61f16c988a159401c92730b4cbfca5085c77222f) +++ sources/gui/GuiView.h (.../GuiView.h) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -81,6 +81,7 @@ void doActionTransmit(GuiActionType vAction, const QVariant &vData); // UI => HD/DG void doUSBDriveUmount(); void doExportLog (); + void doGuiReadyNotify(); signals: void didActionReceive (GuiActionType vAction, const QVariantList &vData); // UI <= HD/DG @@ -92,5 +93,8 @@ void didExportLog(); void didExport (); + + void didGuiReadyNotify(); + }; } Index: sources/gui/qml/main.qml =================================================================== diff -u -r161d1431cc3507cd430f54af6aa47dab5145d472 -rf2db5c985e5c0ae7835a69eff43bfc537e6dd2fc --- sources/gui/qml/main.qml (.../main.qml) (revision 161d1431cc3507cd430f54af6aa47dab5145d472) +++ sources/gui/qml/main.qml (.../main.qml) (revision f2db5c985e5c0ae7835a69eff43bfc537e6dd2fc) @@ -317,5 +317,7 @@ timeout : _alarmItem.timeout backgroundFading : vHDOperationMode.fault } - + Component.onCompleted: { + _GuiView.doGuiReadyNotify() + } }