Injekt RTCM 1008

Just an update on testing stage:

It ran this time about 11 hours before getting to the IndexError…

Now I put it up with:

#!/usr/bin/python3

    import sys

    while True:
    data = sys.stdin.buffer.read(1)
    while (data != b'\xd3'):
        data = sys.stdin.buffer.read(1)

    length_data = sys.stdin.buffer.read(2)
    length = ((length_data[0] & 0b00000011) << 8) + length_data[1]
    packet_data = sys.stdin.buffer.read(length)
    crc24_data = sys.stdin.buffer.read(3)

    if length >= 2:
        message_number = (packet_data[0] << 8) + packet_data[1]
        message_number >>= 4

    sys.stdout.buffer.write(b'\xd3')
    sys.stdout.buffer.write(length_data)
    sys.stdout.buffer.write(packet_data)
    sys.stdout.buffer.write(crc24_data)
    sys.stdout.flush()

    if message_number == 1005:
        # 1008 message: ADVNULLANTENNA (station id =0)
        sys.stdout.buffer.write(bytes([0xd3,0x00,0x14,0x3f,0x00,0x00,0x0e,0x41,0x44,0x56,0x4e,0x55,0x4c,0x4c,0x41,0x4e,0x54,0x45,0x4e,0x4e,0x41,0x00,0x00,0x79,0x06,0x89]))

        sys.stdout.flush()

So possible 0 length messages should not make an IndexError.
Also changed the content of 1008.

Anyways - its up and running again. And with a great interest I’m waiting to see how long the modified USB stream from F9P stays alive this time.

Just wonder if the

    sys.stdout.buffer.write(packet_data)

will make a problem if packet is empty? If it does then I suppose we might just drop this whole packet on the floor and and start from the beginning again or omit this line this time…

The need for two way serial in this eringerli/ RpiNtripBase comes from the idea that base can be configured at startup with a configuration file.

But I suppose if one makes a permanent base a just listening the base would be enough.

.