MessageIEEE1722

Summary

Represents a standard IEEE1722 message object.

Methods
Properties
Events

Structure

class MessageIEEE1722
capture(filter: Filter = None) MessageIEEE1722

Matches any message with the same protocol.

Parameters

filter (Filter) – Filter to use to narrow down packets to capture

Returns

Listens to the bus until a message is received and returns this first message

Return type

MessageIEEE1722

capture(timeout: int32, filter: Filter = None) MessageIEEE1722

Waits for the first message having the same protocol that the sent message without verify the IP address and the port between send and respond message and return it. A timeout is specified to guarantee that the script can continue if no message is captured in a certain time interval.

Parameters
  • timeout (int32) – Max time in milliseconds to wait for the response.

  • filter (Filter) – Filter to use to narrow down packets to capture

Returns

First message captured from the bus or None in case no message is received.

Return type

MessageIEEE1722

capture_list(timeout: int32, filter: Filter = None) IReadOnlyList[MessageIEEE1722]

Waits for any response having the same protocol that the sent message without verify the IP address and the port between send and respond message and return them all as a list. A timeout is specified to guarantee that the script can continue if no message is received in a certain time interval.

Parameters
  • timeout (int32) – Max time in milliseconds to wait for the response.

  • filter (Filter) – Filter to use to narrow down packets to capture

Returns

List of messages captured from the bus during a given period of time.

Return type

IReadOnlyList[MessageIEEE1722]

close_writer()

Closes the file previously created with open_writer(file).

get_all_bytes() Array[uint8]

Gets the content of the whole message from Ethernet layer.

Returns

Array of bytes representing the message from Ethernet layer.

Return type

Array[uint8]

get_bytes() Array[uint8]

Gets the content of the payload.

Returns

Array of bytes representing the payload of the message.

Return type

Array[uint8]

get_hex_bytes() str

Converts the payload of the message from decimal to hex and outputs it to a string of bytes.

Returns

Payload of message in hex bytes.

Return type

str

hex_view() str

Allows to visualize messages in hexadecimal format.

Returns

Hexadecimal representation of the whole message.

Return type

str

hex_view(nb_bytes_per_line: int32) str

Allows to visualize messages in hexadecimal format.

Parameters

nb_bytes_per_line (int32) – (optional) number of bytes per line.

Returns

Hexadecimal representation of the whole message.

Return type

str

open_writer(file: str, fileFormat: FILEFORMAT or None = None)

Creates a PCAP or PCAPNG file for writing the received messages. If the file already exists, it will be overwritten (old file data will be lost). Use the store() method to record received messages into the file.

Parameters
  • file (str) – Absolute path of the file where the messages will be stored

  • fileFormat (FILEFORMAT or None) – Obsolete, you don't need to specify this argument anymore

receive() MessageIEEE1722

Matches a response for the used message.

Returns

Listens to the bus until a message is received and returns this first message

Return type

MessageIEEE1722

receive(timeout: int32) MessageIEEE1722

Waits for the first response having the IP address destination equals to the IP address source of the sent message and return it. A timeout is specified to guarantee that the script can continue if no message is received in a certain time interval.

Parameters

timeout (int32) – Max time in milliseconds to wait for the response.

Returns

First message received from the bus or None in case no message is received.

Return type

MessageIEEE1722

receive_list(timeout: int32) IReadOnlyList[MessageIEEE1722]

Waits for any response having the IP address destination equals to the IP address source of sent message and return them all as a list. A timeout is specified to guarantee that the script can continue if no message is received in a certain time interval.

Parameters

timeout (int32) – Max time in milliseconds to wait for the response.

Returns

List of messages received from the bus during a given period of time.

Return type

IReadOnlyList[MessageIEEE1722]

send() bool

Sends the message (the one used to call the method) through the Ethernet bus.

Returns

Returns True if the message is sent successfully. Otherwise, an exception will be thrown.

Return type

bool

send_auto_increment()

Sends the message (the one used to call the method) through the Ethernet bus and, unlike the send method, it also increments the value of the sequence number.

set_acceptable_delta_time(delta_time: float)

Sets the acceptable delta time between packets sent by pcap player.

Parameters

delta_time (float) – Desired delta time.

set_all_bytes(all_packet: Array[uint8]) bool

Sets the content of the whole message from Ethernet layer, byte per byte.

Parameters

all_packet (Array[uint8]) – All packet to set.

Returns

True if the operation was successful, False otherwise.

Return type

bool

set_bytes(payload: Array[uint8])

Sets the content of the payload, byte per byte.

Parameters

payload (Array[uint8]) – Array of bytes to set.

start_capture(filter: Filter = None)

Used for online capture(capturing network traffic from an adapter). Used with callback function(on_message_received()) and stop_capture() method.

Parameters

filter (Filter) – Filter to use to narrow down packets to capture

start_capture(file: str, wait_eof: bool, filter: Filter = None)

Used for offline capture(reading packets from pcap or asc file). Used with callback function(on_message_received()) and stop_capture() method.

Parameters
  • file (str) – The trace file from where the messages will be read.

  • wait_eof (bool) – If True the function would block until all frames in the file are read. If False the function would read the frames in the background.

  • filter (Filter) – Filter to use to narrow down packets to capture

start_responding_machine()

With this function, it is possible to simulate an ECU. It captures packets and, for every received message, it calls is_request callback. If it returns True, then it calls the make_reply callback

stop_capture()

Stops capturing Ethernet messages, either directly from the bus or from a trace file (depending on the version used to start the capture).

stop_responding_machine()

Stops the responding machine activated with start_responding_machine.

store(file: str)

Writes the message into the trace file.

Parameters

file (str) – Path of the file where the messages will be stored.

store()

Writes the message into the trace file opened with open_writer(file).

tree_view() str

Gives the tree view of the message.

Returns

Tree view representation of the message.

Return type

str

@on_capture_start

The event is triggered when the capture of Ethernet messages is started. See start_capture .

@on_capture_stop

The event is triggered when the capture of Ethernet messages is stopped. See stop_capture .

@on_delta_time_exceeded(message: Message, delta_time_microsecond: float)

Event is triggered when the delta time between packets exceed the acceptable delta time.

Parameters
  • message (Message) – Message to monitor.

  • delta_time_microsecond (float) – The delta time.

@on_frame_counter_packet_loss(message: Message, last_frame_number: int32, current_frame_number: int32, nb_missing_frames: int32)

Event is triggered when the frame counter is not respected.

Parameters
  • message (Message) – Message to monitor.

  • last_frame_number (int32) – Last frame number.

  • current_frame_number (int32) – Current frame number.

  • nb_missing_frames (int32) – Number of missing frames.

@on_message_received(message: MessageIEEE1722)

Event is triggered every time a message is read from the Ethernet bus or a trace file. See start_capture.

Parameters

message (MessageIEEE1722) – The message object being handled.

@on_sequence_number_packet_loss(message: Message, last_sequence_number: int32, current_squence_number: int32, nb_missing_packets: int32)

Event is triggered when the sequence number is not respected.

Parameters
  • message (Message) – The message to monitor.

  • last_sequence_number (int32) – The last sequence number.

  • current_squence_number (int32) – The current sequence number.

  • nb_missing_packets (int32) – The number of missing packets.

avbtp_stream_id_valid

1bit field of the AVBTP frame common header that indicates validity of the stream ID field.

Type

bool

avbtp_timestamp

4byte field of the AVBTP common stream data header used to store the presentation time. The AVB timestamp shall be set to a configurable time in the future, when the first packet for a single picture is sent.

Type

uint32

avbtp_timestamp_uncertain

1bit field of the AVBTP common stream data header. The camera system shall set this field to 0.

Type

bool

avbtp_timestamp_valid

1bit field of the AVBTP common stream data header that indicates validity of the timestamp field, commonly abbreviated to TV. The camera system shall set TV to 1 on first frame of a (m)JPEG picture, if time is synchronized, and change it to 0 on consecutive Ethernet frames of a single (m)JPEG picture. If PTP time is not synchronized, TV = 0.

Type

bool

capture_info

General information about the context in which the message was captured from. None if the message was not captured

Type

CaptureInfo

control_data_indicator

1bit field of the AVBTP frame common header used to distinguish the packet type, if value is 1 the packet is a control packet, if value is 0 the packet is a data packet.

Type

bool

data_base

Takes the database object.

Type

Database

ethernet_header

Object containing all the information from the Ethernet header like the source and destination MAC addresses of the message.

Type

HeaderEthernet

frame_number

Number of the frame received, in the context of all the ethernet traffic captured.

Type

int64

gateway_info

4byte field of the AVBTP common stream data header. The camera system shall not give any gateway information , so all the bits shall be set to 0 and so the gateway_info_valid field too.

Type

uint32

gateway_info_field

1bit field of the AVBTP common stream data header that indicates validity of the gateway information field. No gateway information is given, so the bit shall be set to 0.

Type

bool

media_engine_restart

1bit field of the AVBTP common stream data header, commonly abbreviated to MR. The camera system shall set this to 1 on the first Ethernet frame after PTP has been re-synchronized because of an interruption and shall set it to 0 if PTP is synchronized.

Type

bool

packet_data_length

2byte field of the AVBTP common stream data header that contains the length of the stream data in bytes.

Type

uint16

payload

Content, in bytes, of the payload of the message.

Type

Array[uint8]

protocol_specific_packet_header

2byte field of the AVBTP common stream data header. This field contains the information about the payload type, according to the MIME type given in the respective RFC for Payload Type (PT) RTP. The camera system shall use 0x004D if single JPEG pictures are transmitted without further header information, and 0x001A when motion-JPEG payload is transmitted.

Type

uint16

reserved

Reserved to possible uses in the future. It shall be set to 0x00 until further notice.

Type

bool

seq_number

Sequence number. Counter that is incremented in one unit with each Ethernet frame sent using send_auto_increment.

Type

uint8

stream_id

8byte field of the AVBTP frame common header. IEEE802.1Qat stream ID. A stream is identified by an AVB stream ID. The AVB stream ID for a certain source and application shall be unique within the vehicle. In the camera system the stream ID shall be populated with the globally unique MAC address of the transmitting node, followed by two bytes called StreamID2 that identify the source camera.

Type

uint64

subtype

7bit field of the AVBTP frame common header indicating the protocol type. The camera system shall only send packets with subtype 0x02 (BMW Specific). Other ECUs may use subtype 0x01 when using IEEE1722 fully standard compliant.

Type

uint8

timestamp

Timestamp of the message.

Type

decimal

version

The version of the protocol used.

Type

uint8

vlan_tag

Object containing all VLAN info.

Type

HeaderVlan