annotate test.py @ 1:c623f8832fd7

Tidy up, take cmd line args.
author darius@Inchoate
date Wed, 02 Sep 2009 13:24:44 +0930
parents 6503256a3fc4
children 387e6e928567
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
1 import serial, sirf, sys
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
2
0
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
3
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
4 if __name__ == "__main__":
1
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
5 if len(sys.argv) > 1:
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
6 port = sys.argv[1]
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
7 else:
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
8 port = '/dev/rfcomm1'
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
9
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
10 s = serial.Serial(port = port, baudrate = 9600)
0
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
11
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
12 s.setBaudrate(4800)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
13 s.flush()
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
14 # Switch to SiRF and 9600 baud
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
15 s.write(sirf.nmea2sirf)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
16 s.flush()
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
17 s.setBaudrate(9600)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
18 s.flush()
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
19
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
20 p = sirf.Parser()
1
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
21
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
22 sirf.disablemsgs(s)
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
23 sirf.enablemsgs(s)
c623f8832fd7 Tidy up, take cmd line args.
darius@Inchoate
parents: 0
diff changeset
24 p.dumpmsgs(s)