I am sitting here for hours looking at the code, and I just don't get it. It's about the std::vector canData which is used as a buffer for decoding and encoding data from a CAN DBC parser. The complete example of my problem is here.
Basically there is a value encoded to an array and then decoded again from this array. But the size of this array is always zero and even after clearing the array, although its zero, one can still decode data from it.
Can somebody please explain that to me?
Am I missing something?
unsigned int canIdentifier = 0x100;
std::vector<std::uint8_t> canData;
canData.reserve(4);
network.messages[canIdentifier].signals["multiplexor"].encode(canData, 0);
network.messages[canIdentifier].signals["signal_1"].encode(canData, 0x12);
std::cout << "size: " << canData.size() << std::endl;
canData.clear();
decodeMessage(canIdentifier, canData);
std::cout << "2size: " << canData.size() << std::endl;
Aucun commentaire:
Enregistrer un commentaire