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
- 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
- Returns
First message captured from the bus or
None
in case no message is received.- Return type
- 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
- Returns
List of messages captured from the bus during a given period of time.
- Return type
- close_writer()
Closes the file previously created with
open_writer(file)
.
- 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
- hex_view() str
Allows to visualize messages in hexadecimal format.
- Returns
Hexadecimal representation of the whole message.
- Return type
- 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 storedfileFormat (
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
- 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
- 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
- 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
- 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.
- 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.
- 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
- @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.
- @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.
- @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.
- avbtp_stream_id_valid
1bit
field of the AVBTP frame common header that indicates validity of the stream ID field.- Type
- 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
- avbtp_timestamp_uncertain
1bit
field of the AVBTP common stream data header. The camera system shall set this field to0
.- Type
- 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 to1
on first frame of a (m)JPEG picture, if time is synchronized, and change it to0
on consecutive Ethernet frames of a single (m)JPEG picture. If PTP time is not synchronized, TV =0
.- Type
- capture_info
General information about the context in which the message was captured from.
None
if the message was not captured- Type
- control_data_indicator
1bit
field of the AVBTP frame common header used to distinguish the packet type, if value is1
the packet is a control packet, if value is0
the packet is a data packet.- Type
- ethernet_header
Object containing all the information from the Ethernet header like the source and destination MAC addresses of the message.
- Type
- frame_number
Number of the frame received, in the context of all the ethernet traffic captured.
- Type
- 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 to0
and so the gateway_info_valid field too.- Type
- 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 to0
.- Type
- media_engine_restart
1bit
field of the AVBTP common stream data header, commonly abbreviated to MR. The camera system shall set this to1
on the first Ethernet frame after PTP has been re-synchronized because of an interruption and shall set it to0
if PTP is synchronized.- Type
- packet_data_length
2byte
field of the AVBTP common stream data header that contains the length of the stream data in bytes.- Type
- 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 use0x004D
if single JPEG pictures are transmitted without further header information, and0x001A
when motion-JPEG payload is transmitted.- Type
- reserved
Reserved to possible uses in the future. It shall be set to
0x00
until further notice.- Type
- seq_number
Sequence number. Counter that is incremented in one unit with each Ethernet frame sent using send_auto_increment.
- Type
- 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
- subtype
7bit
field of the AVBTP frame common header indicating the protocol type. The camera system shall only send packets with subtype0x02
(BMW Specific). Other ECUs may use subtype0x01
when using IEEE1722 fully standard compliant.- Type
- vlan_tag
Object containing all VLAN info.
- Type