📜  pyubx - Python (1)

📅  最后修改于: 2023-12-03 15:04:43.039000             🧑  作者: Mango

pyubx - Python

Logo

pyubx is a Python library for parsing and creating UBX protocol messages, used by u-blox GPS receivers.

Features
  • Complete UBX message parsing and creation
  • UBX protocol version 15 (as of u-blox 8) supported
  • Convenient object-oriented design
  • Thorough test suite
Installation

Install via pip:

pip install pyubx
Usage
Parsing UBX messages
import pyubx

data = b"\xB5\x62\x05\x01\x02\x00\x09\x08\x00\x67\xEB"
parser = pyubx.Parser()
msg = parser.parse(data)
# Output: {'class_id': b'\x05', 'message_id': b'\x01', 'payload': b'\x02\x00\x09\x08\x00', 'length': 9, 'checksum': b'\x67\xEB'}
Creating UBX messages
import pyubx

msg = pyubx.Message("CFG", "CFG-PRT")
msg.add("portID", 2)
msg.add("inProtoMask", 1)
msg.add("outProtoMask", 1)
msg.add("baudRate", 9600)
msg.pack()
# Output: b'\xb5b\x06\x00\x14\x00\x02\x01\x01\x00\x00\x00\x00\x00\x00`\xea\x00\x00\x07\x00\x01\x01\x01d\xfe'
Documentation

Full documentation is available at https://pyubx.readthedocs.io/en/latest/.

License

pyubx is licensed under the MIT License. See LICENSE for details.