Index: sources/canbus/messageglobals.h =================================================================== diff -u -rbb8f39a014644c70b832dd2a784f62fa9f6b6106 -r5626bf604947efe5a80c9ca51802aab1a70a6939 --- sources/canbus/messageglobals.h (.../messageglobals.h) (revision bb8f39a014644c70b832dd2a784f62fa9f6b6106) +++ sources/canbus/messageglobals.h (.../messageglobals.h) (revision 5626bf604947efe5a80c9ca51802aab1a70a6939) @@ -42,13 +42,27 @@ * So the data collector has to collect this amount of bytes as payload of a message. */ const QHash payloadLen { + // ---- {Gui::GuiActionType::PowerOff , 1 }, {Gui::GuiActionType::PowerOffBroadcast , 0 }, {Gui::GuiActionType::KeepAlive , 255 }, // 0 => 255 to be able to run a multi-frame test. {Gui::GuiActionType::BloodFlow , 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::DialysateInletFlow , 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::DialysateOutletFlow, 7 * 4 }, // 7 parameters each 4bytes {Gui::GuiActionType::TreatmentTime , 3 * 4 }, // 3 parameters each 4bytes + {Gui::GuiActionType::PressureOcclusion , 5 * 4 }, // 5 parameters each 4bytes + + // ---- + {Gui::GuiActionType::AlarmStatus , 4 * 4 + 2 }, // 4 parameters each 4bytes + 1 parameter 2bytes + + // ---- + {Gui::GuiActionType::AdjustBloodDialysateReq , 2 * 4 }, // 2 parameters each 4bytes + {Gui::GuiActionType::AdjustBloodDialysateRsp , 4 * 4 }, // 4 parameters each 4bytes + + // ---- + {Gui::GuiActionType::TreatmentRanges , 6 * 4 }, // 6 parameters each 4bytes + + // ---- {Gui::GuiActionType::String , 255 }, {Gui::GuiActionType::Acknow , 0 }, }; @@ -127,8 +141,22 @@ QByteArray data; bool initialized = false; - bool isEmpty () { return !initialized || !data.length(); } - bool isComplete() { return !isEmpty() && data.length() == length; } + bool isEmpty () { + // coco begin validated:Has been validated manually. + // Since the crc is part of the data and there is no message without crc + // initialized flag and data.length() == 0 became the same. + // I preffer too keep it as it is so the initialization would be independent of the data. + return !initialized || !data.length(); + // coco end + } + bool isComplete() { + // coco begin validated:Has been validated manually. + // Since the crc is part of the data and there is no message without crc + // then a message would never be empty. + // I preffer too keep it as it is so the initialization would be independent of the data. + return !isEmpty() && data.length() == length; + // coco end + } }; typedef QList MessageList;