pyubx2 package
Submodules
pyubx2.exceptions module
UBX Custom Exception Types.
Created on 27 Sep 2020
- author:
semuadmin
- copyright:
SEMU Consulting © 2020
- license:
BSD 3-Clause
pyubx2.socket_wrapper module
socket_wrapper class.
A skeleton socket wrapper which provides basic stream-like read(bytes) and readline() methods.
NB: this will read from a socket indefinitely. It is the responsibility of the calling application to monitor data returned and implement appropriate socket error, timeout or inactivity procedures.
Created on 4 Apr 2022
- author:
semuadmin
- copyright:
SEMU Consulting © 2022
- license:
BSD 3-Clause
- class pyubx2.socket_wrapper.SocketWrapper(sock: socket, **kwargs)[source]
Bases:
object
Socket wrapper class.
- __init__(sock: socket, **kwargs)[source]
Constructor.
- Parameters:
socket (sock) – socket object
bufsize (int) – (kwarg) internal buffer size (4096)
- property buffer: bytearray
Getter for buffer.
- Returns:
buffer
- Return type:
bytearray
- read(num: int) bytes [source]
Read specified number of bytes from buffer. NB: always check length of return data.
- Parameters:
num (int) – number of bytes to read
- Returns:
bytes read (which may be less than num)
- Return type:
bytes
pyubx2.ubxhelpers module
Collection of UBX helper methods which can be used outside the UBXMessage or UBXReader classes.
Created on 15 Dec 2020
- author:
semuadmin
- copyright:
SEMU Consulting © 2020
- license:
BSD 3-Clause
- pyubx2.ubxhelpers.att2idx(att: str) object [source]
Get integer indices corresponding to grouped attribute.
e.g. svid_06 -> 6; gnssId_103 -> 103, gsid_03_04 -> (3,4), tow -> 0
- Parameters:
att (str) – grouped attribute name e.g. svid_01
- Returns:
indices as integer(s), or 0 if not grouped
- Return type:
int or tuple for nested group
- pyubx2.ubxhelpers.att2name(att: str) str [source]
Get name of grouped attribute.
e.g. svid_06 -> svid; gnssId_103 -> gnssId, tow -> tow
- Parameters:
att (str) – grouped attribute name e.g. svid_01
- Returns:
name without index e.g. svid
- Return type:
str
- pyubx2.ubxhelpers.calc_checksum(content: bytes) bytes [source]
Calculate checksum using 8-bit Fletcher’s algorithm.
- Parameters:
content (bytes) – message content, excluding header and checksum bytes
- Returns:
checksum
- Return type:
bytes
- pyubx2.ubxhelpers.isvalid_checksum(message: bytes) bool [source]
Validate message checksum.
- Parameters:
message (bytes) – message including header and checksum bytes
- Returns:
checksum valid flag
- Return type:
bool
- pyubx2.ubxhelpers.atttyp(att: str) str [source]
Helper function to return attribute type as string.
- Parameters:
str – attribute type e.g. ‘U002’
- Returns:
type of attribute as string e.g. ‘U’
- Return type:
str
- pyubx2.ubxhelpers.attsiz(att: str) int [source]
Helper function to return attribute size in bytes.
- Parameters:
str – attribute type e.g. ‘U002’
- Returns:
size of attribute in bytes, or -1 if variable length
- Return type:
int
- pyubx2.ubxhelpers.itow2utc(itow: int) time [source]
Convert GPS Time Of Week to UTC time
- Parameters:
itow (int) – GPS Time Of Week in milliseconds
- Returns:
UTC time hh.mm.ss
- Return type:
datetime.time
- pyubx2.ubxhelpers.utc2itow(utc: datetime) tuple [source]
Convert UTC datetime to GPS Week Number, Time Of Week
- Parameters:
utc (datetime) – datetime
- Returns:
GPS Week Number, Time of Week in milliseconds
- Return type:
tuple
- pyubx2.ubxhelpers.gpsfix2str(fix: int) str [source]
Convert GPS fix integer to descriptive string.
- Parameters:
fix (int) – GPS fix type (0-5)
- Returns:
GPS fix type as string
- Return type:
str
- pyubx2.ubxhelpers.dop2str(dop: float) str [source]
Convert Dilution of Precision float to descriptive string.
- Parameters:
dop (float) – dilution of precision as float
- Returns:
dilution of precision as string
- Return type:
str
- pyubx2.ubxhelpers.gnss2str(gnss_id: int) str [source]
Convert GNSS ID to descriptive string (‘GPS’, ‘GLONASS’, etc.).
- Parameters:
gnss_id (int) – GNSS identifier as integer (0-6)
- Returns:
GNSS identifier as string
- Return type:
str
- pyubx2.ubxhelpers.key_from_val(dictionary: dict, value) str [source]
Helper method - get dictionary key corresponding to (unique) value.
- Parameters:
dictionary (dict) – dictionary
value (object) – unique dictionary value
- Returns:
dictionary key
- Return type:
str
- Raises:
KeyError: if no key found for value
- pyubx2.ubxhelpers.get_bits(bitfield: bytes, bitmask: int) int [source]
Get integer value of specified (masked) bit(s) in a UBX bitfield (attribute type ‘X’)
e.g. to get value of bits 6,7 in bitfield b’\x89’ (binary 0b10001001):
get_bits(b'\x89', 0b11000000) = get_bits(b'\x89', 192) = 2
- Parameters:
bitfield (bytes) – bitfield byte(s)
bitmask (int) – bitmask as integer (= Σ(2**n), where n is the number of the bit)
- Returns:
value of masked bit(s)
- Return type:
int
- pyubx2.ubxhelpers.val2bytes(val, att: str) bytes [source]
Convert value to bytes for given UBX attribute type.
- Parameters:
val (object) – attribute value e.g. 25
att (str) – attribute type e.g. ‘U004’
- Returns:
attribute value as bytes
- Return type:
bytes
- Raises:
UBXTypeError
- pyubx2.ubxhelpers.bytes2val(valb: bytes, att: str) object [source]
Convert bytes to value for given UBX attribute type.
- Parameters:
valb (bytes) – attribute value in byte format e.g. b’\x19\x00\x00\x00’
att (str) – attribute type e.g. ‘U004’
- Returns:
attribute value as int, float, str or bytes
- Return type:
object
- Raises:
UBXTypeError
- pyubx2.ubxhelpers.nomval(att: str) object [source]
Get nominal value for given UBX attribute type.
- Parameters:
att (str) – attribute type e.g. ‘U004’
- Returns:
attribute value as int, float, str or bytes
- Return type:
object
- Raises:
UBXTypeError
- pyubx2.ubxhelpers.msgclass2bytes(msgclass: int, msgid: int) bytes [source]
Convert message class/id integers to bytes.
- Parameters:
msgClass (int) – message class as integer e.g. 6
msgID (int) – message ID as integer e.g. 1
- Returns:
message class as bytes e.g. b’/x06/x01’
- Return type:
bytes
- pyubx2.ubxhelpers.msgstr2bytes(msgclass: str, msgid: str) bytes [source]
Convert plain text UBX message class to bytes.
- Parameters:
msgClass (str) – message class as str e.g. ‘CFG’
msgID (str) – message ID as str e.g. ‘CFG-MSG’
- Returns:
message class as bytes e.g. b’/x06/x01’
- Return type:
bytes
- Raises:
UBXMessageError
- pyubx2.ubxhelpers.cfgname2key(name: str) tuple [source]
Return hexadecimal key and data type for given configuration database key name.
- Parameters:
name (str) – config key as string e.g. “CFG_NMEA_PROTVER”
- Returns:
tuple of (key, type)
- Return type:
tuple: (int, str)
- Raises:
UBXMessageError
- pyubx2.ubxhelpers.cfgkey2name(keyid: int) tuple [source]
Return key name and data type for given configuration database hexadecimal key.
- Parameters:
keyID (int) – config key as integer e.g. 0x20930001
- Returns:
tuple of (keyname, type)
- Return type:
tuple: (str, str)
- Raises:
UBXMessageError
- pyubx2.ubxhelpers.protocol(raw: bytes) int [source]
Gets protocol of raw message.
- Parameters:
raw (bytes) – raw (binary) message
- Returns:
protocol type (1 = NMEA, 2 = UBX, 4 = RTCM3, 0 = unknown)
- Return type:
int
- pyubx2.ubxhelpers.hextable(raw: bytes, cols: int = 8) str [source]
Formats raw (binary) message in tabular hexadecimal format e.g.
000: 2447 4e47 5341 2c41 2c33 2c33 342c 3233 | b’$GNGSA,A,3,34,23’ |
- Parameters:
raw (bytes) – raw (binary) data
cols (int) – number of columns in hex table (8)
- Returns:
table of hex data
- Return type:
str
- pyubx2.ubxhelpers.cel2cart(elevation: float, azimuth: float) tuple [source]
Convert celestial coordinates (degrees) to Cartesian coordinates.
- Parameters:
elevation (float) – elevation
azimuth (float) – azimuth
- Returns:
cartesian x,y coordinates
- Return type:
tuple
- pyubx2.ubxhelpers.escapeall(val: bytes) str [source]
Escape all byte characters e.g. b’\x73’ rather than b`s`
- Parameters:
val (bytes) – bytes
- Returns:
string of escaped bytes
- Return type:
str
- pyubx2.ubxhelpers.val2sphp(val: float, scale: float = 1e-07) tuple [source]
Convert a float value into separate standard and high precisions components, multiplied by a scaling factor to render them as integers, as required by some CFG and NAV messages.
e.g. 48.123456789 becomes (481234567, 89)
- Parameters:
val (float) – value as float
scale (float) – scaling factor e.g. 1e-7
- Returns:
tuple of (standard precision, high precision)
- Return type:
tuple
- pyubx2.ubxhelpers.getinputmode(data: bytes) int [source]
Return input message mode (SET or POLL).
- Parameters:
data (bytes) – raw UBX input message
- Returns:
message mode (1 = SET, 2 = POLL)
- Return type:
int
- pyubx2.ubxhelpers.process_monver(msg: object) dict [source]
Process parsed MON-VER sentence into dictionary of hardware, firmware and software version identifiers.
- Parameters:
msg (UBXMessage) – UBX MON-VER config message
- Returns:
dict of version information
- Return type:
dict
- pyubx2.ubxhelpers.val2twoscomp(val: int, att: str) int [source]
Convert signed integer to two’s complement binary representation.
- Parameters:
val (int) – value
att (str) – attribute type e.g. “U024”
- Returns:
two’s complement representation of value
- Return type:
int
- pyubx2.ubxhelpers.val2signmag(val: int, att: str) int [source]
Convert signed integer to sign magnitude binary representation.
High-order bit represents sign (0 +ve, 1 -ve).
- Parameters:
val (int) – value
att (str) – attribute type e.g. “U024”
- Returns:
sign magnitude representation of value
- Return type:
int
pyubx2.ubxmessage module
ubxmessage.py
Main UBX Message Protocol Class.
Created on 26 Sep 2020
- author:
semuadmin
- copyright:
SEMU Consulting © 2020
- license:
BSD 3-Clause
- class pyubx2.ubxmessage.UBXMessage(ubxClass, ubxID, msgmode: int, parsebitfield: bool = True, **kwargs)[source]
Bases:
object
UBX Message Class.
- __init__(ubxClass, ubxID, msgmode: int, parsebitfield: bool = True, **kwargs)[source]
Constructor.
If no keyword parms are passed, the payload is taken to be empty.
If ‘payload’ is passed as a keyword parm, this is taken to contain the complete payload as a sequence of bytes; any other keyword parms are ignored.
Otherwise, any named attributes will be assigned the value given, all others will be assigned a nominal value according to type.
- Parameters:
msgClass (object) – message class as str, int or byte
msgID (object) – message ID as str, int or byte
msgmode (int) – message mode (0=GET, 1=SET, 2=POLL)
parsebitfield (bool) – parse bitfields (‘X’ type attributes) Y/N
kwargs – optional payload keyword arguments
- Raises:
UBXMessageError
- property identity: str
Returns message identity in plain text form.
If the message is unrecognised, the message is parsed to a nominal payload definition UBX-NOMINAL and the term ‘NOMINAL’ is appended to the identity.
- Returns:
message identity e.g. ‘CFG-MSG’
- Return type:
str
- property msg_cls: bytes
Class id getter.
- Returns:
message class as bytes
- Return type:
bytes
- property msg_id: bytes
Message id getter.
- Returns:
message id as bytes
- Return type:
bytes
- property length: int
Payload length getter.
- Returns:
payload length as integer
- Return type:
int
- property payload: bytes
Payload getter - returns the raw payload bytes.
- Returns:
raw payload as bytes
- Return type:
bytes
- property msgmode: int
Message mode getter.
- Returns:
msgmode as integer
- Return type:
int
- static config_set(layers: int, transaction: int, cfgData: list) object [source]
Construct CFG-VALSET message from an array of configuration database (key, value) tuples. Keys can be in int (keyID) or str (keyname) format.
- Parameters:
layers (int) – memory layer(s) SET_LAYER_RAM (1) = RAM, SET_LAYER_BBR (2) = Battery Backed RAM, SETLAYER_FLASH (4) = Flash
transaction (int) – TXN_NONE (0) = no txn, TXN _START (1) = start txn, TXN_ONGOING (2) = continue txn, TXT_COMMIT (3) = apply txn
cfgData (list) – list of up to 64 tuples (key, value)
- Returns:
UBXMessage CFG-VALSET
- Return type:
- Raises:
UBXMessageError
- static config_del(layers: int, transaction: int, keys: list) object [source]
Construct CFG-VALDEL message from an array of configuration database keys. Keys can be in int (keyID) or str (keyname) format.
- Parameters:
layers (int) – non-volatile memory layer(s) SET_LAYER_BBR (2) = Battery Backed RAM, SET_LAYER_FLASH (4) = Flash
transaction (int) – TXN_NONE (0) = no txn, TXN _START (1) = start txn, TXN_ONGOING (2) = continue txn, TXT_COMMIT (3) = apply txn
keys (list) – array of up to 64 keys as int (keyID) or string (keyname)
- Returns:
UBXMessage CFG-VALDEL
- Return type:
- Raises:
UBXMessageError
- static config_poll(layer: int, position: int, keys: list) object [source]
Construct CFG-VALGET message from an array of configuration database keys, which can be in int (keyID) or str (keyname) format.
- Parameters:
layer (int) – memory layer POLL_LAYER_RAM (0) = RAM, POLL_LAYER_BBR (1) = Battery-backed RAM, POLL_LAYER_FLASH (2) = Flash, POLL_LAYER_DEFAULT (7) = Default
position (int) – number of keys to skip before returning result
keys (list) – array of up to 64 keys as int (keyID) or str (keyname)
- Returns:
UBXMessage CFG-VALGET
- Return type:
- Raises:
UBXMessageError
pyubx2.ubxreader module
UBXReader class.
Reads and parses individual UBX, NMEA or RTCM3 messages from any viable data stream which supports a read(n) -> bytes method.
Returns both the raw binary data (as bytes) and the parsed data (as a UBXMessage, NMEAMessage or RTCMMessage object).
‘protfilter’ governs which protocols (NMEA, UBX or RTCM3) are processed
‘quitonerror’ governs how errors are handled
‘msgmode’ indicates the type of UBX datastream (output GET, input SET, query POLL). If msgmode is set to SETPOLL, input/query mode will be automatically detected by parser.
Created on 2 Oct 2020
- author:
semuadmin
- copyright:
SEMU Consulting © 2020
- license:
BSD 3-Clause
- class pyubx2.ubxreader.UBXReader(datastream, msgmode: int = 0, validate: int = 1, protfilter: int = 7, quitonerror: int = 1, parsebitfield: bool = True, labelmsm: int = 1, bufsize: int = 4096, parsing: bool = True, errorhandler: object = None)[source]
Bases:
object
UBXReader class.
- __init__(datastream, msgmode: int = 0, validate: int = 1, protfilter: int = 7, quitonerror: int = 1, parsebitfield: bool = True, labelmsm: int = 1, bufsize: int = 4096, parsing: bool = True, errorhandler: object = None)[source]
Constructor.
- Parameters:
stream (datastream) – input data stream
msgmode (int) – 0=GET, 1=SET, 2=POLL, 3=SETPOLL (0)
validate (int) – VALCKSUM (1) = Validate checksum, VALNONE (0) = ignore invalid checksum (1)
protfilter (int) – NMEA_PROTOCOL (1), UBX_PROTOCOL (2), RTCM3_PROTOCOL (4), Can be OR’d (7)
quitonerror (int) – ERR_IGNORE (0) = ignore errors, ERR_LOG (1) = log continue, ERR_RAISE (2) = (re)raise (1)
parsebitfield (bool) – 1 = parse bitfields, 0 = leave as bytes (1)
labelmsm (int) – RTCM3 MSM label type 1 = RINEX, 2 = BAND (1)
bufsize (int) – socket recv buffer size (4096)
parsing (bool) – True = parse data, False = don’t parse data (output raw only) (True)
errorhandler (object) – error handling object or function (None)
- Raises:
UBXStreamError (if mode is invalid)
- read() tuple [source]
Read a single NMEA, UBX or RTCM3 message from the stream buffer and return both raw and parsed data.
‘protfilter’ determines which protocols are parsed. ‘quitonerror’ determines whether to raise, log or ignore parsing errors.
- Returns:
tuple of (raw_data as bytes, parsed_data as UBXMessage, NMEAMessage or RTCMMessage)
- Return type:
tuple
- Raises:
Exception (if invalid or unrecognised protocol in data stream)
- property datastream: object
Getter for stream.
- Returns:
data stream
- Return type:
object
- static parse(message: bytes, msgmode: int = 0, validate: int = 1, parsebitfield: bool = True) object [source]
Parse UBX byte stream to UBXMessage object.
- Parameters:
message (bytes) – binary message to parse
msgmode (int) – GET (0), SET (1), POLL (2) (0)
validate (int) – VALCKSUM (1) = Validate checksum, VALNONE (0) = ignore invalid checksum (1)
parsebitfield (bool) – 1 = parse bitfields, 0 = leave as bytes (1)
- Returns:
UBXMessage object
- Return type:
- Raises:
Exception (if data stream contains invalid data or unknown message type)
pyubx2.ubxtypes_configdb module
UBX Protocol Configuration Database Keys.
Used by CFG_VALGET, CFG_VALSET and CFG_VALDEL message types.
- Format:
“keyname”: (keyID, “type”)
Created on 30 Nov 2020
Information sourced from u-blox Interface Specifications © 2013-2021, u-blox AG
- author:
semuadmin
- pyubx2.ubxtypes_configdb.SET_LAYER_RAM = 1
Set RAM (volatile) memory layer in UBX-CFG-VALSET, UBX-CFG-VALDEL
- pyubx2.ubxtypes_configdb.SET_LAYER_BBR = 2
Set Battery-backed RAM memory layer in UBX-CFG-VALSET, UBX-CFG-VALDEL
- pyubx2.ubxtypes_configdb.SET_LAYER_FLASH = 4
Set Flash memory layer in UBX-CFG-VALSET, UBX-CFG-VALDEL
- pyubx2.ubxtypes_configdb.POLL_LAYER_RAM = 0
Poll RAM (volatile) memory layer in UBX-CFG-VALGET
- pyubx2.ubxtypes_configdb.POLL_LAYER_BBR = 1
Poll Battery-backed RAM memory layer in UBX-CFG-VALGET
- pyubx2.ubxtypes_configdb.POLL_LAYER_FLASH = 2
Poll Flash memory layer in UBX-CFG-VALGET
- pyubx2.ubxtypes_configdb.POLL_LAYER_DEFAULT = 7
Poll factory default (immutable) memory layer in UBX-CFG-VALGET
- pyubx2.ubxtypes_configdb.TXN_NONE = 0
Transaction none in UBX-CFG-VALSET, UBX-CFG-VALDEL
- pyubx2.ubxtypes_configdb.TXN_START = 1
Transaction start in UBX-CFG-VALSET, UBX-CFG-VALDEL
- pyubx2.ubxtypes_configdb.TXN_ONGOING = 2
Transaction ongoing in UBX-CFG-VALSET, UBX-CFG-VALDEL
- pyubx2.ubxtypes_configdb.TXN_COMMIT = 3
Transaction commit in UBX-CFG-VALSET, UBX-CFG-VALDEL
pyubx2.ubxtypes_core module
UBX Protocol core globals, constants, datatypes and message identifiers.
Created on 27 Sep 2020
Information sourced from public domain u-blox Interface Specifications © 2013-2021, u-blox AG
- author:
semuadmin
- pyubx2.ubxtypes_core.UBX_HDR = b'\xb5b'
UBX message header
- pyubx2.ubxtypes_core.GET = 0
GET (receive, response) message types
- pyubx2.ubxtypes_core.SET = 1
SET (command) message types
- pyubx2.ubxtypes_core.POLL = 2
POLL (query) message types
- pyubx2.ubxtypes_core.SETPOLL = 3
SETPOLL (SET or POLL) message types
- pyubx2.ubxtypes_core.VALNONE = 0
Do not validate checksum
- pyubx2.ubxtypes_core.VALCKSUM = 1
Validate checksum
- pyubx2.ubxtypes_core.NMEA_PROTOCOL = 1
NMEA Protocol
- pyubx2.ubxtypes_core.UBX_PROTOCOL = 2
UBX Protocol
- pyubx2.ubxtypes_core.RTCM3_PROTOCOL = 4
RTCM3 Protocol
- pyubx2.ubxtypes_core.ERR_RAISE = 2
Raise error and quit
- pyubx2.ubxtypes_core.ERR_LOG = 1
Log errors
- pyubx2.ubxtypes_core.ERR_IGNORE = 0
Ignore errors
- pyubx2.ubxtypes_core.ATTTYPE = {'A': <class 'list'>, 'C': (<class 'bytes'>, <class 'str'>), 'E': <class 'int'>, 'I': <class 'int'>, 'L': <class 'int'>, 'R': (<class 'int'>, <class 'float'>), 'U': <class 'int'>, 'X': <class 'bytes'>}
Permissible attribute types
pyubx2.ubxtypes_decodes module
UBX Protocol attribute value decode constants.
Created on 26 Aug 2023
Information sourced from public domain u-blox Interface Specifications © 2013-2021, u-blox AG
- author:
semuadmin
- pyubx2.ubxtypes_decodes.GNSSLIST = {0: 'GPS', 1: 'SBAS', 2: 'Galileo', 3: 'BeiDou', 4: 'IMES', 5: 'QZSS', 6: 'GLONASS', 7: 'NAVIC'}
GNSS code
- pyubx2.ubxtypes_decodes.DGNSMODE = {2: 'RTK float', 3: 'RTK fixed'}
Differential correction mode from UBX-CFG-DGNSS
- pyubx2.ubxtypes_decodes.CONFLVL = {0: 'no confidence required', 1: '68%', 2: '95%', 3: '99.7%', 4: '99.99%'}
Confidence level from UBX-CFG-GEOFENCE
- pyubx2.ubxtypes_decodes.SIGCFMASK = {(0, 1): 'GPS L1C/A', (0, 16): 'GPS L2C', (0, 32): 'GPS L5', (1, 1): 'SBAS L1C/A', (2, 1): 'Galileo E1', (2, 16): 'Galileo E5a', (2, 32): 'Galileo E5b', (3, 1): 'BeiDou B1I', (3, 16): 'BeiDou B2I', (3, 128): 'BeiDou B2A', (4, 1): 'IMES L1', (5, 1): 'QZSS L1C/A', (5, 4): 'QZSS L1S', (5, 16): 'QZSS L2C', (5, 32): 'QZSS L5', (6, 1): 'GLONASS L1', (6, 16): 'GLONASS L2'}
- Signal & carrier frequency code from UBX-CFG_GNSS
key is (gnssId, sigCfMask)
- pyubx2.ubxtypes_decodes.PROTOCOLID = {0: 'UBX', 1: 'NMEA'}
Protocol from UBX-CFG-INF
- pyubx2.ubxtypes_decodes.DYNMODEL = {0: 'portable', 2: 'stationary', 3: 'pedestrian', 4: 'automotive', 5: 'sea', 6: 'airborne with <1g acceleration', 7: 'airborne with <2g acceleration', 8: 'airborne with <4g acceleration', 9: 'wrist-worn watch', 10: 'motorbike', 11: 'robotic lawn mower', 12: 'electric kick scooter'}
Dynamic model from UBX-CFG-NAV5
- pyubx2.ubxtypes_decodes.FIXMODE = {1: '2D only', 2: '3D only', 3: 'auto 2D/3D'}
Fix mode from UBX-CFG-NAV5
- pyubx2.ubxtypes_decodes.NMEAVERSION = {33: 'NMEA version 2.1', 35: 'NMEA version 2.3', 64: 'NMEA version 4.0', 65: 'NMEA version 4.10', 75: 'NMEA version 4.11'}
NMEA version from UBX-CFG-NMEA
- pyubx2.ubxtypes_decodes.SVNUMBERING = {0: 'Strict - Satellites are not output', 1: 'Extended - Use proprietary numbering'}
Space vehicle numbering from UBX-CFG-NMEA
- pyubx2.ubxtypes_decodes.MAINTALKERID = {0: 'Main Talker ID is not overridden', 1: "Set main Talker ID to 'GP'", 2: "Set main Talker ID to 'GL'", 3: "Set main Talker ID to 'GN'", 4: "Set main Talker ID to 'GA'", 5: "Set main Talker ID to 'GB'", 6: "Set main Talker ID to 'GQ'"}
Main talker ID from UBX-CFG-NMEA
- pyubx2.ubxtypes_decodes.GSVTALKERID = {0: 'Use GNSS-specific Talker ID (as defined byNMEA)', 1: 'Use the main Talker ID'}
GSV talker ID from UBX-CFG-NMEA
- pyubx2.ubxtypes_decodes.ODOPROFILE = {0: 'running', 1: 'cycling', 2: 'swimming', 3: 'car', 4: 'custom'}
Odometer profile from UBX-CFG-ODO
- pyubx2.ubxtypes_decodes.CHARLEN = {0: '5bit', 1: '6bit', 16: '7bit', 17: '8bit'}
Serial port character length from UBX-CFG-PRT
- pyubx2.ubxtypes_decodes.PARITY = {'000': 'Even parity', '001': 'Odd parity', '10X': 'No parity', 'X1X': 'Reserved'}
Serial port parity from UBX-CFG-PRT
- pyubx2.ubxtypes_decodes.NSTOPBITS = {0: '1 Stop bit', 1: '1.5 Stop bit', 16: '2 Stop bit', 17: '0.5 Stop bit'}
Serial port stop bits from IBX-CFG-PRT
- pyubx2.ubxtypes_decodes.POL = {0: 'High-active', 1: 'Low-active'}
Serial port polarity from UBX-CFG-PRT
- pyubx2.ubxtypes_decodes.SPIMODE = {0: 'SPI Mode 0: CPOL = 0, CPHA = 0', 1: 'SPI Mode 1: CPOL = 0, CPHA = 1', 16: 'SPI Mode 2: CPOL = 1, CPHA = 0', 17: 'SPI Mode 3: CPOL = 1, CPHA = 1'}
SPI mode from UBX-CFG-PRT
- pyubx2.ubxtypes_decodes.STATE = {1111706448: 'Software backup', 1381322272: 'GNSS running', 1398034256: 'GNSS stopped'}
Power state from UBX-CFG-PWR
- pyubx2.ubxtypes_decodes.TIMEREF = {0: 'UTC time', 1: 'GPS time', 2: 'GLONASS time', 3: 'BeiDou time', 4: 'Galileo time', 5: 'NavIC time'}
Time reference from UBX-CFG-RATE
- pyubx2.ubxtypes_decodes.NAVBBRMASK = {0: 'Hot start', 1: 'Warm start', 65535: 'Cold start'}
Navigation battery-backed RAM mask from UBX-CFG-RST
- pyubx2.ubxtypes_decodes.RESETMODE = {0: 'Hardware reset (watchdog) immediately', 1: 'Controlled software reset', 2: 'Controlled software reset (GNSS only)', 4: 'Hardware reset (watchdog) after shutdown', 8: 'Controlled GNSS stop', 9: 'Controlled GNSS start'}
Reset mode from UBX-CFG-RST
- pyubx2.ubxtypes_decodes.MODE = {0: 'Disabled', 1: 'Survey In', 2: 'Fixed Mode'}
Timing mode from UBX-CFG-TMODE3
- pyubx2.ubxtypes_decodes.GRIDUTCGNSS = {0: 'UTC', 1: 'GPS', 2: 'GLONASS', 3: 'BeiDou', 4: 'Galileo'}
Timing Grid UTC GNSS source from UBX-CFG-TP5
- pyubx2.ubxtypes_decodes.PROTIDS = {0: 'UBX', 1: 'NMEA', 2: 'RTCM2', 5: 'RTCM3', 6: 'SPARTN', 255: 'No protocol reported'}
Protocol IDs from UBX-MON-COMMS
- pyubx2.ubxtypes_decodes.ASTATUS = {0: 'INIT', 1: 'DONTKNOW', 2: 'OK', 3: 'SHORT', 4: 'OPEN'}
Antenna status from UBX-MON-HW, UBX-MON-RF
- pyubx2.ubxtypes_decodes.APOWER = {0: 'OFF', 1: 'ON', 2: 'DONTKNOW'}
Antenna power from UBX-MON-HW, UBX-MON-RF
- pyubx2.ubxtypes_decodes.JAMMINGSTATE = {0: 'unknown or feature disabled', 1: 'ok - no significant jamming', 2: 'warning - interference visible but fix OK', 3: 'critical - interference visible and no fix'}
Jamming state from UBX-MON-HW, UBX-MON-RF
- pyubx2.ubxtypes_decodes.BOOTTYPE = {0: 'Unknown', 1: 'Cold Start', 2: 'Watchdog', 3: 'Hardware reset', 4: 'Hardware backup', 5: 'Software backup', 6: 'Software reset', 7: 'VIO fail', 8: 'VDD_X fail', 9: 'VDD_RF fail', 10: 'V_CORE_HIGH fail'}
Boot type from UBX-MON-SYS
- pyubx2.ubxtypes_decodes.GEOFENCE_STATUS = {0: 'Geofencing not available or not reliable', 1: 'Geofencing active'}
Geofence status from UBX-NAV-GEOFENCE
- pyubx2.ubxtypes_decodes.COMBSTATE = {0: 'unknown', 1: 'inside', 2: 'outside'}
Comb state from UBX-NAV-GEOFENCE
- pyubx2.ubxtypes_decodes.HEALTH = {0: 'unknown', 1: 'healthy', 2: 'not healthy'}
Space vehicle health from UBX-NAV-ORB
- pyubx2.ubxtypes_decodes.VISIBILITY = {0: 'unknown', 1: 'below horizon', 2: 'above horizon', 3: 'above elevation mask'}
Space vehicle visibility from UBX-NAV-ORB
- pyubx2.ubxtypes_decodes.PLPOSFRAME = {0: 'Invalid (not possible to calculate frameconversion)', 1: 'North-East-Down', 2: 'Longitudinal-Lateral-Vertical', 3: 'HorizSemiMajorAxis-HorizSemiMinorAxis-Vertical'}
Position protection level from UBX-NAV-PL
- pyubx2.ubxtypes_decodes.GPSFIX = {0: 'NO FIX', 1: 'DR', 2: '2D', 3: '3D', 4: 'GPS + DR', 5: 'TIME ONLY'}
Fix type from UBX-NAV-PVT
- pyubx2.ubxtypes_decodes.PSMSTATE = {0: 'PSM is not active', 1: 'Enabled', 2: 'Acquisition', 3: 'Tracking', 4: 'Power Optimized Tracking', 5: 'Inactive'}
Power save mode state from UBX-NAV-PVT
- pyubx2.ubxtypes_decodes.CARRSOLN = {0: 'NO RTK', 1: 'RTK FLOAT', 2: 'RTK FIXED'}
Carrier phase range solution from UBX-NAV-PVT
- pyubx2.ubxtypes_decodes.LASTCORRECTIONAGE = {0: 0, 1: 1, 2: 2, 3: 5, 4: 10, 5: 15, 6: 20, 7: 30, 8: 45, 9: 60, 10: 90, 11: 120}
Last DGPS correction age from UBX-NAV-PVT
- pyubx2.ubxtypes_decodes.QUALITYIND = {0: 'no signal', 1: 'searching signal', 2: 'signal acquired', 3: 'signal detected but unusable', 4: 'code locked and time synchronized', 5: 'code and carrier locked and time synchronized', 6: 'code and carrier locked and time synchronized', 7: 'code and carrier locked and time synchronized'}
Signal quality indicator from UBX-NAV-SAT
- pyubx2.ubxtypes_decodes.ORBITSOURCE = {0: 'no orbit information is available for this SV', 1: 'ephemeris is used', 2: 'almanac is used', 3: 'AssistNow Offline orbit is used', 4: 'AssistNow Autonomous orbit is used', 5: 'other orbit information is used', 6: 'other orbit information is used', 7: 'other orbit information is used'}
Orbit source from UBX-NAV-SAT
- pyubx2.ubxtypes_decodes.SBASMODE = {0: 'Disabled', 1: 'Enabled integrity', 3: 'Enabled test mode'}
SBAS (satellite-based augmentation system) mode from UBX-NAV-SBAS
- pyubx2.ubxtypes_decodes.SBASSYS = {-1: 'Unknown', 0: 'WAAS', 1: 'EGNOS', 2: 'MSAS', 3: 'GAGAN', 16: 'GPS'}
SBAS system from UBX-NAV-SBAS
- pyubx2.ubxtypes_decodes.SBASINTEGRITYUSED = {0: 'Unknown', 1: 'Integrity information is not available or SBAS integrity is not enabled', 2: 'Receiver uses only GPS satellites for which integrity information is available'}
SBAS integrity used indicator from UBX-NAV-SBAS
- pyubx2.ubxtypes_decodes.CORRSOURCE = {0: 'NONE', 1: 'SBAS', 2: 'BeiDou', 3: 'RTCM2', 4: 'RTCM3 OSR', 5: 'RTCM3 SSR', 6: 'QZSS SLAS', 7: 'SPARTN', 8: 'CLAS'}
DGPS correction source from UBX-NAV-SIG
- pyubx2.ubxtypes_decodes.IONOMODEL = {0: 'none', 1: 'Klobuchar GPS', 2: 'SBAS', 3: 'Klobuchar BeiDou', 4: 'Dual Frequency'}
Ionospheric model type from UBX-NAV-SIG
- pyubx2.ubxtypes_decodes.SIGID = {(0, 0): 'GPS L1C/A', (0, 3): 'GPS L2 CL', (0, 4): 'GPS L2 CM', (0, 6): 'GPS L5 I', (0, 7): 'GPS L5 Q', (1, 0): 'SBAS L1C/A', (2, 0): 'Galileo E1 C', (2, 1): 'Galileo E1 B', (2, 3): 'Galileo E5 al', (2, 4): 'Galileo E5 aQ', (2, 5): 'Galileo E5 bI', (2, 6): 'Galileo E5 bQ', (3, 0): 'BeiDou B1I D1', (3, 1): 'BeiDou B1I D2', (3, 2): 'BeiDou B2I D1', (3, 3): 'BeiDou B2I D2', (3, 5): 'BeiDou B1C', (3, 7): 'BeiDou B2a', (5, 0): 'QZSS L1C/A', (5, 1): 'QZSS L1S', (5, 4): 'QZSS L2 CM', (5, 5): 'QZSS L2 CL', (5, 8): 'QZSS L5 I', (5, 9): 'QZSS L5 Q', (6, 0): 'GLONASS L1 OF', (6, 2): 'GLONASS L2 OF', (7, 0): 'NavIC L5 A'}
- GNSS, Signal ID from UBX-NAV-SIG
key is (gnssId, sigId)
- pyubx2.ubxtypes_decodes.SPOOFDETSTATE = {0: 'unknown or deactivated', 1: 'no spoofing indicated', 2: 'spoofing indicated', 3: 'multiple spoofing indications'}
Spoof detection state from UBX-NAV-STATUS
- pyubx2.ubxtypes_decodes.PSMSTATUS = {0: 'aquisition', 1: 'tracking', 2: 'power optimised tracking', 3: 'inactive'}
Power save mode state from UBX-NAV-STATUS
- pyubx2.ubxtypes_decodes.UTCSTANDARD = {0: 'Information not available', 1: 'Communications Research Labratory (CRL), Tokyo, Japan', 2: 'National Institute of Standards and Technology (NIST)', 3: 'U.S. Naval Observatory (USNO)', 4: 'International Bureau of Weights and Measures (BIPM)', 5: 'European laboratories', 6: 'Former Soviet Union (SU)', 7: 'National Time Service Center (NTSC), China', 8: 'National Physics Laboratory India (NPLI)', 15: 'Unknown'}
UTC time standard from UBX-NAV-TIME*
- pyubx2.ubxtypes_decodes.SOURCEOFCURLS = {0: 'Default', 1: 'Derived from time difference between GPS and GLONASS time', 2: 'GPS', 3: 'SBAS', 4: 'BeiDou', 5: 'Galileo', 6: 'Aided data', 7: 'Configured', 8: 'NavIC', 255: 'Unknown'}
Information source for the current number of leap seconds, from UBX-NAV-TIMELS
- pyubx2.ubxtypes_decodes.SRCOFLSCHANGE = {0: 'No source', 2: 'GPS', 3: 'SBAS', 4: 'BeiDou', 5: 'Galileo', 6: 'GLONASS', 7: 'NavIC'}
Information source for the future leap second event, from UBX-NAV-TIMELS
pyubx2.ubxtypes_get module
UBX Protocol GET output payload definitions.
THESE ARE THE PAYLOAD DEFINITIONS FOR _GET_ MESSAGES _FROM_ THE RECEIVER (e.g. Periodic Navigation Data; Poll Responses; Info messages).
Created on 27 Sep 2020
Information sourced from public domain u-blox Interface Specifications © 2013-2021, u-blox AG
- author:
semuadmin
pyubx2.ubxtypes_poll module
UBX Protocol POLL payload definitions.
THESE ARE THE PAYLOAD DEFINITIONS FOR _POLL_ MESSAGES _TO_ THE RECEIVER (e.g. query configuration; request monitoring, receiver management, logging or sensor fusion status).
Response payloads are defined in UBX_PAYLOADS_GET.
NB: Attribute names must be unique within each message class/id
Created on 27 Sep 2020
Information sourced from public domain u-blox Interface Specifications © 2013-2021, u-blox AG
- author:
semuadmin
pyubx2.ubxtypes_set module
UBX Protocol SET payload definitions.
THESE ARE THE PAYLOAD DEFINITIONS FOR _SET_ MESSAGES _TO_ THE RECEIVER (e.g. configuration and calibration commands; AssistNow payloads).
Created on 27 Sep 2020
Information sourced from public domain u-blox Interface Specifications © 2013-2021, u-blox AG
- author:
semuadmin
pyubx2.ubxvariants module
ubxvariants.py
Various routines to get payload dictionaries for message types which exist in multiple variants for the same message class, id and mode.
Created on 20 May 2024
- author:
semuadmin
- copyright:
SEMU Consulting © 2020
- license:
BSD 3-Clause
- pyubx2.ubxvariants.get_cfgtp5_dict(**kwargs) dict [source]
Select appropriate CFG-TP5 POLL payload definition by checking presence of tpIdx or payload argument.
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- pyubx2.ubxvariants.get_mga_dict(msg: bytes, mode: int, **kwargs) dict [source]
Select appropriate MGA payload definition by checking value of ‘type’ attribute (1st byte of payload).
- Parameters:
mode (str) – mode (0=GET, 1=SET, 2=POLL)
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_rxmpmreq_dict(**kwargs) dict [source]
Select appropriate RXM-PMREQ payload definition by checking the ‘version’ keyword or payload length.
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_rxmpmp_dict(**kwargs) dict [source]
Select appropriate RXM-PMP payload definition by checking value of ‘version’ attribute (1st byte of payload).
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_rxmrlm_dict(**kwargs) dict [source]
Select appropriate RXM-RLM payload definition by checking value of ‘type’ attribute (2nd byte of payload).
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_cfgnmea_dict(**kwargs) dict [source]
Select appropriate payload definition version for older generations of CFG-NMEA message by checking payload length.
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_aopstatus_dict(**kwargs) dict [source]
Select appropriate payload definition version for older generations of NAV-AOPSTATUS message by checking payload length.
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_relposned_dict(**kwargs) dict [source]
Select appropriate NAV-RELPOSNED payload definition by checking value of ‘version’ attribute (1st byte of payload).
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_timvcocal_dict(**kwargs) dict [source]
Select appropriate TIM-VCOCAL SET payload definition by checking the payload length.
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
- Raises:
UBXMessageError
- pyubx2.ubxvariants.get_cfgdat_dict(**kwargs) dict [source]
Select appropriate CFG-DAT SET payload definition by checking presence of datumNum keyword or payload length of 2 bytes.
- Parameters:
kwargs – optional payload key/value pairs
- Returns:
dictionary representing payload definition
- Return type:
dict
Module contents
Created on 27 Sep 2020
- author:
semuadmin
- copyright:
SEMU Consulting © 2020
- license:
BSD 3-Clause