uds.transport_interface.abstract_transport_interface

Abstract definition of UDS Transport Interface.

Classes

AbstractTransportInterface

Abstract definition of Transport Interface.

Module Contents

class uds.transport_interface.abstract_transport_interface.AbstractTransportInterface(network_manager)[source]

Bases: abc.ABC

Inheritance diagram of uds.transport_interface.abstract_transport_interface.AbstractTransportInterface

Abstract definition of Transport Interface.

Transport Interfaces are meant to handle middle layers (Transport and Network) of UDS OSI Model.

Create Transport Interface (an object for handling UDS Transport and Network layers).

Parameters:

network_manager (Any) – An object that handles the network (Physical and Data layers of OSI Model).

__time_sync: uds.utilities.TimeSync
property network_manager: Any

Get network manager used by this Transport Interface.

Network manager handles Physical and Data layers (OSI Model) of the bus/network.

Return type:

Any

__del__()[source]

Safely close all threads opened by this object.

Return type:

None

property time_sync: uds.utilities.TimeSync

Get time and timestamp synchronizer.

Return type:

uds.utilities.TimeSync

property segmenter: uds.segmentation.AbstractSegmenter
Abstractmethod:

Return type:

uds.segmentation.AbstractSegmenter

Value of the segmenter used by this Transport Interface.

Warning

Do not change any segmenter attributes during the communication as it might introduce faults to Transport Interface.

property addressing_information: uds.addressing.AbstractAddressingInformation

Get Addressing Information of UDS Entity simulated by this Transport Interface.

Return type:

uds.addressing.AbstractAddressingInformation

property is_sync_active: bool
Abstractmethod:

Return type:

bool

Get flag indicating whether synchronous communication is active.

property is_async_active: bool
Abstractmethod:

Return type:

bool

Get flag indicating whether asynchronous communication is active.

abstractmethod setup_sync()[source]

Prepare this Transport Interface for synchronous communication.

This method activates synchronous communication and deactivates asynchronous communication.

Return type:

None

abstractmethod setup_async(loop)[source]

Prepare this Transport Interface for asynchronous communication.

This method activates asynchronous communication and deactivates synchronous communication.

Parameters:

loop (asyncio.AbstractEventLoop) – An asyncio event loop to use.

Return type:

None

abstractmethod teardown_sync(suppress_warning=False)[source]

Deactivate synchronous communication.

Parameters:

suppress_warning (bool) – Do not warn about mixing Synchronous and Asynchronous implementation.

Return type:

None

abstractmethod teardown_async(suppress_warning=False)[source]

Deactivate asynchronous communication.

Parameters:

suppress_warning (bool) – Do not warn about mixing Synchronous and Asynchronous implementation.

Return type:

None

static is_supported_network_manager(bus_manager)[source]
Abstractmethod:

Parameters:

bus_manager (Any)

Return type:

bool

Check whether provided value is a bus/network manager that is supported by this Transport Interface.

Parameters:

bus_manager (Any) – Value to check.

Returns:

True if provided object is compatible with this Transport Interface, False otherwise.

Return type:

bool

abstractmethod send_packet(packet)[source]

Transmit packet.

Parameters:

packet (uds.packet.AbstractPacket) – A packet to send.

Returns:

Record with historic information about transmitted packet.

Return type:

uds.packet.AbstractPacketRecord

abstractmethod async_send_packet(packet, loop=None)[source]
Async:

Parameters:
Return type:

uds.packet.AbstractPacketRecord

Transmit packet asynchronously.

Parameters:
  • packet (uds.packet.AbstractPacket) – A packet to send.

  • loop (asyncio.AbstractEventLoop | None) – An asyncio event loop to use for scheduling this task.

Returns:

Record with historic information about transmitted packet.

Return type:

uds.packet.AbstractPacketRecord

abstractmethod receive_packet(timeout=None)[source]

Receive packet.

Parameters:

timeout (uds.utilities.TimeMillisecondsAlias | None) – Maximal time (in milliseconds) to wait. Leave None to wait forever.

Raises:

TimeoutError – Timeout was reached.

Returns:

Record with historic information about received packet.

Return type:

uds.packet.AbstractPacketRecord

abstractmethod async_receive_packet(timeout=None, loop=None)[source]
Async:

Parameters:
Return type:

uds.packet.AbstractPacketRecord

Receive packet asynchronously.

Parameters:
  • timeout (uds.utilities.TimeMillisecondsAlias | None) – Maximal time (in milliseconds) to wait. Leave None to wait forever.

  • loop (asyncio.AbstractEventLoop | None) – An asyncio event loop to use for scheduling this task.

Raises:
Returns:

Record with historic information about received packet.

Return type:

uds.packet.AbstractPacketRecord

abstractmethod send_message(message)[source]

Transmit UDS message.

Parameters:

message (uds.message.UdsMessage) – A message to send.

Returns:

Record with historic information about transmitted UDS message.

Return type:

uds.message.UdsMessageRecord

abstractmethod async_send_message(message, loop=None)[source]
Async:

Parameters:
Return type:

uds.message.UdsMessageRecord

Transmit asynchronously UDS message.

Parameters:
  • message (uds.message.UdsMessage) – A message to send.

  • loop (asyncio.AbstractEventLoop | None) – An asyncio event loop to use for scheduling this task.

Returns:

Record with historic information about transmitted UDS message.

Return type:

uds.message.UdsMessageRecord

abstractmethod receive_message(start_timeout=None, end_timeout=None)[source]

Receive UDS message.

Warning

Value of end_timeout must not be less than the value of start_timeout.

Parameters:
  • start_timeout (uds.utilities.TimeMillisecondsAlias | None) – Maximal time (in milliseconds) to wait for the start of a message transmission. Leave None to wait forever.

  • end_timeout (uds.utilities.TimeMillisecondsAlias | None) – Maximal time (in milliseconds) to wait for a message transmission to finish. Leave None to wait forever.

Raises:
Returns:

Record with historic information about received UDS message.

Return type:

uds.message.UdsMessageRecord

abstractmethod async_receive_message(start_timeout=None, end_timeout=None, loop=None)[source]
Async:

Parameters:
  • start_timeout (uds.utilities.TimeMillisecondsAlias | None)

  • end_timeout (uds.utilities.TimeMillisecondsAlias | None)

  • loop (asyncio.AbstractEventLoop | None)

Return type:

uds.message.UdsMessageRecord

Receive asynchronously UDS message.

Warning

Value of end_timeout must not be less than the value of start_timeout.

Parameters:
  • start_timeout (uds.utilities.TimeMillisecondsAlias | None) – Maximal time (in milliseconds) to wait for the start of a message transmission. Leave None to wait forever.

  • end_timeout (uds.utilities.TimeMillisecondsAlias | None) – Maximal time (in milliseconds) to wait for a message transmission to finish. Leave None to wait forever.

  • loop (asyncio.AbstractEventLoop | None) – An asyncio event loop to use for scheduling this task.

Raises:
Returns:

Record with historic information about received UDS message.

Return type:

uds.message.UdsMessageRecord