Raspberry Pi app - MAPBOX and GPSD Help!
I have limited experience in developing apps, and just wondering if you anybody could help me out a little. I have a Raspberry Pi with a connected GPS Hat that is working. I have installed GPSD and can see all that data in the LX terminal ( lat, long, alt, time etc.....). How can I use the QT location module to interface either with GPSD or the GPS itself to use that to display a location on a map?
I have designed some maps on MAPBOX, where and what format to I place my mapbox access token details into the QT app?
Any help or pointers would be great!!!
I am not sure about the GPSD Package for RasPi. For "normal" Linux systems it contains a gps.h file (can be found in /usr/include).
This provides all methods to connect to the GPS Device and read from it.
@L-J-5 would you mind elaborating:
A. what command you're using in the terminal, as you mentioned you can read data?
B. Is that terminal local to the RPi or a remote ssh session?
C. are you able to read data from a serial port as well (i.e. stty -F /dev/ttyXXX ispeed 4800 && cat </dev/ttyXXX)
For contacting the GPS directly on a serial port, I guess you can use QNmeaPositionInfoSource and QSerialPort.
And regarding using gpsd you need to contact the daemon by means of a network connection (see gpsd installation page stating "Once gpsd is running, telnet to port 2947" so you may want to use QNetworkAccessManager to directly request data from the daemon, or ideally, you may want to extend Qt Positioning in order to incorporate that network access capability to gpsd and also inheriting all the existing functionaly hidden the specific implementation.
- The data can be viewed using gpsmon - which does show tcp://localhost:2947
- The terminal is local to the RPi.
- When running stty -F /dev/ttyXXX ispeed 4800 && cat </dev/ttyXXX, I get some form of data through - it seems to be all random symbols and letters.
However if I run command cat dev/ttyAMA0 I do get the raw data through as in raw NMEA data.
How can I get the Pi interfaced with Qt thats running on a Windows OS laptop as the position source??
from answer #1 I guess you already answered yourself: one option you have is to get your Qt app running on Windows as a network client (i.e. using QNetworkAccessManager for instance) working basically the same way gpsmon does...
I am rather new at all this, do you have any pointers on the best way of going about this?
@L-J-5 I'm afraid it looks like you want to ride a GP bike without even riding a bicycle before. Anyway, you may want to take a look a tons of examples, i.e. Qt and TCP and Network Programming with Qt for Qt and networking, and I even suggest to read gpsmon source code itself to try understanding how that application communicates with gpsd daemon.
@Pablo-J.-Rogina Thank you for tips! You only live once - sometimes its best to jump in at the deep end!
@L-J-5 if you consider this post finished, please don't forget to mark it as "solved"