Message
Summary
Represent a base message object. for possible implementations see Messages.
- Methods
- Properties
- Events
Structure
- class Message
- 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 stored
- fileFormat ( - FILEFORMATor None) – Obsolete, you don't need to specify this argument anymore
 
 
 - send() bool
- Sends the message (the one used to call the method) through the Ethernet bus. - Returns
- Returns - Trueif the message is sent successfully. Otherwise, an exception will be thrown.
- Return type
 
 - set_bytes(bytes: Array[uint8])
- Sets the content of the header and the payload from the given byte array.
- This method is setting some fields that differ from a message to another : e.g: For PDU messages, it sets the message_id, length and payload. For SOME/IP messages, it sets the someip_header and payload. 
 
 - 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 . 
 - capture_info
- General information about the context in which the message was captured from. - Noneif the message was not captured- Type
 
 - frame_number
- Number of the frame received, in the context of all the ethernet traffic captured. - Type