annotate sirf.py @ 0:6503256a3fc4

Prototype code for parsing SiRF messages. Seems to work, but needs fleshing out for actual use.
author darius@Inchoate
date Sun, 22 Feb 2009 21:26:49 +1030
parents
children d6d9fba5464d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
1 #!/usr/bin/env python
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
3 import time, struct
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
4
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
5 # SiRF at 9600 baud
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
6 nmea2sirf = '$PSRF100,0,9600,8,1,0*0C\r\n'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
7
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
8 # NMEA at 4800 baud
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
9 # Use like so
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
10 # s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap(sirf.sirf2nmea)))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
11 sirf2nmea = [ 0x81, 0x02, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, 0x05, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x12, 0xc0 ]
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
12
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
13 #s.write(sirf.Parser.OrdLsttoStr(sirf.Parser.Encap(sirf.getver)))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
14 getver = [ 0x84, 0x00 ]
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
15
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
16 # Messages from engine
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
17 sirfoutpktdsc = {
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
18 0x01 : "Reference Navigation Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
19 0x02 : "Measured Navigation Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
20 0x03 : "True Tracker Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
21 0x04 : "Measured Tracking Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
22 0x05 : "Raw Track Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
23 0x06 : "SW Version",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
24 0x07 : "Clock Status",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
25 0x08 : "50 BPS Subframe Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
26 0x09 : "Throughput",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
27 0x0a : "Error ID",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
28 0x0b : "Command Acknowledgment",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
29 0x0c : "Command NAcknowledgment",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
30 0x0d : "Visible List",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
31 0x0e : "Almanac Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
32 0x0f : "Ephemeris Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
33 0x10 : "Test Mode 1",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
34 0x11 : "Differential Corrections",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
35 0x12 : "OkToSend",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
36 0x13 : "Navigation Parameters",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
37 0x14 : "Test Mode 2/3/4",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
38 0x1b : "DGPS Status",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
39 0x1c : "Nav. Lib. Measurement Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
40 0x1d : "Nav. Lib. DGPS Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
41 0x1e : "Nav. Lib. SV State Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
42 0x1f : "Nav. Lib. Initialization Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
43 0x29 : "Geodetic Navigation Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
44 0x2d : "Raw DR Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
45 0x2e : "Test Mode 3",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
46 0x30 : "SiRFDRive-specific Class of Output Messages",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
47 0x31 : "Test Mode 4 for SiRFLoc v2.x only",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
48 0x32 : "SBAS Parameters",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
49 0x34 : "1 PPS Time Message",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
50 0x37 : "Test Mode 4",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
51 0x38 : "Extended Ephemeris Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
52 0xe1 : "SiRF internal message",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
53 0xff : "Development Data"
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
54 }
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
55
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
56 # Messages to engine
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
57 sirfinpktdsc = {
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
58 0x35 : "Advanced Power Management",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
59 0x80 : "Initialize Data Source",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
60 0x81 : "Switch to NMEA Protocol",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
61 0x82 : "Set Almanac (upload)",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
62 0x83 : "Handle Formatted Dump Data",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
63 0x84 : "Poll Software Version",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
64 0x85 : "DGPS Source Control",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
65 0x86 : "Set Main Serial Port",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
66 0x87 : "Switch Protocol",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
67 0x88 : "Mode Control",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
68 0x89 : "DOP Mask Control",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
69 0x8a : "DGPS Mode",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
70 0x8b : "Elevation Mask",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
71 0x8c : "Power Mask",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
72 0x8d : "Editing Residual",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
73 0x8e : "Steady-State Detection",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
74 0x8f : "Static Navigation",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
75 0x90 : "Poll Clock Status",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
76 0x91 : "Set DGPS Serial Port",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
77 0x92 : "Poll Almanac",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
78 0x93 : "Poll Ephemeris",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
79 0x94 : "Flash Update",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
80 0x95 : "Set Ephemeris (upload)",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
81 0x96 : "Switch Operating Mode",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
82 0x97 : "Set TricklePower Parameters",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
83 0x98 : "Poll Navigation Parameters",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
84 0xa5 : "Set UART Configuration",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
85 0xa6 : "Set Message Rate",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
86 0xa7 : "Set Low Power Acquisition Parameters",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
87 0xa8 : "Poll Command Parameters",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
88 0xaa : "Set SBAS Parameters",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
89 0xac : "SiRFDRive-specific",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
90 0xb4 : "Marketing Software Configuration",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
91 0xb6 : "Set UART Configuration",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
92 0xe4 : "SiRF internal message",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
93 0xe8 : "Extended Ephemeris Proprietary"
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
94 }
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
95
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
96 def fmtlatlong(x):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
97 deg = int(x)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
98 min = abs((x - deg) * 60)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
99 sec = abs((min - int(min)) * 60)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
100
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
101 return "%d d %d m %.3f s" % (deg, int(min), sec)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
102
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
103 class Parser(object):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
104 def __init__(self, s = None):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
105 self.buffer = []
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
106 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
107
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
108 self.fr_err = 0 # Framing error
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
109 self.ck_err = 0 # Checksum error
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
110 self.rx_cnt = 0 # Packet count
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
111
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
112 self.pktq = []
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
113 self.s = s
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
114
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
115 def processstr(self, data):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
116 return self.process(map(ord, data))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
117
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
118 def process(self, data):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
119 pktcount = 0
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
120 for d in data:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
121 #print "Looking at 0x%02x, state = %s" % (d, self.state)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
122 if (self.state == 'init1'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
123 self.buffer = []
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
124 if (d != 0xa0):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
125 print "Start1 framing error, got 0x%02x, expected 0xa0" % d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
126 self.fr_err += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
127 continue
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
128
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
129 self.state = 'init2'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
130 elif (self.state == 'init2'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
131 if (d != 0xa2):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
132 print "Start2 framing error, got 0x%02x, expected 0xa2" % d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
133 self.fr_err += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
134 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
135 continue
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
136
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
137 self.state = 'sizemsb'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
138 elif (self.state == 'sizemsb'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
139 #print "Size1 - 0x%02x" % (d)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
140 if d > 0x7f:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
141 print "size msb too high (0x%02x)" % (d)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
142 self.fr_err += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
143 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
144 continue
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
145
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
146 self.sizemsb = d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
147 self.state = 'sizelsb'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
148 elif (self.state == 'sizelsb'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
149 #print "Size2 - 0x%02x" % (d)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
150 self.dataleft = self.sizemsb << 8 | d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
151 if self.dataleft < 1:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
152 print "size is too small (0x%04x)" % (self.dataleft)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
153 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
154 continue
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
155 if self.dataleft > 1024:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
156 print "size too large (0x%04x)" % (self.dataleft)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
157 self.fr_err += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
158 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
159 continue
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
160 #print "Pkt size - 0x%04x" % (self.dataleft)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
161 self.state = 'data'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
162 elif (self.state == 'data'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
163 self.buffer.append(d)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
164 self.dataleft = self.dataleft - 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
165
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
166 if self.dataleft == 0:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
167 self.state = 'cksum1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
168
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
169 elif (self.state == 'cksum1'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
170 self.cksummsb = d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
171 self.state = 'cksum2'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
172 elif (self.state == 'cksum2'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
173 self.rxcksum = self.cksummsb << 8 | d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
174 self.state = 'end1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
175 elif (self.state == 'end1'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
176 if (d != 0xb0):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
177 print "End1 framing error, got 0x%02x, expected 0xb0" % d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
178 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
179 self.fr_err += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
180 continue
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
181
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
182 self.state = 'end2'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
183 elif (self.state == 'end2'):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
184 if (d != 0xb3):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
185 print "End2 framing error, got 0x%02x, expected 0xb3" % d
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
186 self.fr_err += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
187 else:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
188 pktsum = reduce(lambda x, y: x + y, self.buffer) & 0x7fff
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
189 if (pktsum != self.rxcksum):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
190 print "Checksum error: got 0x%04x, expected 0x%04x" % \
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
191 (self.rxcksum, pktsum)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
192 print "buffer is %s" % (str(self.buffer))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
193 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
194 self.ck_err += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
195 else:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
196 p = Parser.Build(self.buffer)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
197 #self.pktq.append(p)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
198 pktcount += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
199 self.rx_cnt += 1
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
200
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
201 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
202 else:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
203 print "Invalid state %s! Resetting" % (self.state)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
204 self.state = 'init1'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
205
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
206 return pktcount
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
207
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
208 def dumpmsgs(self, s):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
209 s.setTimeout(0.1)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
210 while True:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
211 self.processstr(s.read(100))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
212
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
213 @classmethod
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
214 def Encap(self, data):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
215 cksum = reduce(lambda x, y: x + y, data)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
216 dlen = len(data)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
217 out = [ 0xa0, 0xa2 ]
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
218 out.append((dlen & 0xff00) >> 8)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
219 out.append(dlen & 0xff)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
220 out.extend(data)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
221 out.append((cksum & 0xff00) >> 8)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
222 out.append(cksum & 0xff)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
223 out.extend([0xb0, 0xb3])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
224 return out
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
225
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
226 @classmethod
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
227 def OrdLsttoStr(self, data):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
228 return reduce(lambda x, y: x + y, map(chr, data))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
229
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
230 @classmethod
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
231 def Build(self, data):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
232 t = time.time()
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
233 t1 = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(t))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
234 t2 = (t - int(t)) * 1e3
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
235 tfmt = "%s.%03d" % (t1, t2)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
236 if data[0] in sirfoutpktdsc:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
237 print "%s: Got out packet 0x%02x : %s" % (tfmt, data[0], sirfoutpktdsc[data[0]])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
238 elif data[0] in sirfinpktdsc:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
239 print "%s: Got in packet 0x%02x : %s" % (tfmt, data[0], sirfinpktdsc[data[0]])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
240 else:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
241 print "%s: Unknown packet type 0x%02x" % (tfmt, data[0])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
242 print "Payload - " + str(data[1:])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
243
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
244 if data[0] == 0x02:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
245 fmt = '>iiihhhBBBhIB'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
246 datastr = reduce(lambda x, y: x + y, map(chr, data[1:struct.calcsize(fmt) + 1]))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
247 (xpos, ypos, zpos, xvel, yvel, zvel, mode1, hdop, mode2, gpsweek, gpstow, nsats) = \
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
248 struct.unpack(fmt, datastr)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
249
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
250 satprn = []
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
251 for i in xrange(nsats):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
252 satprn.append(data[struct.calcsize(fmt) + i])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
253
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
254 xvel = float(xvel) / 8
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
255 yvel = float(yvel) / 8
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
256 zvel = float(zvel) / 8
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
257 print " Position: X: %d, Y: %d, Z: %d" % (xpos, ypos, zpos)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
258 print " Velocity: X: %.2f, Y: %.2f, Z: %.2f" % (xvel, yvel, zvel)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
259 elif data[0] == 0x06:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
260 nulidx = data.index(0)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
261 print " SW Ver : %s" % (reduce(lambda x, y: x + y, map(chr, data[1:nulidx])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
262 elif data[0] == 0x0a:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
263 errid = data[1] << 8 | data[2]
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
264 dlen = (data[3] << 8 | data[4]) * 4
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
265 print " Error ID : 0x%04x" % (errid)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
266 if dlen > 0:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
267 print " Length : 0x%04x" % (dlen)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
268 print " Payload : %s" % (data[5:])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
269 elif data[0] == 0x0b:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
270 print " Cmd Ack : 0x%02x" % (data[1])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
271 elif data[0] == 0x0c:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
272 print " Cmd NAck : 0x%02x" % (data[1])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
273 elif data[0] == 0x29:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
274 fixtype = {
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
275 0 : "none",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
276 1 : "1-SV KF",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
277 2 : "2-SV KF",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
278 3 : "3-SV KF",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
279 4 : "4+-SV KF",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
280 5 : "2D",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
281 6 : "3D",
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
282 7 : "DR"
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
283 }
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
284 fmt = '>HHHIHBBBBHIiiiiBHHHHHIIIHIIIIIHHBBB'
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
285 datastr = reduce(lambda x, y: x + y, map(chr, data[1:struct.calcsize(fmt) + 1]))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
286 (navval, navtype, ewn, tow, year, month, day, hour, minute, second, satlst,
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
287 latitude, longitude, alt_elip, alt_msl, datum, sog, cog, magvar, climbrate,
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
288 headrate, estHPE, estVPE, estTE, estHVE, clockbias, CBerr, clockdrift,
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
289 CDerr, distance, distanceErr, headErr, numsvs, hdop, addmodeinfo) = \
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
290 struct.unpack(fmt, datastr)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
291 tow = float(tow) / 1e3
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
292 latitude = float(latitude) / 1e7
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
293 longitude = float(longitude) / 1e7
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
294 alt_elip = float(alt_elip) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
295 alt_msl = float(alt_msl) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
296 sog = float(sog) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
297 cog = float(cog) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
298 climbrate = float(climbrate) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
299 headrate = float(headrate) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
300 estHPE = float(estHPE) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
301 estVPE = float(estVPE) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
302 estTE = float(estTE) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
303 estHVE = float(estHVE) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
304 clockbias = float(clockbias) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
305 CBerr = float(CBerr) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
306 clockdrift = float(clockdrift) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
307 CDerr = float(CDerr) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
308 headErr = float(headErr) / 1e2
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
309 hdop = float(hdop) / 5
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
310
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
311 print " Fix : %s, Sats : %d, Lat: %s, Long: %s, Alt: %.2fm" % \
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
312 (fixtype[navtype & 0x7], numsvs, fmtlatlong(latitude), fmtlatlong(longitude), \
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
313 alt_msl)
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
314 elif data[0] == 0xa6:
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
315 print " Message rate : MID 0x%02x, rate 0x%02x" % (data[2], data[3])
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
316
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
317 def enablemsgs(s):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
318 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
319 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
320 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
321 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
322 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x0d, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
323 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x29, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
324 #s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x34, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
325 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
326
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
327
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
328 def disablemsgs(s):
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
329 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
330 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
331 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
332 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
333 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
334 #s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
335 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
336 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
337 s.write(Parser.OrdLsttoStr(Parser.Encap([0xa6, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00])))
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
338
6503256a3fc4 Prototype code for parsing SiRF messages.
darius@Inchoate
parents:
diff changeset
339