GetHeading

Description

Populates a GPSHeading structure with data from the current heading.

Applies to

GPS and SerialGPS objects

Syntax

Integer GPSname.GetHeading( GPSHeading )

Argument

Description

GPSname

Name of the GPS or SerialGPS object

GPSHeading

Structure passed by reference that stores speed and directional information used by the SerialGPS object

Returns

Integer. Returns 1 for success and 100 or a negative number for an error. The following is a list of possible error codes and their meanings:

Usage

Use this function to populate a GPSHeading structure with information about the direction of travel, ground speed, and magnetic variation.

Examples

Example 1

The following lines create a SerialGPS object, retrieve information about the current position fix, test the validity of the GPSHeading object, and write data to a multiline edit box:

SerialGps myGPS
real TrueHeading, Speed, MV
char MVD
GPSHeading myGPSHeading

Integer rc

MyGPS = CREATE SerialGPS
myGPS.Open()
...

rc = MyGPS.GetHeading(myGPSHeading)
IF rc = 1 THEN 

TrueHeading = myGPSHeading.Heading
Speed = myGPSHeading.groundspeed
MV = myGPSHeading.MagneticVariation
MVD = myGPSHeading.MagneticVariationDirection
mle_1 = "Ground speed: " + String(Speed)
mle_1 += "True heading: " + String(TrueHeading) + "~r~n"
mle_1 += "Variation: " + String(MV) + MVD

ELSE

//Process error

END IF

See also