Code Monkey home page Code Monkey logo

Comments (6)

pylessard avatar pylessard commented on June 5, 2024

No need to encode the data when requesting for a read. You need to decode when receiving the response

If you need to do a read and pass data, then what you are doing is not standard UDS. Assign a DID to each IO, or use DynamicDID.

from python-udsoncan.

m31L3r avatar m31L3r commented on June 5, 2024

You are probably right that it's non standard UDS. But that's the way it was implemented on the ECU, so I have to deal with it.
I programmed a workaround, but thanks for your reply anyways.

from python-udsoncan.

pylessard avatar pylessard commented on June 5, 2024

You may want to use this feature

https://udsoncan.readthedocs.io/en/latest/udsoncan/client.html#overriding-the-output

from python-udsoncan.

m31L3r avatar m31L3r commented on June 5, 2024

Thanks for the hint. I tried it but it doesn't really satisfy me like adding this snippet from WriteDataByIdentifier to ReadDataByIdentifier:

req.data = struct.pack('>H', did)  # encode DID number
if codec.__class__ == DidCodec and isinstance(value, tuple):
    req.data += codec.encode(*value)    # Fixes issue #29
else:
    req.data += codec.encode(value, cls._sid)
return req

Simply for the reason that I can add additional arguments to the encode function

from python-udsoncan.

pylessard avatar pylessard commented on June 5, 2024

Okay sounds good. Drawback is that you have to maintain it and you'll eventually get out of sync with updates.
You could get something not so far by passing a function to the override_payload method. Using a partial function, you can always make sure that the list of codec is available to that function. Then you recraft your payload with your custom logic and the client interpret the response like if it was a normal response.

Anyhow, you know what's best for your case.
Cheers

from python-udsoncan.

m31L3r avatar m31L3r commented on June 5, 2024

Haven't thought about that tbh.
But this seems to work quite nicely and not having to maintain it is actually a big plus.

Thanks again

from python-udsoncan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.