smartinspectpython.sibinaryformatter

@export
class SIBinaryFormatter(smartinspectpython.siformatter.SIFormatter):

Responsible for formatting and writing a packet in the standard SmartInspect binary format.

This class formats and writes a packet in the standard binary format which can be read by the SmartInspect Console. The Compile method preprocesses a packet and computes the required size of the packet. The Write method writes the preprocessed packet to the supplied stream.

Threadsafety:

This class is not guaranteed to be thread-safe.

SIBinaryFormatter()

Initializes a new instance of the class.

MAX_STREAM_CAPACITY: int = 10485760
MAX_BUFFER_SIZE: int = 8192
TICKS_EPOCH: int = 621355968000000000
MICROSECONDS_PER_DAY: int = 86400000000
DAY_OFFSET_DELPHI_DEFAULT: int = 25569
def Compile(self, packet: smartinspectpython.sipacket.SIPacket) -> int:

Overridden. Preprocesses (or compiles) a packet and returns the required size for the compiled result.

Arguments:
  • packet (SIPacket): The packet to compile.
Returns:

The size for the compiled result.

This method preprocesses the supplied packet and computes the required binary format size. To write this compiled packet, call the Write method.

def Write(self, stream: _io.BytesIO) -> None:

Overridden. Writes a previously compiled packet to the supplied stream.

Arguments:
  • stream (BytesIO): The stream to write the packet to.
Raises:
  • IOException: An I/O error occurred while trying to write the compiled packet.

This method writes the previously compiled packet (see Compile) to the supplied stream object. If the return value of the Compile method was 0, nothing is written.