uds_connect
uds_connect is a Python package for interacting with UDS (Unified Diagnostic Services) over various CAN interfaces, such as peak, kvaser, and vector.
Installation
pip install uds_connect
Example Usage
from uds_connect import initialize_uds, send_with_retry
# Define the driver type, request ID, and response ID
driver_type = "kvaser" # Options: 'peak', 'kvaser', 'vector'
request_id = 0x7D2
response_id = 0x7D3
# Additional parameters based on the driver type
additional_params = {
# "device": "PCAN_USBBUS1", # For 'peak' driver
"channel": 0, # For 'kvaser' or 'vector' drivers
"bitrate": 500000, # For 'kvaser' driver
# "app_name": "BALCAN" # For 'vector' driver
}
# Initialize the UDS instance with the specified configuration
uds_instance = initialize_uds(driver_type, request_id, response_id, **additional_params)
# UDS requests
vin_number = send_with_retry(uds_instance, [0x22, 0xF1, 0x90])
hex_file = send_with_retry(uds_instance, [0x22, 0xF1, 0x11])
assembly_part_num = send_with_retry(uds_instance, [0x22, 0xF1, 0x87])
hw_serial_number = send_with_retry(uds_instance, [0x22, 0xF1, 0x8C])
# Format responses by removing the first three bytes (header)
formatted_vin = vin_number[3:]
formatted_hex = hex_file[3:]
formatted_assembly_num = assembly_part_num[3:]
formatted_hw_serial_num = hw_serial_number[3:]
# Convert byte data to a readable string format
result_vin = ''.join(chr(num) for num in formatted_vin)
result_hex = ''.join(chr(num) for num in formatted_hex)
result_assembly_num = ''.join(chr(num) for num in formatted_assembly_num)
result_serial_num = ''.join(chr(num) for num in formatted_hw_serial_num)
# Collect vehicle data in a dictionary
vehicle_data = {
'vin_number': result_vin,
'hex_file_name': result_hex,
'assembly_part_number': result_assembly_num,
'hw_serial_number': result_serial_num
}
print(vehicle_data)
Metadata
Release files for uds-connect 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uds_connect-1.0.tar.gz | 46.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uds_connect-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 137.6 kB
Release files / uds_connect-1.0.tar.gz
| Download URL | uds_connect-1.0.tar.gz |
|---|---|
| Size | 46.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07d1addc9493cd634d52768f2a3d24c3832a784515e9a043fe3a43a63b398fd0
|
|
BLAKE2b-256 checksum How to use checksums |
51db560c9b6608f1403f045947b5142665395b5aa28bc7b20c3cc52d42266cf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|
Release files / uds_connect-1.0-py3-none-any.whl
| Download URL | uds_connect-1.0-py3-none-any.whl |
|---|---|
| Size | 91.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59b692cadf48c4bc87a4bb6fc5ecd79ea4983b0819bece7af6865fb37f76f1fa
|
|
BLAKE2b-256 checksum How to use checksums |
676d8fcd55f85c8de495d2054dbd53b985522467c6ab13bf6adc00d9b6849715
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.6
|