예제 #1
0
    def writeInput(self, stream: BytesIO, pdu):
        Uint16LE.pack(len(pdu.events), stream)
        stream.write(b"\x00" * 2)

        parser = SlowPathInputParser()
        for event in pdu.events:
            stream.write(parser.write(event))
예제 #2
0
    def parseInput(self, stream: BytesIO, header):
        numEvents = Uint16LE.unpack(stream)
        stream.read(2)

        parser = SlowPathInputParser()
        inputEvents = [parser.parse(stream) for _ in range(numEvents)]

        return InputPDU(header, inputEvents)