mercedes-benz / odxtools

odxtools is a collection of utilities to interact with the diagnostic functionality of automotive electronic control units using python
MIT License
171 stars 70 forks source link

Properly support decoding NRC-CONST parameters #314

Closed andlaus closed 2 months ago

andlaus commented 3 months ago

if a negative response contains an NRC-CONST parameter, where the parameter's value is not in the list of expected values, the response is not applicable and decoding should be stopped at this point. (Thus, NRC-CONST parameters are a multiplexer mechanism which filters responses based on the value of some other parameter.)

This patch implements this by introducing a new DecodeMismatch exception which is raised whenever a NRC-CONST parameter which exhibits an unexpected value is encountered. The higher-level routines for decoding responses then ignore these exceptions when appropriate. IMO, this solution is a bit sub-optimal because it uses exceptions for flow control in normal operation, but alternative implementations would be far more complex.

Andreas Lauser <andreas.lauser@mercedes-benz.com>, on behalf of MBition GmbH. Provider Information

andlaus commented 3 months ago

@kayoub5: do you consider this to be merge-ready with the latest modifications?

andlaus commented 2 months ago

@kayoub5: barring objections or approvals, I will merge this PR this Thursday or Friday...