|
|
@ -12,7 +12,8 @@ for ublox version 8, not all functions may work. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import struct |
|
|
|
import struct |
|
|
|
import time, os |
|
|
|
import os |
|
|
|
|
|
|
|
import time |
|
|
|
|
|
|
|
|
|
|
|
# protocol constants |
|
|
|
# protocol constants |
|
|
|
PREAMBLE1 = 0xb5 |
|
|
|
PREAMBLE1 = 0xb5 |
|
|
@ -291,7 +292,7 @@ class UBloxDescriptor: |
|
|
|
fields = self.fields[:] |
|
|
|
fields = self.fields[:] |
|
|
|
for f in fields: |
|
|
|
for f in fields: |
|
|
|
(fieldname, alen) = ArrayParse(f) |
|
|
|
(fieldname, alen) = ArrayParse(f) |
|
|
|
if not fieldname in msg._fields: |
|
|
|
if fieldname not in msg._fields: |
|
|
|
break |
|
|
|
break |
|
|
|
if alen == -1: |
|
|
|
if alen == -1: |
|
|
|
f1.append(msg._fields[fieldname]) |
|
|
|
f1.append(msg._fields[fieldname]) |
|
|
@ -327,7 +328,7 @@ class UBloxDescriptor: |
|
|
|
ret = self.name + ': ' |
|
|
|
ret = self.name + ': ' |
|
|
|
for f in self.fields: |
|
|
|
for f in self.fields: |
|
|
|
(fieldname, alen) = ArrayParse(f) |
|
|
|
(fieldname, alen) = ArrayParse(f) |
|
|
|
if not fieldname in msg._fields: |
|
|
|
if fieldname not in msg._fields: |
|
|
|
continue |
|
|
|
continue |
|
|
|
v = msg._fields[fieldname] |
|
|
|
v = msg._fields[fieldname] |
|
|
|
if isinstance(v, list): |
|
|
|
if isinstance(v, list): |
|
|
@ -591,7 +592,7 @@ class UBloxMessage: |
|
|
|
if not self.valid(): |
|
|
|
if not self.valid(): |
|
|
|
raise UBloxError('INVALID MESSAGE') |
|
|
|
raise UBloxError('INVALID MESSAGE') |
|
|
|
type = self.msg_type() |
|
|
|
type = self.msg_type() |
|
|
|
if not type in msg_types: |
|
|
|
if type not in msg_types: |
|
|
|
raise UBloxError('Unknown message %s length=%u' % (str(type), len(self._buf))) |
|
|
|
raise UBloxError('Unknown message %s length=%u' % (str(type), len(self._buf))) |
|
|
|
msg_types[type].unpack(self) |
|
|
|
msg_types[type].unpack(self) |
|
|
|
return self._fields, self._recs |
|
|
|
return self._fields, self._recs |
|
|
@ -601,7 +602,7 @@ class UBloxMessage: |
|
|
|
if not self.valid(): |
|
|
|
if not self.valid(): |
|
|
|
raise UBloxError('INVALID MESSAGE') |
|
|
|
raise UBloxError('INVALID MESSAGE') |
|
|
|
type = self.msg_type() |
|
|
|
type = self.msg_type() |
|
|
|
if not type in msg_types: |
|
|
|
if type not in msg_types: |
|
|
|
raise UBloxError('Unknown message %s' % str(type)) |
|
|
|
raise UBloxError('Unknown message %s' % str(type)) |
|
|
|
msg_types[type].pack(self) |
|
|
|
msg_types[type].pack(self) |
|
|
|
|
|
|
|
|
|
|
@ -610,7 +611,7 @@ class UBloxMessage: |
|
|
|
if not self.valid(): |
|
|
|
if not self.valid(): |
|
|
|
raise UBloxError('INVALID MESSAGE') |
|
|
|
raise UBloxError('INVALID MESSAGE') |
|
|
|
type = self.msg_type() |
|
|
|
type = self.msg_type() |
|
|
|
if not type in msg_types: |
|
|
|
if type not in msg_types: |
|
|
|
raise UBloxError('Unknown message %s length=%u' % (str(type), len(self._buf))) |
|
|
|
raise UBloxError('Unknown message %s length=%u' % (str(type), len(self._buf))) |
|
|
|
return msg_types[type].name |
|
|
|
return msg_types[type].name |
|
|
|
|
|
|
|
|
|
|
|