0
|
1 import sirf
|
|
2 import serial
|
|
3
|
|
4 if __name__ == "__main__":
|
|
5 s = serial.Serial(port = '/dev/cuad0', baudrate = 9600)
|
|
6
|
|
7 s.setBaudrate(4800)
|
|
8 s.flush()
|
|
9 # Switch to SiRF and 9600 baud
|
|
10 s.write(sirf.nmea2sirf)
|
|
11 s.flush()
|
|
12 s.setBaudrate(9600)
|
|
13 s.flush()
|
|
14
|
|
15
|
|
16 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
17 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
18 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
19 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
20 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
21 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
22 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
23 s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap([0xa6, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
|
24 p = sirf.Parser()
|
|
25 while True:
|
|
26 print p.processstr(s.read(1000))
|