How to read a UDS Service Response via EVENT
Posted: Wed 10. Apr 2019, 12:14
Hi to all,
I trigger a service request via UDSApi.SvcReadDataByIdentifier(). The PID/LEV is 0xFD 0x54.
The reception of the response (33Bytes) workes fine with UDSApi.WaitForService().
However I want the reception to be event driven.
The event fires ok, in the eventhandler I try to pick out the right message by
a) multiple calls of UDSApi.Read() until the result is TPUDSStatus.PUDS_ERROR_NO_MESSAGE
b) checking each received message, for the appropriate type to hold my data
I think TPUDSMessageType.PUDS_MESSAGE_TYPE_INDICATION is an indicator for coming data...
However I get 4 messages with the following content:
Message 1:
MSGTYPE = PUDS_MESSAGE_TYPE_CONFIRM
LEN = 3
DATA = 0x22 0xFD 0x54
Message 2:
MSGTYPE = PUDS_MESSAGE_TYPE_INDICATION
LEN = 33
DATA = 0x62 0xFD 0x54 0xFF 0x4E 0x01 ---> the next bytes ARE NOT INITIALIZED !!!
Message 3:
MSGTYPE = PUDS_MESSAGE_TYPE_CONFIRM
LEN = 33
DATA = 0x62 0xFD 0x54 0xFF 0x4E 0x01 ---> the data is correct until the end
Message 4:
MSGTYPE = PUDS_MESSAGE_TYPE_CONFIRM
LEN = 0
DATA = not initialized
So effectivly I get 3! messages with type PUDS_MESSAGE_TYPE_CONFIRM.
What is the best way to filter out the correct message containing the data?
Thanks again for your help
Andy
I trigger a service request via UDSApi.SvcReadDataByIdentifier(). The PID/LEV is 0xFD 0x54.
The reception of the response (33Bytes) workes fine with UDSApi.WaitForService().
However I want the reception to be event driven.
The event fires ok, in the eventhandler I try to pick out the right message by
a) multiple calls of UDSApi.Read() until the result is TPUDSStatus.PUDS_ERROR_NO_MESSAGE
b) checking each received message, for the appropriate type to hold my data
I think TPUDSMessageType.PUDS_MESSAGE_TYPE_INDICATION is an indicator for coming data...
However I get 4 messages with the following content:
Message 1:
MSGTYPE = PUDS_MESSAGE_TYPE_CONFIRM
LEN = 3
DATA = 0x22 0xFD 0x54
Message 2:
MSGTYPE = PUDS_MESSAGE_TYPE_INDICATION
LEN = 33
DATA = 0x62 0xFD 0x54 0xFF 0x4E 0x01 ---> the next bytes ARE NOT INITIALIZED !!!
Message 3:
MSGTYPE = PUDS_MESSAGE_TYPE_CONFIRM
LEN = 33
DATA = 0x62 0xFD 0x54 0xFF 0x4E 0x01 ---> the data is correct until the end
Message 4:
MSGTYPE = PUDS_MESSAGE_TYPE_CONFIRM
LEN = 0
DATA = not initialized
So effectivly I get 3! messages with type PUDS_MESSAGE_TYPE_CONFIRM.
What is the best way to filter out the correct message containing the data?
Thanks again for your help
Andy