Populates a GPSHeading structure with data from the current heading.
GPS and SerialGPS objects
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 |
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:
-10 Invalid object. Could occur if the GPS object instance is corrupted.
-13 Not previously opened. This function cannot be called until a GPS object or SerialGPS object has been successfully opened.
-14 Read timeout. Occurs when the timeout interval (a ConfigParams property of the SerialGPS object) is exceeded.
-16 Parser Error. Parser is unable to interpret a sentence. This error is generated when nonstandard tokens are discovered while parsing the GPS data.
-17 Checksum Error. Most GPS sentences end in a two-digit checksum value. The PocketBuilder parser verifies this value and reports a checksum error if the calculated value does not match the stated value.
Use this function to populate a GPSHeading structure with information about the direction of travel, ground speed, and magnetic variation.
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