Recent

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

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • 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

  • Hero Member
  • *****
  • Posts: 1045
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 »
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

sstvmaster

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

Maik
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • 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: 2778
    • 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 and my github - https://github.com/davidbannon

PaulRowntree

  • Full Member
  • ***
  • Posts: 132
    • 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: 5444
  • 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: 132
    • 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: 5444
  • 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.

BillyKerk

  • Newbie
  • Posts: 2
I know that the Eltima company has a VSPD software (https://www.virtual-serial-port.org/) that has an official digital signature from Microsoft.
The software is not cheap, but there is a trial and you can try for compatibility with FPC or Lazarus. I could not find a valid virtual com port driver that would work with WIN10... %)

 

TinyPortal © 2005-2018