Comments (11)
ok, I think I got it...
config['p2_timeout'] = 3
worked.
from python-udsoncan.
and now the next question:
config['exception_on_negative_response'] = False
has no effect. I'm still getting "ReadDataByIdentifier service execution returned a negative response ConditionsNotCorrect (0x22)" - what am I doing wrong now?
from python-udsoncan.
Hi
send_request
is an internal method of the client, not meant to be used by the user.
Use read_data_by_identifier
instead. Look at this example, much cleaner than what you did.
You can find the reason of your issue here: https://github.com/pylessard/python-udsoncan/blob/master/udsoncan/client.py#L404
Each user exposed methods are decorated with @standard_error_management
, applying the configuration rules.
from python-udsoncan.
Good morning Pier-Yves,
thank you very much for your fast reponse! In our 'main application' we are using the user-exposed read_data_by_identifier
and it is working very well and comfortably. But as far as I understood, this method requires a codec which might be a raw codec but which postulates the awareness of the data length?
In my current case this is a scan application where we do not know if the requested datapoint even exists, and if it does, how many bytes it will return. So I used the mentioned solution found by @surt91 (thank you Hendrik!!)
Is there a better way to do this (find out the data length and the existence)?
from python-udsoncan.
Hmm, I see
There is no method to request a DID without reading it.
There is a non-standard trick requested by a user a while ago that I implemented. I assume he was trying to do the same as you.
You can raise a special exception in the codec length function. The parser will receive that and consume the whole payload. Obviously, you can't do that when reading many DIDs in random order.
https://udsoncan.readthedocs.io/en/latest/udsoncan/helper_classes.html#didcodec
Maybe I could add a peek
method that request a DID without decoding the response. That would be cleaner I think
from python-udsoncan.
On the other hand, you can send the raw request/response yourself, but you will loose some intelligence implemented by the client, like timeout handling and "busy" response handing
Something like this could do (not tested)
dummy_did_config = {
0x123:'h' # Dummy codec. No decode/encode actually happens while crafting the request.
}
req = services.ReadDataByIdentifier.make_request(0x123, dummy_did_config)
conn.send(req)
data = conn.wait_frame(timeout=5)
response = Response.from_payload(data)
# No call to ReadDataByIdentifier.interpret_response(). No decoding of the did happens, so we're good.
if response.positive:
print("did exist")
from python-udsoncan.
thank you! I will give that a try when I will find some time. Currently I'm trapping the negative response exception and am fine with Hendriks solution so far. thank you again very much for your support!!
from python-udsoncan.
Want to try this branch?
https://github.com/pylessard/python-udsoncan/tree/allow-peek-did
response = client.test_data_identifier(0x1234)
response.service_data
will be None because the response is not parsed
from python-udsoncan.
Hi Pier Yves!
Thank you for the work! As soon as possible I will give it a try (right now I have to do some work 'for money'. far behind with...).
Greetings!
Phil
from python-udsoncan.
I might merge anyway. The feature seems enough.
Reopen if you think it is necessary
from python-udsoncan.
Fixed in #204
from python-udsoncan.
Related Issues (20)
- cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py) HOT 8
- Act as server and parse python-can messages HOT 6
- No data received: [TimeoutException] Problem HOT 12
- ReadDataByIdentifier: no codec.encode() ? HOT 6
- Security access SAPR response not correctly interpreted HOT 3
- WriteDataByIdentifier service execution returned a negative response IncorrectMessageLengthOrInvalidFormat (0x13) when data length is correct HOT 4
- Adding parameter to Communication Control Service(0x28) HOT 10
- SecurityAccess mishandes a level value of 0 HOT 3
- SocketConnection cannot be closed HOT 7
- P2 timer issue on client.transfer_data(block_number, data HOT 22
- Runtime Error: Connection is not open HOT 2
- TimeoutError: timed out HOT 3
- Problem with waiting time to response longer than 1,658 seconds HOT 2
- isotp error handler not propagated to uds connection HOT 3
- Unable to read continuous frames HOT 1
- TimeoutException and request timeout not respected? HOT 9
- Slow response on Windows for transfer data HOT 11
- udsoncan.exceptions.TimeoutException: Did not receive response in time. P2 timeout time has expired HOT 13
- Can I use multiple RX addresses ? HOT 9
- Transport layer frame capture problem HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-udsoncan.