GetGPSInfo
This command will retrieve GPS data from an attached GPS receiver on the mobile device. If no receiver is available or no signal is received the output will be zeros. This command would need to be called repeatedly to update the screen if the device is in motion. Use the Form_OnTimer event to continuously populate variables.
Group:Device Extensions
Note: The operating system GPS APIs must exist on the device. To configure the GPS settings on the mobile device locate the GPS configuration, set the Program COM port to ‘none’ and set the Hardware COM port to the proper number based on the manufacturer’s documentation.
Syntax: [bOK =] Device.GetGPSInfo([vLongitude], [vLatitude], [vHeading], [vAltitude], [vSpeed])
OK (Boolean) Optional – the success or failure of the command.
Longitude (Variant) Optional – returns the longitude as a float value
Latitude (Variant) Optional – returns the latitude as a float value
Heading (Variant) Optional – returns the heading as a value (0-360)
Altitude (Variant) Optional – returns the altitude in meters
Speed (Variant) Optional – returns the speed in knots (nautical miles)
Example:
Dim bOK as Boolean
Dim vLong as Variant
Dim vLat as Variant
Dim vHead as Variant
Dim vAlt as Variant
Dim vSpeed as Variant
bOK = Device.GetGPSInfo (vLong, vLat, vHead, vAlt, vSpeed)
bOK = Device.GetGPSInfo (, , , vAlt)
For converting meters to US feet use the following conversion:
vAlt = vAlt * 3.28083989501312
For converting knots to US MPH use:
vSpeed = vSpeed * 1.15077945
For converting knots to KPH use:
vSpeed = vSpeed * 1.852
For converting the heading into a direction use:
Select Case vHead
Case Is < 22.5: sText = "N"
Case Is < 67.5: sText = "NE"
Case Is < 112.5: sText = "E"
Case Is < 157.5: sText = "SE"
Case Is < 202.5: sText = "S"
Case Is < 247.5: sText = "SW"
Case Is < 292.5: sText = "W"
Case Is < 337.5: sText = "NW"
Case Else: sText = "N"
End Select