Index: sources/canbus/messagedispatcher.cpp =================================================================== diff -u -r3aab84456cfbdc4c4f495975ba9b8968eb844309 -r0a2ca0373a422201d5316df8fb891ef38799e3f9 --- sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 3aab84456cfbdc4c4f495975ba9b8968eb844309) +++ sources/canbus/messagedispatcher.cpp (.../messagedispatcher.cpp) (revision 0a2ca0373a422201d5316df8fb891ef38799e3f9) @@ -303,7 +303,7 @@ QByteArray mData; if (! _interpreter.interpretMessage(vActionId, vData, mData)) { - LOG_DEBUG(QString("Incorrect Message, can't be interpreted, %1").arg(vActionId)); // TODO : LOGGINF IMPROVEMENT + LOG_DEBUG(QString("Incorrect Message, can't be interpreted, %1").arg(Format::toHexString(vActionId))); // TODO : LOGGINF IMPROVEMENT return; } Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r3aab84456cfbdc4c4f495975ba9b8968eb844309 -r0a2ca0373a422201d5316df8fb891ef38799e3f9 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 3aab84456cfbdc4c4f495975ba9b8968eb844309) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 0a2ca0373a422201d5316df8fb891ef38799e3f9) @@ -85,9 +85,12 @@ bool MessageInterpreter::isDataLenValid(const Gui::GuiActionType &vActionId, const QVariantList &vData) { - if (vData.count() == 0) { + if (vActionId == Gui::GuiActionType::ID_KeepAlive) + return true; // This message is an exception which is also used to generate fake data and it has a variable length. + + if (vData.length() < payloadLen[vActionId]) { QString mActionIdHexString = Format::toHexString(vActionId); - LOG_DEBUG(QString("Incorrect data for transmit Message with ID '%1'").arg(mActionIdHexString)); + LOG_DEBUG(QString("Incorrect data length for transmit Message with ID '%1'").arg(mActionIdHexString)); return false; } return true; Index: sources/maintimer.cpp =================================================================== diff -u -rd04653f0fbf1ed98178b6c7094beb4ec226a777f -r0a2ca0373a422201d5316df8fb891ef38799e3f9 --- sources/maintimer.cpp (.../maintimer.cpp) (revision d04653f0fbf1ed98178b6c7094beb4ec226a777f) +++ sources/maintimer.cpp (.../maintimer.cpp) (revision 0a2ca0373a422201d5316df8fb891ef38799e3f9) @@ -60,13 +60,39 @@ * \details Checks the date has been changed * \return true if date changed. */ -bool MainTimer::isDateChanged() +bool MainTimer::isDateChanged(bool vIncludeTime) { - static int oy,om,od; // old date - int cy,cm,cd; // current date - QDate::currentDate().getDate(&cy, &cm, &cd); + // old date // current date + static int oy,om,od; int cy,cm,cd; + // old time // current time + static int oH,oM,oS; int cH,cM,cS; + + QDateTime::currentDateTime().date().getDate(&cy, &cm, &cd); + if (vIncludeTime) { + QTime currentTime = QDateTime::currentDateTime().time(); + cH = currentTime.hour(); + cM = currentTime.minute(); + cS = currentTime.second(); + } + if (oy == cy && om == cm && od == cd) { - return false; + if (vIncludeTime) { + if (oH == cH && oM == cM && oS == cS) { + return false; + } + else { + // date + oy = cy; + om = cm; + od = cd; + // time + oH = cH; + oM = cM; + oS = cS; + } + } + else + return false; } else { oy = cy; @@ -86,6 +112,10 @@ void MainTimer::timerEvent(QTimerEvent *) { emit didTimeout(); - if (isDateChanged()) + // I'm not sure how often we need to check for this. + // if it needs to be checked each second pass true + // if it needs to be checked each day pass false + if (isDateChanged(false)) { emit didDateChange(); + } } Index: sources/maintimer.h =================================================================== diff -u -rd04653f0fbf1ed98178b6c7094beb4ec226a777f -r0a2ca0373a422201d5316df8fb891ef38799e3f9 --- sources/maintimer.h (.../maintimer.h) (revision d04653f0fbf1ed98178b6c7094beb4ec226a777f) +++ sources/maintimer.h (.../maintimer.h) (revision 0a2ca0373a422201d5316df8fb891ef38799e3f9) @@ -39,7 +39,7 @@ void quit(); private: - bool isDateChanged(); + bool isDateChanged(bool vIncludeTime = true); signals: void didTimeout(); void didDateChange();