Index: sources/canbus/messageinterpreter.cpp =================================================================== diff -u -r61d776c2405c22848f1182cba903477d44e7163f -rbf645acccabb7b5a84801620c4f7fa0b0e6878e0 --- sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision 61d776c2405c22848f1182cba903477d44e7163f) +++ sources/canbus/messageinterpreter.cpp (.../messageinterpreter.cpp) (revision bf645acccabb7b5a84801620c4f7fa0b0e6878e0) @@ -49,13 +49,17 @@ bool MessageInterpreter::notify(const Message &vMessage, QVariantList &vData, Gui::GuiActionType vIdCheck) { bool ok = false; - TModel mModel; + TModel tModel; if ( ! isValidMessage(vMessage, vIdCheck) ) return ok; - ok = mModel.fromByteArray(vMessage.data); - mModel.toVariantList(vData); - if ( ! ok ) return false; - emit didActionReceive(mModel.data()); - logReceivedMessage(mModel); + ok = tModel.fromByteArray(vMessage.data); + tModel.toVariantList(vData); + // coco begin validated : Tested manually. This code will never go false + // because the isValidMessage is catching errors. + // only is checking here for developer safty if logic has changed. + if ( ! ok ) return false; + // coco end + emit didActionReceive(tModel.data()); + logReceivedMessage(tModel); DEBUG_RECEIVE_SIGNAL(vIdCheck, typeid(TModel).name()) return ok; } @@ -178,18 +182,18 @@ int count = vData.length(); switch (vActionId) { // notice we are in transmit mode - case Gui::GuiActionType::ID_Acknow: + case Gui::GuiActionType::ID_Acknow: // len: 0, can have zero len break; // No data, Just registered - case Gui::GuiActionType::ID_KeepAlive: + case Gui::GuiActionType::ID_KeepAlive: // len: 255, can have any len if ( count ) { // this message has a variable length vPayload = Format::fromVariant(vData[0]); } LOG_EVENT(mSenderID + QString("CheckIn")); break; - case Gui::GuiActionType::ID_RawData: + case Gui::GuiActionType::ID_RawData: // len: 255, can have any len if ( count ) { // this message has a variable length vPayload = Format::fromVariant(vData[0]); } @@ -269,14 +273,12 @@ case eChlid_HD_Alarm: case eChlid_HD_Sync : ok = interpretMessage_HD(vMessage, vData); break; - // coco-begin-validated: Is a placeholder and There is no definition/implementation of DG communication with UI. case eChlid_DG_UI : - case eChlid_DG_Alarm: + // case eChlid_DG_Alarm: // commented out for now. Currentlyh there is no message in this category. case eChlid_DG_Sync : ok = interpretMessage_DG(vMessage, vData); break; default: break; - // coco-end } return ok; } @@ -437,14 +439,6 @@ emit didActionReceive(mData.data()); return ok; - - // --- an example of unit test --- // - // Types::Flags flag; - // int i = 0; - // QByteArray ba; - // ba += 0x83; ba += 0xf8; ba += 0x28; ba += 0xa1; - // Types::getBits(ba, i, flag, 32); - // qDebug() << '@' << flag << flag.toString() << ba; } /*!