Quickstart
All steps required to start working with this package:
See also
Installation
pip install -U py-uds
See also
Define Addressing Information
This step depends on network type used.
Example for CAN:
import uds ecu_can_ai = uds.can.addressing.NormalCanAddressingInformation( rx_physical_params={"can_id": 0x7E8}, tx_physical_params={"can_id": 0x7E0}, rx_functional_params={"can_id": 0x7E8}, tx_functional_params={"can_id": 0x7DF})
Create Transport Interface
This step depends on network type and network manager used.
Example for CAN and python-can:
# we assume steps from previous examples were performed from can import Bus can_bus = Bus( interface="kvaser", channel=0, receive_own_messages=True, bitrate=500_000, fd=True, data_bitrate=4_000_000) ti = uds.can.PyCanTransportInterface( network_manager=can_bus, addressing_information=ecu_can_ai)
Send and Receive Packets
This step depends on network type used.
Example for CAN:
# we assume steps from previous examples were performed # define example packet to send (depends on network type - example for CAN bus) sf = uds.can.CanPacket(packet_type=uds.can.CanPacketType.SINGLE_FRAME, payload=[0x3E, 0x00], **ecu_can_ai.tx_functional_params) # send defined packet sent_packet_record = ti.send_packet(sf) # receive message received_packet_record = ti.receive_packet(timeout=None) # no timeout
See also
Send and Receive Messages
- Example:
# we assume Transport Interface is defined # define example message to send uds_message = uds.message.UdsMessage(payload=[0x10, 0x03], addressing_type=uds.addressing.AddressingType.PHYSICAL) # send defined message sent_message_record = ti.send_message(uds_message) # receive message received_message_record = ti.receive_message(timeout=1000) # timeout in [ms]
See also