Advanced properties of DLT logging-related objects

DLT message object

class DltMessage

DltMessage objects represent DLT messages. For non-verbose DLT messages, loading an appropriate Fibex file and using their individual signals is recommended. For verbose DLT messages, you can use the attributes described here to query information about the DLT message.

messageCounter = None
Type:

int|None

ecuId = None
Type:

str|None

sessionId = None
Type:

int|None

messageTimestamp = None

in 0.1ms increments.

See also GetMessageTimestamp()

Type:

int|None

verbose = False
Type:

bool

applicationId = None
Type:

str|None

contextId = None
Type:

str|None

GetIndex()

Returns the zero-based storage index of the message. The index indicates the sequential position in a DLT file.

Note:

The index is determined by the DLT file parser and is not part of the message itself. Therefore, the index is only valid for messages read from DLT files!

Returns:

The index or None if the message is not read from a DLT file.

Return type:

Optional[int]

GetAbsoluteTimeString(utc=True)

Returns the ISO format representation of the absolute timestamp when the message was received.

Note:

The absolute timestamp is only available for messages read from DLT files and is independent from the message timestamp.

Example

‘2019-05-18T15:17:08.132263+00:00’ if utc=True; otherwise, ‘2019-05-18T15:19:08.132263+02:00’ if the local timezone is UTC+2, for example.

Parameters:
utc : bool

If True, the UTC time is returned. Otherwise, the local time is returned. In both cases. The returned ISO string does include the timezone offset.

Returns:

The absolute timestamp as ISO string. None if not available.

Return type:

Optional[str]

GetMessageTimestamp()

Returns the message timestamp if it is part of the message. This timestamp is set by the sending ECU.

Returns:

Timestamp in seconds

Return type:

Optional[float]

GetArgumentCount()

(verbose) Returns the Number of arguments of this DLT message.

Returns:

Number of arguments of this DLT message.

Return type:

int

GetArgumentsString(includeArgNames=True)

(verbose) Returns a string representation of all arguments.

Parameters:
includeArgNames : bool

Specifies whether argument names are to be included.

Returns:

A string representing all arguments

Return type:

str

HasArgument(argName)

(verbose) Tests whether an argument of the given name/index exists.

Parameters:
argName : str|int

Name/index of the argument to check for existence

Returns:

Whether an argument of the given name exists

Return type:

bool

__getitem__(key)

(verbose) Arguments can be accessed by position via dltMessageObj[idx] or by name via dltMessageObj[argName].

Complex values are currently not supported.

Parameters:
key : str|int

name or position

Returns:

The argument’s payload value. In case of a fixed-point number, the physical value.

Return type:

int|float|str

get(key, default=None)

(verbose) Gets an argument or the default value, if the name resp. position does not exist.

Parameters:
key : str|int

name or position

default : object

default value that should be returned if key does not exist

Returns:

The argument’s payload value. In case of a fixed-point number, the physical value.

Return type:

int|float|str|object

GetArgumentValue(argName)

(verbose) Returns the value of an argument.

Parameters:
argName : str|int

Name/index of the argument

Returns:

The argument’s payload value. In case of a fixed-point number, the physical value.

Return type:

int|float|str

Raises:
  • KeyError – argName is of type str and cannot be found.

  • IndexError – argName is of type in and cannot be found.

GetArgumentUnit(argName)

(verbose) Determines the unit of an argument.

Parameters:
argName : str|int

Name/index of the argument whose unit to determine

Returns:

Unit of the specified argument

Return type:

str

GetArgumentName(argIdx)

(verbose) Determines the name of an argument.

Parameters:
argIdx : int

Number/index (zero-based) of the argument

Returns:

Name of the specified argument

Return type:

str

GetLogLevel()

Returns the log level if the message is a DLT Log Message. Values:

  • 0x1: DLT_LOG_FATAL (Fatal system error)

  • 0x2: DLT_LOG_DLT_ERROR(Application error)

  • 0x3: DLT_LOG_WARN(Correct behavior cannot be ensured)

  • 0x4: DLT_LOGINFO(Message of LogLevel type “Information”)

  • 0x5: DLT_LOG_DEBUG(Message of LogLevel type “Debug”)

  • 0x6: DLT_LOG_VERBOSE(Message of LogLevel type “Verbose”)

  • 0x7 - 0xF: Reserved

Return type:

Optional[int]

GetMessageID()

(non-verbose) Returns the message ID of a message.

Returns:

The message ID. Value None for verbose messages.

Return type:

Optional[int]

GetPayloadBytes()

Returns the payload of the DLT message.

Returns:

message payload

Return type:

bytes