summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-09-19 14:25:06 -0700
committerGary E. Miller <gem@rellim.com>2018-09-19 14:25:06 -0700
commit66b8220dcdb6c5925dde244479e19dc295954cca (patch)
tree1082a902e992028ba6555d94dd941ef8960ba31d /contrib
parentdd4e54e710985d7aa39670825c696d9bb69ee6b7 (diff)
downloadgpsd-66b8220dcdb6c5925dde244479e19dc295954cca.tar.gz
ubxtool: add get/set UBX-CFG-PMS
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/ubxtool39
1 files changed, 37 insertions, 2 deletions
diff --git a/contrib/ubxtool b/contrib/ubxtool
index 6e27b10e..cc67c4c6 100755
--- a/contrib/ubxtool
+++ b/contrib/ubxtool
@@ -310,10 +310,25 @@ class ubx(object):
(self.class_id_s(u[0], u[1]), u[2], u[3], u[4], u[5], u[6], u[7]))
return s
+ def cfg_pms(self, buf):
+ "UBX-CFG-PMS decode, Power Mode Setup"
+
+ m_len = len(buf)
+ if 0 == m_len:
+ return " Poll request"
+
+ if 8 > m_len:
+ return "Bad Length %s" % m_len
+
+ u = struct.unpack_from('<BBHHBB', buf, 0)
+ s = (' version: %u powerSetupValue: %u'
+ ' period: %u onTime: %#x reserved1[ %u %u]' % u)
+ return s
+
def cfg_prt(self, buf):
"UBX-CFG-PRT decode"
+
m_len = len(buf)
- print(m_len)
if 0 == m_len:
return " Poll request"
@@ -331,6 +346,7 @@ class ubx(object):
def cfg_sbas(self, buf):
"UBX-CFG-SBAS decode"
+
m_len = len(buf)
if 8 > m_len:
return "Bad Length %s" % m_len
@@ -437,7 +453,10 @@ class ubx(object):
0x31: {'str': 'TP5', 'dec': cfg_tp5, 'name': 'UBX-CFG-TP5'},
0x3d: {'str': 'TMODE2', 'dec': cfg_tmode2,
'name': 'UBX-CFG-TMODE2'},
- 0x3e: {'str': 'GNSS', 'dec': cfg_gnss, 'name': 'UBX-CFG-GNSS'}}
+ 0x3e: {'str': 'GNSS', 'dec': cfg_gnss, 'name': 'UBX-CFG-GNSS'},
+ 0x86: {'str': 'PMS', 'dec': cfg_pms,
+ 'name': 'UBX-CFG-PMS'},
+ }
def inf_debug(self, buf):
"UBX-INF-DEBUG decode"
@@ -1677,6 +1696,19 @@ class ubx(object):
m_data = bytearray(0)
gps_model.gps_send(6, 0x24, m_data)
+ def send_cfg_pms(self):
+ "UBX-CFG-PMS, Get Power Management Settings"
+
+ if opts["mode"] is not None:
+ m_data = bytearray(8)
+ # set powerSetupValue to mode
+ m_data[1] = opts["mode"]
+ # leave period and onTime zero, which breaks powerSetupValue = 3
+ else:
+ m_data = bytearray(0)
+
+ gps_model.gps_send(6, 0x86, m_data)
+
def send_cfg_prt(self):
"UBX-CFG-PRT, get I/O Port"
m_data = bytearray(0)
@@ -1811,6 +1843,9 @@ class ubx(object):
# UBX-CFG-NAV5, poll Nav Engine Settings
"NAV5": {"command": send_cfg_nav5,
"help": "UBX-CFG-NAV5 poll Nav Engines settings"},
+ # UBX-CFG-PMS, poll power management settings
+ "PMS": {"command": send_cfg_pms,
+ "help": "UBX-CFG-PMS poll power management settings"},
# UBX-CFG-PRT, poll I/O port number
"PRT": {"command": send_cfg_prt,
"help": "UBX-CFG-PRT poll I/O port settings"},