Creating GPS applications with .NET Compact Framework

Creating GPS applications with .NET Compact Framework

Instructions for deploying C# applications on IPAQ

Alisa Devlic <devlic@kth.se> - 2005.09.30

To create applications that use GPS information from Bluetooth equipped GPS receiver together with an iPAQ. The easy way to utilize the serial connection to the GPS receiver is to use Franson GpsTools. Franson has provided a set of tools which are integrated with the Visual Studio .NET environment. A trial version can be downloaded from http://franson.com/gpstools/. The current version 2.20 works well within .NET 2003, but it needs a slight modification to be run over .NET 2005 (details of this modification are below).

It is assumed that you have already installed Visual Studio .NET (2003 or 2005 Beta 2 version) on your PC. If you are using .NET 2005 Beta 2 and want to deploy application on IPAQ device, make sure you have installed the latest version of ActiveSync, and that is 4.0. A developer preview of ActiveSync 4.0 can be downloaded from http://msdn.microsoft.com/mobility/windowsmobile/downloads/default.aspx (scroll the page down a little to find it).

The following steps should be performed to run sample GPS application on IPAQ:

1. Download and unzip GpsTools SDK.
2. Run Setup.exe
3. Then take a look at the examples in the directory: Franson\GPS Tools SDK\.NET Compact Framework\Samples
4. I suggest starting with SerialPortNoEventsCS project. It simply reads data from the serial port and parses NMEA 0813 data (the standard GPS serial protocol). It presents your position as latitude, longitude or as grid coordinates. It does not use events.
5. Apply for a 30 Days Trial licence key at the Franson web site. You will receive it by e-mail.
6. If you use the Pocket PC Emulator and have a GPS receiver connected to your PC, you should set up the emultator's serial port. Go to menu: select Tools - Options and then choose the device (Pocket PC 2003 Emulator). Then click on Properties and/or Configure (depending on the version of .NET). Select the tab Peripherals or Hardware, then select the serial port on the PC you want to be the virtual device "COM1:" on the Pocket PC emulator.
7. Open the project from samples. If you are using .NET 2005, Visual Studio will need to convert it to the current version. So don't be surprised!
8. I mentioned a modification for .NET 2005. Open project file (SerialPortNoEvents.proj) in a text editor, where you can edit it. Find the tab <TargetFrameworkVersion> and modify its value to v2.0 in order to find the right compiler version, then build the project.
9. Install a native DLL GpsLibCE.dll.
Note: this is done differently for the emulator and a physical device.
  • For physical device:
    • Transfer the appropriate CAB file to the device and run it on the device. The name of the CAB file that you need for Pocket PC 2003 (ARM, Xscale CPU) is wince300\arm\GpsLibCE.arm.CAB. GpsLibCE.dll will be installed under "\Windows".
  • For emulator:
    • Right-click on the sample project in Visual Studio and select "Add existing item...". Change "Files of type:" to "*.*" and then select "wince300\x86em\ppc2002\GpsLibCE.dll".
10. Add a reference to GpsToolsNET.dll, GpsViewNET.dll, and GpsShapeNET.dll. Right click on "References" and select "Add Reference". Click "Browse...". Go to the root directory of the unzipped downloaded file. Select "GpsToolsNET.dll", "GpsViewNET.dll", and "GpsShapeNET.dll" and click "Open". Click "OK" on the "Add Reference" dialog.
11. In the main class (Form1.cs), find the line in the code that contains the licence.LicenceKey and modify it to take value of the 30 Days Trial licence key that you have been received by the e-mail.

Build your project in the Visual Studio .NET IDE and deploy the application on the device.

If you don't have a GPS receiver, you may use GpsGate tool to simulate GPS environment on your desktop PC. It can be downloaded from http://franson.com/gpsgate/. It enables multiple applications to share one GPS. For instructions on how to use GpsGate go to the same web page.

Click here to see the source code of application. It is excensively commented to give a better understanding of how system works.

Good luck and have fun developing GPS applications!