Bookstore

Recent

Author Topic: How to read GPS data from COM port, install into Windows Location Services  (Read 1141 times)

PaulRowntree

  • Full Member
  • ***
  • Posts: 113
    • Paul Rowntree
Hi! Most GPS units that I work with produce NMEA messages, often over RS232 or USB communication lines.  However, most Windows 10 mapping based programs want to read from the Windows Location Services.  So far I have only found one (commercial) code to read the NMeA data from a COM port and to send it to Location Services for other codes to work with.
https://www.gpssensordrivers.com/
Does anyone know how to do this with Laz/FPC?
EDIT : my vocabulary may be off ... LocationServices might be Win7, and Geolocation more win10-ish
Thanks!
« Last Edit: January 16, 2020, 08:34:25 pm by PaulRowntree »
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

dsiders

  • Sr. Member
  • ****
  • Posts: 279
Hi! Most GPS units that I work with produce NMEA messages, often over RS232 or USB communication lines.  However, most Windows 10 mapping based programs want to read from the Windows Location Services.  So far I have only found one (commercial) code to read the NMeA data from a COM port and to send it to Location Services for other codes to work with.
https://www.gpssensordrivers.com/
Does anyone know how to do this with Laz/FPC?
EDIT : my vocabulary may be off ... LocationServices might be Win7, and Geolocation more win10-ish
Thanks!

I haven't seen anything specifically for FPC or Lazarus. But there is virtual com port driver on http://nmea.sourceforge.net/ in C and C++.

And, apparently rather dated. ;)
« Last Edit: January 16, 2020, 08:58:44 pm by dsiders »
Lazarus 2.0.6 / Lazarus 2.1 (SVN) / FPC 3.0.4 / Windows 8.1 64-bit

sstvmaster

  • Full Member
  • ***
  • Posts: 141
In LazSerial (see OPM) there is an example for GPS/NMEA in the package folder (test).

Maik
OS: Windows 7 (32 bit) / Windows 10 (64 bit)
Lazarus: 2.0.6 x32 / 2.1.0 Trunk x32

PaulRowntree

  • Full Member
  • ***
  • Posts: 113
    • Paul Rowntree
Thank you for your replies.  Reading and parsing the NMEA isn't a problem, they are like ASCII csv strings with a CRC added.  I believe the codes in LazSerial and the NMEA site do this, as do my own codes.

I am stuck at the process of 'force feeding' the sensor data into the Windows Geolocation API, so that other Win programs can read it, much as Android apps do.  Under Linux there is the gpsd that serves this role so that multiple apps can use the data from a single source.  There is a cygwin adaptation of gpsd, but it doesn't work with the new GeoLocation API.
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

dbannon

  • Hero Member
  • *****
  • Posts: 973
    • tomboy-ng, a rewrite of the classic Tomboy
Paul in the Linux world the solution is almost universally GPSBabel, apparently its available on Win 7-10 as well. Worth a look....

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

PaulRowntree

  • Full Member
  • ***
  • Posts: 113
    • Paul Rowntree
Thanks DavoYes, and it looks like it is available on Win10.  It is a perfect 'hub' for GPS programs to receive from, but often those programs that are built for Win10, such as microsoft's Maps, will only get their data from the Geolocation API.

Microsoft should have provided a software bridge for older, generic hardware on a COM port ... yet here we are.
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

PascalDragon

  • Hero Member
  • *****
  • Posts: 1088
  • Compiler Developer
You'd need to write a device driver (at least using the User Mode Driver Framework, so no need for kernel mode code) for this. A commercial driver for this is available here.

PaulRowntree

  • Full Member
  • ***
  • Posts: 113
    • Paul Rowntree
You'd need to write a device driver (at least using the User Mode Driver Framework, so no need for kernel mode code) for this. A commercial driver for this is available here.
Yes, that is the one I linked to in the OP.  Is it possible to write such a driver with the FPC, and are there any example frameworks or examples to go by?  I am very surprised there is just this one example available.
Paul Rowntree
- coding for instrument control, data acquisition & analysis, CNC systems

PascalDragon

  • Hero Member
  • *****
  • Posts: 1088
  • Compiler Developer
Ah, hadn't noticed that this was the same link.

Well, considering that we're talking about the User Mode Driver Framework it should be possible. However it seems that you'll have to dig through examples and the MSDN yourself as I didn't find anything for FPC or Delphi yet.