-
-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't get the response.service_data.values #64
Comments
Anyone can help on this? |
Hi, I wouldn't expect you to get a positive answer from your server or a valid data coming back from the UDS client since you just copy/pasted an example code and kept the demonstration codec as is... it's called If you want further assistance, share a raw CAN log Regards |
Hi, |
Hi, Just put 17 instead of 15 in your AsciiCodec and I believe you'll make it work. Last thing, you mentioned DID F194, but everything seems about F190, so I assumed you made a typo. Regards. |
Hi pylessard, |
Hello, friends,
Recently I just found this UDS library and it's very useful for me.
But i am not yet familiar with it.
I tried to follow the example in the document to read the$F190.
But i can't print the correct response and the error as below. and i confirm the actual request and response are correct on CAN BUS.
thank you for your help.
the code as below :
`
from can.interfaces.vector import VectorBus
from udsoncan.connections import PythonIsoTpConnection
from udsoncan.client import Client
import isotp
import udsoncan
import struct
class MyCustomCodecThatShiftBy4(udsoncan.DidCodec):
def encode(self, val):
val = (val << 4) & 0xFFFFFFFF
return struct.pack('<L', val)
isotp_params = {
'stmin': 32,
'blocksize': 8,
'wftmax': 0,
'll_data_length': 8,
'tx_padding': 0,
'rx_flowcontrol_timeout': 1000,
'rx_consecutive_frame_timeout': 1000,
'squash_stmin_requirement': False
}
bus = VectorBus(bustype='vector', app_name='CANoe', channel=[0])
tp_addr = isotp.Address(isotp.AddressingMode.Normal_11bits, txid=0x123, rxid=0x456)
stack = isotp.CanStack(bus=bus, address=tp_addr, params=isotp_params)
conn = PythonIsoTpConnection(stack)
config = dict(udsoncan.configs.default_client_config)
config['data_identifiers'] = {
0xF190: udsoncan.AsciiCodec(15)} # Codec that read ASCII string. We must tell the length of }
with Client(conn, request_timeout=2, config=config) as client:
response = client.read_data_by_identifier(0xF190)
print(response.service_data.values[0xF190])
vin = client.read_data_by_identifier_first(0xF190)
print(vin)
`
The text was updated successfully, but these errors were encountered: