comparison test.py @ 5:f3547b32c7c5 default tip

Don't set timeout in parser class otherwise we can't use it for FIFO files.
author Daniel O'Connor <darius@dons.net.au>
date Fri, 02 Aug 2019 12:14:26 +0930
parents 387e6e928567
children
comparison
equal deleted inserted replaced
4:2fde8c382dae 5:f3547b32c7c5
1 import serial, sirf, sys 1 import serial, sirf, sys
2 2
3 # Copyright (c) 2009 3 # Copyright (c) 2019
4 # Daniel O'Connor <darius@dons.net.au>. All rights reserved. 4 # Daniel O'Connor <darius@dons.net.au>. All rights reserved.
5 # 5 #
6 # Redistribution and use in source and binary forms, with or without 6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions 7 # modification, are permitted provided that the following conditions
8 # are met: 8 # are met:
27 if __name__ == "__main__": 27 if __name__ == "__main__":
28 if len(sys.argv) > 1: 28 if len(sys.argv) > 1:
29 port = sys.argv[1] 29 port = sys.argv[1]
30 else: 30 else:
31 port = '/dev/rfcomm1' 31 port = '/dev/rfcomm1'
32
33 s = serial.Serial(port = port, baudrate = 9600)
34 32
33 s = serial.Serial(port = port)
34 s.setTimeout(0.1)
35 s.setBaudrate(4800) 35 s.setBaudrate(4800)
36 s.flush() 36 s.flush()
37
37 # Switch to SiRF and 9600 baud 38 # Switch to SiRF and 9600 baud
38 s.write(sirf.nmea2sirf) 39 s.write(sirf.nmea2sirf)
39 s.flush() 40 s.flush()
40 s.setBaudrate(9600) 41 s.setBaudrate(9600)
41 s.flush() 42 s.flush()
42 43
43 p = sirf.Parser() 44 p = sirf.Parser()
44 45
45 sirf.disablemsgs(s) 46 sirf.disablemsgs(s)
46 sirf.enablemsgs(s) 47 sirf.enablemsgs(s)
47 p.dumpmsgs(s) 48 p.dumpmsgs(s)