uds.transport_interface.packet_queue

Implementation of UDS Packets queues.

Module Contents

Classes

ReceivedPacketsQueue

Queue for storing received packets.

class uds.transport_interface.packet_queue.ReceivedPacketsQueue(packet_class=AbstractUdsPacketRecord)[source]

Queue for storing received packets.

Create a queue as a storage for received packets.

Parameters

packet_class (type) – A class that defines UDS packets type that is accepted by this queue. One can use this parameter to restrict packets managed by this queue.

Raises

TypeError – Provided packet_class argument is not a class that inherits after :class:”uds.packet.abstract_packet.AbstractUdsPacketRecord”.

abstract __del__(self)[source]

Delete the object safely.

To satisfy safe closure or tasks using the queue:
  • prevent new tasks creations

  • close or await already started tasks

Return type

NoReturn

abstract __len__(self)[source]

Get number of packets that are currently stored by the queue.

Return type

int

abstract is_empty(self)[source]

Check if queue is empty.

Returns

True if queue is empty (does not contain any packets), False otherwise.

Return type

bool

abstract packet_task_done(self)[source]

Inform that a task related to one packet was completed.

This method is used during closing all tasks safely and quietly.

Return type

None

abstract async get_packet(self)[source]

Get the next received packet from the queue.

Note: If called, when there are no packets in the queue, then execution would await until another packet

is received.

Returns

The next received packet.

Return type

uds.packet.AbstractUdsPacketRecord

abstract async put_packet(self, packet)[source]

Add a packet (that was just received) to the end of the queue.

Parameters

packet (uds.packet.AbstractUdsPacketRecord) – A packet that was just received.

Return type

None