smartinspectpython.sibinaryformatter
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.
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.
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.