Far from complete. By using USB to serial converter + USB serial null modem adapter it is possbile to mimick more or less serial controlled devices without SW virtual serial ports. Wireshark used for analyzing USB serial traffic with ActiveGPS Windows software and my (really old) ActiveGPS device.

agps-scr.jpg

pymock-scr.jpg

 

import serial

A = b'00'
B = b'06036F72AD18F8BF4B07DA01120B3215AF00'
C = b'0000'
D = b'00'
E = b'00'
J = [
     b'18F8BF4B07DA01120B3215AFFFFFFFFF',
     b'409CA961000050124EF175426C73AE41',
     b'14060D0907DB5B58421D474A4A00FFFF',
     b'FFFFFFF133FB33FB33FA33FA33FA33FA',
     b'33FA33FA33FA33FA33FA33FA33FA33FA',
     b'33FA33FFFFFFFFFFFFFFFFFFFFFFFFFF',
     b'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
     b'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000',
    ]

ser = serial.Serial('COM19', 9600, timeout=None)
print("...")
while True:
    s = ser.readline()
    if s[0:1] == b'\xff':
        s = s[1:]
    print('\r\nReceived ' + str(s))
    if s == b'&A\r\n':
        print('\tSent ' + str(A))
        ser.write(A)
    elif s == b'&B\r\n':
        print('\tSent ' + str(B))
        ser.write(B)
    elif s == b'&C01\r\n':
        print('\tSent ' + str(C))
        ser.write(C)
    elif s == b'&J\r\n':
        for i in J:
            print('\tSent ' + str(i))
            ser.write(i)
    elif s == '&E000000\r\n':
        print('\tSent ' + str(E))
        ser.write(E)
    elif s == '&D\r\n':
        print('\tSent ' + str(D))
        ser.write(D)
        break
    else:
        break
    ser.flush()
ser.close()
print("Port closed")