ProtobufTextFormatTraceReader

class osi_utilities.tracefile.readers.textformat.ProtobufTextFormatTraceReader[source]

Bases: TraceReader

Reader for text human-readable OSI trace files (.txth).

Deprecated since version 0.3.0: The .txth text format is not reliably deserializable. The OSI specification states that it is “not unambiguously deserializable” — protobuf text format output is not guaranteed to be stable across library versions, field ordering may change, and float/double precision varies. Round-tripping (write then read) can silently lose data. Prefer .osi (binary) for single-channel or .mcap for multi-channel trace files.

Messages are stored in Google protobuf TextFormat. Each message is delimited by reading until the text can be parsed as a complete message.

See the Protocol Buffers Text Format Language Specification.

set_message_type(message_type)[source]

Set message type to be used on open().

Pass MessageType.UNKNOWN to enable filename-based inference.

Parameters:

message_type (MessageType)

Return type:

None

open(path)[source]

Open a .txth trace file.

Parameters:

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

Returns:

True on success, False on failure.

Return type:

bool

read_message()[source]

Read the next message from the text 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 and release resources.

Return type:

None

property message_type: MessageType