A Diagnostic over IP (DoIP) client implementing ISO-13400-2.
Project description
doipclient is a pure Python 3 Diagnostic over IP (DoIP) client which can be used for communicating with modern ECU’s over automotive ethernet. It implements the majority of ISO-13400 (2019) from the perspective of a short-lived synchronous client. The primary use case is to serve as a transport layer implementation for the udsoncan library. The code is published under MIT license on GitHub (jacobschaer/python-doipclient).
Documentation
The documentation is available here : https://python-doipclient.readthedocs.io/
Requirements
Python 3.6+
Installation
using pip:
pip install doipclient
Running Tests from source
using pytest:
pip install pytest pytest
Example
Updated version of udsoncan’s example using python_doip instead of IsoTPSocketConnection
import SomeLib.SomeCar.SomeModel as MyCar
import udsoncan
from doipclient import DoIPClient
from doipclient.connectors import DoIPClientUDSConnector
from udsoncan.client import Client
from udsoncan.exceptions import *
from udsoncan.services import *
udsoncan.setup_logging()
ecu_ip = '127.0.0.1'
ecu_logical_address = 0x00E0
doip_client = DoIPClient(ecu_ip, ecu_logical_address)
conn = DoIPClientUDSConnector(doip_client)
with Client(conn, request_timeout=2, config=MyCar.config) as client:
try:
client.change_session(DiagnosticSessionControl.Session.extendedDiagnosticSession) # integer with value of 3
client.unlock_security_access(MyCar.debug_level) # Fictive security level. Integer coming from fictive lib, let's say its value is 5
client.write_data_by_identifier(udsoncan.DataIdentifier.VIN, 'ABC123456789') # Standard ID for VIN is 0xF190. Codec is set in the client configuration
print('Vehicle Identification Number successfully changed.')
client.ecu_reset(ECUReset.ResetType.hardReset) # HardReset = 0x01
except NegativeResponseException as e:
print('Server refused our request for service %s with code "%s" (0x%02x)' % (e.response.service.get_name(), e.response.code_name, e.response.code))
except InvalidResponseException, UnexpectedResponseException as e:
print('Server sent an invalid payload : %s' % e.response.original_payload)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for doipclient-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dcdfc1744b03b030c49fc6b5b9faf5aa6452795604dbd4d43671f955ea226c4 |
|
MD5 | e376b6a6666294db03b274ee4fb27b8b |
|
BLAKE2b-256 | 24354c7a0a7e4a87c7d3e4fb9f55247ebdacddbe559ff786f064a61c6ba1de77 |
Hashes for doipclient-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e895d80bcefd5d3865f467bedbdaf3065e404d0f65a820e1fa257d319fa6f6d2 |
|
MD5 | 71c876c4ee6f899dc5d00b10f6b8dc69 |
|
BLAKE2b-256 | a02044b0520d39c32bf776f813855c884dd96aaa955311cb874cba7e3ed531d5 |