Wednesday, February 07, 2007

Delphi: You Are Here

I put together a little Delphi app (my first) that will show where you are in Google Maps. The position is taken from GPS data from a serial port. The code for the serial port I found here. This version modifies the way errors are handled and its code flow.

No object thinking at all, just procedural steps to get the job done quickly.

The idea is to read from a COM port (serial transfer protocol) a valid flow of NMEA sentences. You can obtain current latitude and longitude from the $GPRMC sentence if your receiver provides one.

In this example I have the COM port hardcoded to COM2 (will need to scan COM ports initially to find which one has valid data), you can change it by providing a new value at the command-line, like "YouAreHere COM6" (code download link below) .

You can simulate a GPS receiver using Franson's GpsGate NMEA Logger. Give it a cut & paste log from somewhere else and you can loop through the flow of $GPxxx sentences while developing.

Delphi can be downloaded and used for free from CodeGear's website. And DelphiBasics is a great starting point and reference site for the language and its libraries.

BTW, CodeGear is a spin-off of the original developers of Delphi, C++Builder, JBuilder and InterBase, NDatastore among other development tools from Borland which now handles the ALM (Applications Lifecycle Management) side of the business.

YouAreHere original project and source files can be downloaded from this link.

No comments: