SingleTraceReader

class osi_utilities.tracefile.readers.single.SingleTraceReader(enable_message_type_inference=True)[source]

Bases: TraceReader

Reader for single-channel binary OSI trace files (.osi).

Each message is stored as: [4-byte LE length][serialized protobuf bytes]

The message type can be specified explicitly or inferred from the filename.

Parameters:

enable_message_type_inference (bool)

set_message_type(message_type)[source]

Set message type to be used on open().

Parameters:

message_type (MessageType)

Return type:

None

open(path)[source]

Open a binary .osi trace file.

Parameters:

path (Path) – Path to the .osi file.

Returns:

True on success, False on failure.

Return type:

bool

read_message()[source]

Read the next message from the binary trace file.

Returns:

ReadResult on success, None if no more messages.

Return type:

ReadResult | None

has_next()[source]

Check if there are more messages to read.

Return type:

bool

close()[source]

Close the trace file.

Return type:

None

property message_type: MessageType | None

The message type being read.