Add the Ver message parser and a fixed UbxQuery (was unused and had a broken semaphore/state bug) to poll MON-VER once on connect. The CLI prints hw/sw version and extensions; the GUI polls it per receiver, pre-fills the read-only ID field with a connection counter and rewrites it from the MOD= extension once the device answers, and propagates the resolved display name to the Sky and Plot tabs so they no longer show the stale placeholder ID. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XM4FNUjhu9x8df5Dp1hHvd
32 lines
946 B
Python
32 lines
946 B
Python
import struct
|
|
from ubx.messages.msg import UbxMsg
|
|
|
|
class Ver(UbxMsg):
|
|
def __init__(self):
|
|
UbxMsg.__init__(self, 0x0A, 0x04)
|
|
|
|
class Group1:
|
|
@classmethod
|
|
def from_bytes(cls, data: bytes):
|
|
obj = Ver.Group1()
|
|
obj.extension = data[0:30].split(b"\x00", 1)[0].decode("ascii", errors="replace")
|
|
return obj.__dict__
|
|
|
|
@classmethod
|
|
def from_bytes(cls, data: bytes):
|
|
obj = Ver()
|
|
obj.sw_version = data[0:30].split(b"\x00", 1)[0].decode("ascii", errors="replace")
|
|
obj.hw_version = data[30:40].split(b"\x00", 1)[0].decode("ascii", errors="replace")
|
|
obj.extensions = []
|
|
offset = 40
|
|
remain = len(data) - offset
|
|
group_size = 30
|
|
n = offset
|
|
while remain >= group_size:
|
|
extension = cls.Group1.from_bytes(data[n:n + group_size])
|
|
n += group_size
|
|
remain -= group_size
|
|
obj.extensions.append(extension)
|
|
if remain:
|
|
print(f"Ver.from_bytes: {remain} trailing bytes unparsed (payload size mismatch)")
|
|
return obj.__dict__ |