SingleTraceWriter

class osi_utilities.tracefile.writers.single.SingleTraceWriter[source]

Bases: TraceWriter

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

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

open(path, **kwargs)[source]

Open a binary .osi trace file for writing.

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

  • **kwargs (object) – Unused. Accepted for base-class compatibility.

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.