-
Notifications
You must be signed in to change notification settings - Fork 203
[RFC] feat: add external GPS source support for tethered devices #877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@BlackBoxEngineering is attempting to deploy a commit to the Meshtastic Team on Vercel. A member of the Team first needs to authorize it. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the idea of this PR but the approach will need to be tweaked, for local development and self hosting using Docker it makes sense, but all code needs to run either in Docker or from our prod Vercel site.
|
||
setInterval(getAndroidGPS, 30000); // Poll every 30 seconds | ||
|
||
server.listen(8080, () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get what you're trying to accomplish here, but any solution like this must use the following:
- Written in TypeScript
- Be able to operate both locally on a users machine (dev mode, or running in a docker container)
- Also work within our hosting platform (Vercel) without any firewall tricks required by the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get what you're trying to accomplish here, but any solution like this must use the following:
- Written in TypeScript
- Be able to operate both locally on a users machine (dev mode, or running in a docker container)
- Also work within our hosting platform (Vercel) without any firewall tricks required by the user.
Vercel
Uses browser Geolocation API only - No bridge no Firewall config needed
Local Dev
Users can optionally run node gps-bridge-service.ts
separately
Only for desktop users without GPS hardware
Not required for the web app to function
The web app detects if the bridge is available (checks http://localhost:8080/gps
) and falls back to browser geolocation if not. Vercel deployment works with browser GPS, Local browser GPS OR the optional bridge
The bridge is purely an optional local development tool.
packages/web/package.json
Outdated
"check": "biome check src/", | ||
"check:fix": "biome check --write src/", | ||
"dev": "vite", | ||
"dev:web-only": "vite", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? This script duplicates the line above.
packages/web/package.json
Outdated
"@types/w3c-web-serial": "^1.0.8", | ||
"@vitejs/plugin-react": "^5.0.4", | ||
"autoprefixer": "^10.4.21", | ||
"concurrently": "^8.2.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear why this library was added when its not being used in the npm scripts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll could refactor the GPS bridge service to TypeScript and implement and environment-aware function that works both locally and on Vercel. For local development and Docker, it will use the ADB GPS polling service, while for production deployment on Vercel, it will fall back to browser geolocation APIs without requiring any firewall configuration.
I'll could also utilize the concurrently dependency properly by updating the dev script to run both the Vite server and bridge services simultaneously. I can remove the duplicate dev:web-only
This might then deploy on the hosting platform. I have no GPS on my browser.
As well have you reviewed the Geolocaiton API that all browsers widely support? https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API |
Changes Made: Re: Geolocation API if (navigator.geolocation) {
this.watchId = navigator.geolocation.watchPosition(
(position) => {
if (localStorage.getItem('gps-browser') === 'false') return;
if (!this.position) {
this.position = position;
logger.debug('GPS: Using browser geolocation');
}
},
// ... error handling
);
} |
Description
This PR adds support for external GPS sources to the Meshtastic web client, enabling desktop users without GPS hardware to use GPS from tethered mobile devices via USB. This is particularly useful for desktop users who want to use Meshtastic mesh networking but don't have built-in GPS.
The implementation provides a flexible multi-source GPS architecture with automatic fallback between browser geolocation, Android devices (via ADB), and iOS devices.
Note: This is a Draft PR to gather feedback on the approach before completing documentation and i18n work.
Related Issues
N/A - This is a new feature enhancement
Changes Made
Testing Done
Screenshots (if applicable)
(Will add screenshots showing GPS page UI)
Checklist
Additional Notes
Setup Instructions for External GPS:
Users who want to use external GPS need to:
node gps-bridge-service.js
in a separate terminalQuestions for Reviewers: