Overview
 Top Next

The GPSDriver library is a wrapper above the GPS Intermediate Driver which was introduced in Windows Mobile 5.0.
The GPS Intermediate Driver is responsible of handling internal and external GPS devices and allows any number of applications to simultaneously share GPS data.
This library requires .Net Compact Framework 2.0 and Windows Mobile 5.0 or newer devices. The GPSDriver can work with internal and external GPS devices.
GPSConverter is also included in this library and it includes several methods for converting coordinates between different formats and different datums.
The GPSConverter is the same object as Converter which is part of the GPS library.
See the GPS documentation for more information about the converter.
The GPSDriver library will be merged in the executable during optimized compilation.

After opening the GPS device with Open method the most important method is GetGPSData. This method checks for new data and fills all position related properties with the new data.
GetGPSData should be periodically call, usually by a Timer.
Before retrieving the value of any position related property, a check should be done to make sure that the property data is valid.
It is important to close the driver when it is no longer required.

Example:
This example fills a ListBox named lstData with data from the GPS.
gps is a GPSDriver object.

Sub Globals

End Sub

Sub App_Start
      Form1.Show
      gps.New1
      TimeFormat("hh:mm:ss")
End Sub

Sub mnuConnect_Click
      gps.Open
      If gps.Opened = True Then
            Timer1.Interval = 1000
            Timer1.Enabled = True   
      End If
End Sub

Sub Timer1_Tick
      gps.GetDeviceData
      If gps.GetGpsData(6000) = True Then Displaygps
End Sub

Sub Displaygps
      lstData.Clear
      lstData.Add("Service status: " & gps.ServiceState)
      lstData.Add("Device status: " & gps.DeviceState)
      lstData.Add("Fix: " &  gps.FixType)
      lstData.Add("Driver prefix: " &  gps.DriverPrefix)
      If gps.MagneticVariation <> gps.InvalidData Then lstData.Add("Magnetic variation: " &  gps.MagneticVariation)
      If gps.PositionDilutionOfPrecision <> gps.InvalidData Then lstData.Add("PDOP: " & gps.PositionDilutionOfPrecision)
      If gps.SatelliteUsedCount <> gps.InvalidData Then lstData.Add("Satellites in use: " & gps.SatelliteUsedCount)
      If gps.Time <> 0 Then lstData.Add("Time: " & Date(gps.Time) & " " & Time(gps.Time))
      If gps.Latitude <> gps.InvalidData AND gps.Longitude <> gps.InvalidData Then
            lstdata.Add("Lat: " & gps.Latitude)
            lstdata.Add("Lon: " & gps.Longitude)
      End If
      If gps.SeaLevelAltitude <> gps.InvalidData Then lstdata.Add("SeaLevelAltidute: " & gps.SeaLevelAltitude)    
      If gps.EllipsoidAltitude <> gps.InvalidData Then lstdata.Add("EllipsoidAltitude: " & gps.EllipsoidAltitude)  
      If gps.Speed <> gps.InvalidData Then lstdata.Add("Speed: " & gps.Speed * 1.852)
      If gps.Heading <> gps.InvalidData Then lstdata.Add("Course: " & gps.Heading)
End Sub

Sub Form1_Close
      gps.Close
End Sub