summaryrefslogtreecommitdiff
path: root/ubxtool
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2019-05-22 13:57:46 -0700
committerGary E. Miller <gem@rellim.com>2019-05-22 14:49:11 -0700
commit936938c17ea78ee5633e88bbf8b25f2e83d53af3 (patch)
tree784362c2dd0ab68b138d3b8be9c02c4a346a8f2b /ubxtool
parent8c6fbec40bb33e77ede335d2675eb891540f76a6 (diff)
downloadgpsd-936938c17ea78ee5633e88bbf8b25f2e83d53af3.tar.gz
ubxtool: More GPS Subframe 1, 4 and 5 decode.
A long ways to go...
Diffstat (limited to 'ubxtool')
-rwxr-xr-xubxtool162
1 files changed, 154 insertions, 8 deletions
diff --git a/ubxtool b/ubxtool
index 3d7b6eda..0c4e8a18 100755
--- a/ubxtool
+++ b/ubxtool
@@ -3213,6 +3213,17 @@ class ubx(object):
return s
+ # decode GPS subframe 5, pages 1 to 24,
+ # and subframe 4, pages 2 to 5, and 7 to 10
+ def almanac(self, words):
+ """Decode GPS Almanac"""
+ s = " Almanac"
+ # s += ("\n dataid %u svid %u theta %d\n" %
+ # (words[2] >> 28,
+ # (words[2] >> 22) & 0x3f),
+ # (words[2] >> 6 & 0xff))
+ return s
+
cnav_msgids = {
10: "Ephemeris 1",
11: "Ephemeris 2",
@@ -3230,6 +3241,84 @@ class ubx(object):
37: "Clock & Midi Almanac",
}
+ # map subframe 4 SV ID to Page number
+ sbfr4_svid_page = {
+ 57: 1,
+ 25: 2,
+ 26: 3,
+ 27: 4,
+ 28: 5,
+ 57: 6,
+ 29: 7,
+ 30: 8,
+ 31: 9,
+ 32: 10,
+ 57: 11,
+ 62: 12,
+ 52: 13,
+ 53: 14,
+ 54: 15,
+ 57: 16,
+ 55: 17,
+ 56: 18,
+ 58: 19,
+ 59: 20,
+ 57: 21,
+ 60: 22,
+ 61: 23,
+ 62: 24,
+ 63: 25,
+ }
+
+ # map subframe 5 SV ID to Page number
+ sbfr5_svid_page = {
+ 1: 1,
+ 2: 2,
+ 3: 3,
+ 4: 4,
+ 5: 5,
+ 6: 6,
+ 7: 7,
+ 8: 8,
+ 9: 9,
+ 10: 10,
+ 11: 11,
+ 21: 12,
+ 13: 13,
+ 14: 14,
+ 15: 15,
+ 16: 16,
+ 17: 17,
+ 18: 18,
+ 19: 19,
+ 20: 20,
+ 21: 21,
+ 22: 22,
+ 23: 23,
+ 24: 24,
+ 51: 25,
+ }
+
+ # URA Index to URA meters
+ ura_meters = {
+ 0: "2.40 m",
+ 1: "3.40 m",
+ 2: "4.85 m",
+ 3: "6.85 m",
+ 4: "9.65 m",
+ 5: "13.65 m",
+ 6: "24.00 m",
+ 7: "48.00 m",
+ 8: "96.00 m",
+ 9: "192.00 m",
+ 10: "384.00 m",
+ 11: "768.00 m",
+ 12: "1536.00 m",
+ 13: "3072.00 m",
+ 14: "6144.00 m",
+ 15: "Unk",
+ }
+
def rxm_sfrbx(self, buf):
"""UBX-RXM-SFRBX decode, Broadcast Navigation Data Subframe"""
@@ -3277,22 +3366,79 @@ class ubx(object):
subframe))
if 1 == subframe:
- s += ("\n WN %u\n" %
- (words[2] >> 20))
+ ura = (words[2] >> 14) & 0x0f
+ s += ("\n WN %u C/A on L2 %u URA %u (%s) SVH %#x\n" %
+ (words[2] >> 20,
+ (words[2] >> 18) & 0x03,
+ ura, index_s(ura, self.ura_meters),
+ (words[2] >> 8) & 0x3f))
+
elif 2 == subframe:
s += ("\n IODE %u\n" %
(words[2] >> 22))
+
elif 3 == subframe:
s += ("\n Cic %u\n" %
(words[2] >> 14))
+
elif 4 == subframe:
- s += ("\n dataid %u svid %u\n" %
- (words[2] >> 28,
- (words[2] >> 22) & 0x3f))
+ # all data in subfraaem 4 is "reserved",
+ # except for pages 13, 18, 15
+ # as of 2018, dataid is always 1.
+ svid = (words[2] >> 22) & 0x3f
+ page = index_s(svid, self.sbfr4_svid_page)
+ s += ("\n dataid %u svid %u (page %s)\n" %
+ (words[2] >> 28, svid, page))
+
+ if (((2 <= page and 5 >= page) or
+ (5 <= page and 10 >= page))):
+ s += self.almanac(words)
+ elif 13 == page:
+ s += " NWCT"
+ elif 17 == page:
+ s += (" Special messages: " +
+ chr((words[2] >> 14) & 0xff) +
+ chr((words[2] >> 6) & 0xff) +
+ chr((words[3] >> 22) & 0xff) +
+ chr((words[3] >> 14) & 0xff) +
+ chr((words[3] >> 6) & 0xff) +
+ chr((words[4] >> 22) & 0xff) +
+ chr((words[4] >> 14) & 0xff) +
+ chr((words[4] >> 6) & 0xff) +
+ chr((words[5] >> 22) & 0xff) +
+ chr((words[5] >> 14) & 0xff) +
+ chr((words[5] >> 6) & 0xff) +
+ chr((words[6] >> 22) & 0xff) +
+ chr((words[6] >> 14) & 0xff) +
+ chr((words[6] >> 6) & 0xff) +
+ chr((words[7] >> 22) & 0xff) +
+ chr((words[7] >> 14) & 0xff) +
+ chr((words[7] >> 6) & 0xff) +
+ chr((words[8] >> 22) & 0xff) +
+ chr((words[8] >> 14) & 0xff) +
+ chr((words[8] >> 6) & 0xff) +
+ chr((words[9] >> 22) & 0xff) +
+ chr((words[9] >> 14) & 0xff))
+
+ elif 18 == page:
+ s += " Ionospheric and UTC data"
+ elif 25 == page:
+ s += " A/S flags"
+ else:
+ s += " Reserved"
+
elif 5 == subframe:
- s += ("\n dataid %u svid %u\n" %
- (words[2] >> 28,
- (words[2] >> 22) & 0x3f))
+ svid = (words[2] >> 22) & 0x3f
+ page = index_s(svid, self.sbfr5_svid_page)
+ s += ("\n dataid %u svid %u (page %s)\n" %
+ (words[2] >> 28, svid, page))
+
+ if 1 <= page and 24 >= page:
+ s += self.almanac(words)
+ elif 25 == page:
+ s += " A/S flags"
+ else:
+ s += " Reserved"
return s