BinaryTraceFileWriter

class osi_utilities.tracefile.binary_writer.BinaryTraceFileWriter[source]

Bases: TraceFileWriter

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

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

open(path)[source]

Open a binary .osi trace file for writing.

Parameters:

path (Path) – Path to the output file. Must have .osi extension.

Returns:

True on success, False on failure.

Return type:

bool

write_message(message, topic='')[source]

Write a protobuf message to the binary trace file.

Parameters:
  • message (Message) – The protobuf message to serialize and write.

  • topic (str) – Ignored for single-channel binary files.

Returns:

True on success, False on failure.

Return type:

bool

close()[source]

Close the trace file.

Return type:

None

property written_count: int

Number of messages written so far.