pylessard / python-udsoncan

Python implementation of UDS (ISO-14229) standard.
MIT License
564 stars 195 forks source link

ReadDataByIdentifier.py modified to handle DID containing multiple signals with the same data type #225

Closed yangyixizg closed 4 months ago

yangyixizg commented 4 months ago

When use rdbi and the DID constains multiple signals with the same data type (e.g. sint16), the offset and the val-tuple-concatenation have to be modified. In my main file, the DID is configured with: config['data_identifiers'] = {'default': '>H', 0x4FD3: udsoncan.DidCodec('>h')} The DID 0x4FD3 contains 2 signals of the same data type e.g. sint16. Or find other method to handle the rdbi when DID contains multiple signals of the same data type, and how to handle it when the signals have different data types?

pylessard commented 4 months ago

Hi, I am sorry, but I will not accept this Pull Request. I think you have misunderstood how to use that service.

If your data has a custom type, write your own codec. It's all documented

https://udsoncan.readthedocs.io/en/latest/udsoncan/examples.html#reading-a-did-with-readdatabyidentifier https://udsoncan.readthedocs.io/en/latest/udsoncan/helper_classes.html#didcodec

yangyixizg commented 3 months ago

Thank you for your hints, you are right, I have to create my own codec.

pylessard commented 3 months ago

You can use pack string such as "HH" if you have 2 values also

yangyixizg commented 3 months ago

Yes exactly, I did it and it returned the desired respond data, thank you!