float LocationGetSpeed();

 

Gets the current speed of travel (in meters per second).

 

Return Value

 

Returns a positive value (meters per second) if the call was successful, negative otherwise.

 

Remarks

 

LocationGetSpeed() returns the speed of travel in meters per second.  Since speed values can change many times between delivery of values, this information should be used for informational purposes only.

 

Speed 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 Speed in the Location section.

 

NOTE: It is recommended to call LocationMonitorLocation() prior to calling LocationGetSpeed().  This gives the device time to begin receiving more and more accurate location data prior to getting location data.  Subsequent calls to LocationGetSpeed() 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 SpeedText;

char TextBuffer[100];

 

void AppMain()

{

  LandscapeMode();

 

  // Begin monitoring location

  LocationMonitorLocation(1);

 

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

  SpeedText = TextAdd(10, 10, "Speed:", MyFont);

}

 

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

void OnTimer()

{

  float speed;

 

  speed = LocationGetHorizontalAccuracy();

 

  sprintf(TextBuffer, "Speed: %fm/s", speed);

  TextSetText(SpeedText, TextBuffer);

}

 

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

void AppExit()

{

 

}