float LocationGetCourse();

 

Gets the current direction of travel.

 

Return Value

 

Returns a positive value (related to compass heading) if the call was successful, negative otherwise.

 

Remarks

 

LocationGetCourse() returns the direction of travel as a compass heading. A value of 0 indicates north, 90 indicates east, 180 indicates south and 270 indicates west.  A negative value indicates that course cannot be determined.  Determination of course relies on having prior location data and a device that is moving.  It is not unusual for a stationary device to report negative values even if GPS is available on the device.

 

Course data is not available on all devices, as it requires a GPS radio.

 

Windows Simulator NOTE: To provide values for the Windows Simulator, be sure to edit C:\DragonFireSDK\DragonFireSDK.ini and modify the value for Course in the Location section.

 

NOTE: It is recommended to call LocationMonitorLocation() prior to calling LocationGetCourse().  This gives the device time to begin receiving more and more accurate location data prior to getting location data.  Subsequent calls to LocationGetCourse() may become more accurate over time as the device pinpoints your location.

 

Availability

 

Available in DragonFireSDK 1.4 and later on devices with GPS.

 

Example

 

#include "DragonFireSDK.h"

 

int MyFont;

int CourseText;

char TextBuffer[100];

 

void AppMain()

{

  LandscapeMode();

 

  // Begin monitoring location

  LocationMonitorLocation(1);

 

  MyFont = FontAdd("Helvetica", "Regular", 24, 0x00FF00);

  CourseText = TextAdd(10, 10, "Course:", MyFont);

}

 

//===============================================

void OnTimer()

{

  float course;

 

  course = LocationGetCourse();

 

  sprintf(TextBuffer, "Course: %f degrees", course);

  TextSetText(CourseText, TextBuffer);

}

 

//===============================================

void AppExit()

{

 

}