Skip to content

Commit 7d50ec3

Browse files
committed
update device info parsing
1 parent 12c99a8 commit 7d50ec3

5 files changed

Lines changed: 31 additions & 22 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ For more comprehensive installation instructions, please refer to [INSTALLATION.
108108
3. To connect to a GNSS receiver via USB or UART port, select the device from the listbox, set the appropriate serial connection parameters and click
109109
![connect icon](https://github.com/semuconsulting/PyGPSClient/blob/master/src/pygpsclient/resources/usbport-1-24.png?raw=true). The application will endeavour to pre-select a recognised GNSS/GPS device but this is platform and device dependent. Press the ![refresh](https://github.com/semuconsulting/PyGPSClient/blob/master/src/pygpsclient/resources/iconmonstr-refresh-6-16.png?raw=true) button to refresh the list of connected devices at any point.
110110
- `Rate bps` (baud rate) is typically the only setting that might need adjusting, but tweaking the `timeout` setting may improve performance on certain platforms.
111-
- When the connection is first established, PyGPSClient will send various query messages (*one for each selected protocol*) to the receiver in an attempt to establish its model and firmware version. You may see a handful of 'unknown protocol' warnings in response to some of these queries - these can be disregarded.
111+
- When the connection is first established, PyGPSClient will poll various hardware information messages (*one for each selected protocol*) to the receiver in an attempt to establish its model and firmware version. You may see a handful of 'unknown protocol' warnings in response to some of these queries - these can be disregarded. **NB:** Some receivers will not output hardware information messages at low baud rates (<38,400).
112112
- If you get a permissions error on attempting to connect to a serial port e.g. `[Errno 13] permission denied /dev/ttyACM0`, refer to the [Installation Guidelines - User Privileges](https://github.com/semuconsulting/PyGPSClient/blob/master/INSTALLATION.md#user-privileges).
113113
- The `Msg Mode` parameter defaults to `GET` i.e., periodic or poll response messages *from* a receiver. If you wish to parse streams of command or poll messages being sent *to* a receiver, set the `Msg Mode` to `SET` or `POLL`. An optional serial or socket stream inactivity timeout can also be set (in seconds; 0 = no timeout).
114114
4. A custom user-defined serial port can also be passed via the json configuration file setting `"userport_s":`, via environment variable `PYGPSCLIENT_USERPORT` or as a command line argument `--userport`. A special userport value of "ubxsimulator" invokes the experimental [`pyubxutils.UBXSimulator`](https://github.com/semuconsulting/pyubxutils/blob/main/src/pyubxutils/ubxsimulator.py) utility to emulate a GNSS NMEA/UBX serial stream.

src/pygpsclient/nmea_handler.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,16 +403,17 @@ def _process_QTMVERNO(self, data: NMEAMessage):
403403
:param pynmeagps.NMEAMessage data: parsed QTMVERNO sentence
404404
"""
405405

406-
verdata = {}
407-
verdata["swversion"] = "N/A"
408-
verdata["hwversion"] = f"Quectel {data.verstr}"
409-
verdata["fwversion"] = f"{data.builddate}-{data.buildtime}"
410-
verdata["romversion"] = "N/A"
411-
self.__app.gnss_status.version_data = verdata
406+
self.__app.gnss_status.version_data["swversion"] = "N/A"
407+
self.__app.gnss_status.version_data["hwversion"] = f"Quectel {data.verstr}"
408+
self.__app.gnss_status.version_data["fwversion"] = (
409+
f"{data.builddate}-{data.buildtime}"
410+
)
411+
self.__app.gnss_status.version_data["romversion"] = NA
412+
self.__app.gnss_status.version_data["gnss"] = NA
412413

413414
if self.__app.dialog(DLGTNMEA) is not None:
414415
self.__app.dialog(DLGTNMEA).update_pending(data)
415-
self.__app.device_label = verdata["hwversion"]
416+
self.__app.device_label = self.__app.gnss_status.version_data["hwversion"]
416417

417418
def _process_QTMVER(self, data: NMEAMessage):
418419
"""

src/pygpsclient/sbf_handler.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,18 @@ def _process_ReceiverSetup(self, data: SBFMessage):
118118
:param SBFMessage data: ReceiverSetup message
119119
"""
120120

121-
verdata = {}
122121
hwver = data.ProductName.decode(ASCII, errors=BSR).replace("\x00", "")
123-
verdata["hwversion"] = f"Septentrio {hwver}"
124-
verdata["fwversion"] = data.RxVersion.decode(ASCII, errors=BSR).replace(
125-
"\x00", ""
122+
self.__app.gnss_status.version_data["hwversion"] = f"Septentrio {hwver}"
123+
self.__app.gnss_status.version_data["swversion"] = (
124+
data.RxVersion.decode(ASCII, errors=BSR)
125+
.replace("\x00", "")
126+
.replace("Unknown", "")
126127
)
127-
verdata["romversion"] = data.GNSSFWVersion.decode(ASCII, errors=BSR).replace(
128-
"\x00", ""
128+
self.__app.gnss_status.version_data["fwversion"] = (
129+
data.GNSSFWVersion.decode(ASCII, errors=BSR)
130+
.replace("\x00", "")
131+
.replace("Unknown", "")
129132
)
130-
self.__app.gnss_status.version_data = verdata
131-
self.__app.device_label = verdata["hwversion"]
133+
self.__app.gnss_status.version_data["romversion"] = NA
134+
self.__app.gnss_status.version_data["gnss"] = NA
135+
self.__app.device_label = self.__app.gnss_status.version_data["hwversion"]

src/pygpsclient/ubx_handler.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from pyubx2 import UBXMessage, itow2utc
2222

23-
from pygpsclient.globals import GLONASS_NMEA, UTF8
23+
from pygpsclient.globals import BSR, GLONASS_NMEA, UTF8
2424
from pygpsclient.helpers import corrage2int, fix2desc, ned2vector, svid2gnssid
2525
from pygpsclient.strings import DLGTSERVER, DLGTSPARTN, DLGTUBX, NA
2626
from pygpsclient.widget_state import VISIBLE, WDGSIGNALS, WDGSPECTRUM, WDGSYSMON
@@ -152,13 +152,15 @@ def _process_MONVER(self, msg: UBXMessage):
152152
gnss_supported = ""
153153
hw_version = ""
154154
sw_version = getattr(msg, "swVersion", b"N/A")
155-
sw_version = sw_version.replace(b"\x00", b"").decode(UTF8)
155+
sw_version = sw_version.decode(UTF8, errors=BSR).replace("\x00", "")
156156
sw_version = sw_version.replace("ROM CORE", "ROM")
157157
sw_version = sw_version.replace("EXT CORE", "Flash")
158158

159159
for i in range(9):
160-
ext = getattr(msg, f"extension_{i+1:02d}", b"").decode(
161-
UTF8, errors="ignore"
160+
ext = (
161+
getattr(msg, f"extension_{i+1:02d}", b"")
162+
.decode(UTF8, errors=BSR)
163+
.replace("\x00", "")
162164
)
163165
# ext = ext.replace(b"\x00", b"")
164166
exts.append(ext)
@@ -185,7 +187,7 @@ def _process_MONVER(self, msg: UBXMessage):
185187
if hw_version == "":
186188
hw_version = (
187189
getattr(msg, "hwVersion", b"N/A")
188-
.decode(UTF8, errors="ignore")
190+
.decode(UTF8, errors=BSR)
189191
.replace("\x00", "")
190192
)
191193
hw_version = f"u-blox {UBXMODELS.get(hw_version, hw_version)}"

src/pygpsclient/uni_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,5 +264,7 @@ def _process_VERSION(self, data: UNIMessage):
264264
f"Unicore {DEVICE.get(data.device, data.device)}"
265265
)
266266
self.__app.gnss_status.version_data["swversion"] = data.swversion
267-
self.__app.gnss_status.version_data["romversion"] = data.comptime
267+
self.__app.gnss_status.version_data["fwversion"] = data.comptime
268+
self.__app.gnss_status.version_data["romversion"] = NA
269+
self.__app.gnss_status.version_data["gnss"] = NA
268270
self.__app.device_label = self.__app.gnss_status.version_data["hwversion"]

0 commit comments

Comments
 (0)