Exemplo n.º 1
0
def process_subpacket_data(sequence, version, subpackets):
    data = create_packet_from_subpackets(sequence, version, subpackets)
    protocol = TestProtocol()
    protocol.connection_made()
    protocol.data_received(data)
    protocol.connection_lost()
    return protocol.results
Exemplo n.º 2
0
def process_subpacket_data(sequence, version, subpackets):
    data = create_packet_from_subpackets(sequence, version, subpackets)
    protocol = TestProtocol()
    protocol.connection_made()
    protocol.data_received(data)
    protocol.connection_lost()
    return protocol.results
Exemplo n.º 3
0
    def packet_end(self):
        print('>>>')
        print()

    def subpacket_received(self, sensor, valid, data):
        print('## subpacket')
        print('sensor:', sensor)
        print('valid:', valid)
        print('data:', list(data))
        print()


protocol = CoresensePluginProtocol()

packet = create_packet_from_subpackets(0, 1, [
    (12, True, bytearray([1, 2, 3])),
    (12, True, bytearray([6, 5, 4])),
])

protocol.connection_made()

# this is where you can feed data into the protocol as you receive it.
protocol.data_received(packet)

# you can build a packet up incrementally by calling this multiple times.
protocol.data_received(packet[:3])
protocol.data_received(packet[3:])

# this
protocol.connection_lost()
Exemplo n.º 4
0
        print("version:", version)
        print()

    def packet_end(self):
        print(">>>")
        print()

    def subpacket_received(self, sensor, valid, data):
        print("## subpacket")
        print("sensor:", sensor)
        print("valid:", valid)
        print("data:", list(data))
        print()


protocol = CoresensePluginProtocol()

packet = create_packet_from_subpackets(0, 1, [(12, True, bytearray([1, 2, 3])), (12, True, bytearray([6, 5, 4]))])

protocol.connection_made()

# this is where you can feed data into the protocol as you receive it.
protocol.data_received(packet)

# you can build a packet up incrementally by calling this multiple times.
protocol.data_received(packet[:3])
protocol.data_received(packet[3:])

# this
protocol.connection_lost()