Add support for serial-based (USB) GPSs#2815
Conversation
Automated PR Review (Claude)0. SummaryVerdict: MINOR SUGGESTIONS Minor items to address: 1.1, 1.2, 4.1, 5.1, 5.2, 6.1, 6.2, 6.3 This PR adds Electron-only support for reading one or more USB/serial NMEA 0183 GNSS receivers and publishing their data into the data lake as 1. Correctness & Implementation Bugs1.1 ( 1.2 ( 2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance4.1 ( 5. UI / UX5.1 ( 5.2 ( 6. Code Quality & Style6.1 ( 6.2 ( 6.3 ( 7. Commit Hygiene — ✅The four commits are clean, logically separated, and well-scoped:
8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional10.1 ( 10.2 ( Generated by Claude. This is advisory; a human reviewer must still approve. |
Add a `serial-list-ports` IPC handler (using the same require() form as the serial link, so the native serialport binding is not bundled) and type it on the electronAPI, so the renderer can enumerate available serial ports.
ff76ab6 to
477b31e
Compare
Review follow-up — round 1Done
Won't change (with reasoning)
Note: the reviewed SHA predated a rebase — the data-lake namespace is now |
|
/review |
Automated PR Re-review 2 (Claude)Comparing Previous findings status
Discussion since last reviewThe author posted a detailed follow-up comment addressing all 10 findings:
New findings0. SummaryVerdict: MINOR SUGGESTIONS Minor items to address: 1.3, 6.4 This PR adds Electron-only support for reading one or more USB/serial NMEA 0183 GNSS receivers and publishing their data into the data lake as 1. Correctness & Implementation Bugs1.3 ( 2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style6.4 ( 7. Commit Hygiene — ✅The four commits remain clean and logically separated after the rebase. 8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
Add a framework-agnostic NMEA 0183 parser/aggregator and an Electron-only orchestrator that reads one or more serial GNSS receivers over the existing link IPC and publishes each device's position and fix data to per-device external/gnss/<id>/* data-lake variables. Includes baud auto-detection and a raw serial-line capture for debugging, with a composable exposing the reactive device list, status and actions. Types live in src/types/gnss.ts.
Let ConsoleViewer take its event source, levels and empty/disabled messages via props (defaulting to the system log), so it can render arbitrary streams without a level column. The event type moves to a dedicated typing file.
Add a Sources configuration page whose Positioning panel lists devices in a table with an add button, each opening a dialog to set name, port and baud, auto-detect the baud rate, connect/disconnect, view live fix status and a serial console. Initialize the reader on startup and document the feature as Electron-only.
477b31e to
87953dc
Compare
Review follow-up — round 2Done
Won't change (with reasoning)
All round-1 findings confirmed addressed (1.2, 4.1, 5.1, 5.2, 6.1, 6.2, 10.1, 10.2) or declined with reasoning (1.1, 6.3). |
|
/review |
Automated PR Re-review 3 (Claude)Comparing Previous findings status
Discussion since last reviewThe author posted a follow-up comment addressing both open findings:
New findings0. SummaryVerdict: READY TO MERGE This PR adds Electron-only support for reading one or more USB/serial NMEA 0183 GNSS receivers and publishing their data into the data lake as 1. Correctness & Implementation Bugs — ✅2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style — ✅7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
|
Ready to go. |
There was a problem hiding this comment.
It work very well!
Besides the auto-connect question on commit 2, there are some UI adjustments to do:
(1) Add that classic X to close the window, horizontally aligned to the title;
(2) Pull up the container's content on ~20px. There is some important head space there to save;
(3) Consider adding that block to an ExpansiblePanel called 'Device Status' or 'Connection Status' or maybe use details instead of status... This way we simplify the connection modal, save vertical space, specially to mobile, and make the regular user's experience cleaner.
(4) use theme=dark on both selectors.
| */ | ||
| const createState = (): GnssState => { | ||
| const isSupported = isElectron() | ||
| const devices = useBlueOsStorage<GnssDevice[]>(gnssDevicesKey, []) |
There was a problem hiding this comment.
Is useBlueOsStorage syncing, machine-specific on port + auto enabled settings?
Maybe if the user switch to another topside computer, or someone else connects to the vehicle in parallel (this is not uncommon, I suppose) and selects the same user; then enabled:true + a stale /dev/ttyUSB[...] will auto-connect to the wrong device.
There was a problem hiding this comment.
Yeah, the possibility exists...
Any idea on how to overcome that?
There was a problem hiding this comment.
Every USB device should have its own serial/VID/PID. I would add that to GnssDeviceMatch.
If the device doesn't supply any ID, make the auto connect a machine-local setting
Summary
Adds support for reading external USB/serial NMEA GNSS receivers (Electron-only) and feeding their data into the data lake, primarily to drive dynamic points of interest.
serial-list-portshandler to enumerate serial ports.GGA/RMC/GSA/GSV/VTG/GLL, checksum validation, coordinate/fix-quality decoding, coordinates withheld until a valid fix) plus an orchestrator that reads multiple devices and publishes per-deviceexternal/gnss/<id>/*variables (lat, lon, altitude, satellites, fix quality incl. RTK float/fixed, DOPs, speed, course). Includes baud auto-detection and raw serial-line capture for debugging.ConsoleVieweris now source-agnostic so it can render any stream (used for the per-device serial console).InteractionDialog), and an "Add device" button.Browsers can't access serial devices outside a secure context, so this is standalone-only; documented in the README feature table.
Test plan
external/gnss/<id>/*variables populate.external/gnss/<id>/latitude/longitudeand confirm it tracks.cockpit-serial-gnss-support.mp4
Close #650
Contributes to #300
Contributes to #1842