Closed Sayahimed closed 2 years ago
Hi, Yes that is correct and part of the library? Can't really understand your question. You should write the code to receive the can frames and then send the frame data to this function. As the example on the main readme says.
thank you for your answer
this is the start of the function please read the comments
void isotp_on_can_message(IsoTpLink link, uint8_t data, uint8_t len) {
IsoTpCanMessage message; // here we declare an empty message variable that's ok
int ret;
if (len < 2 || len > 8) {
return;
}
memcpy(message.as.data_array.ptr, data, len);
memset(message.as.data_array.ptr + len, 0, sizeof(message.as.data_array.ptr) - len);
switch (message.as.common.type) { /* and here we us the common.type of the message !!! is that is correct ? the message variable is already empty yes ?*/
It's correct? It is a union struct defined in isotp_defines.h
Yes, the code is correct.
Why is "message.as.common.type" evaluated as a "switch" when no value is assigned to it?
hello everyone , message in isotp_on_can_message function is declared in the function and it is used just afer the declaration can anyone tell me message.as.common.type when it was declared ?