Follow

Get Eta and Distance example

Introduction

This sample demonstrates how to obtain eta and distance to destination on the currently calculated route. They key function here is the API function GetRouteInfo followed by retrieving the attributes by RemainingDistance and GetEstimatedTimeArrival.

C#

void GetDistance()
{
      SRouteInfo RouteInfo = new SRouteInfo();
      SError err;
      int ret = CApplicationAPI.GetRouteInfo(out err, out RouteInfo, 0);
      Debug.WriteLine("Remaining Distance in metres = " + RouteInfo.RemainingDistance.ToString());
}

void GetETA()
{
      SRouteInfo RouteInfo = new SRouteInfo();
      SError err;
      int ret = CApplicationAPI.GetRouteInfo(out err, out RouteInfo, 0);

      ushort years;
      byte months, days, hours, minutes, seconds;
      RouteInfo.GetEstimatedTimeArival(out years, out months, out days, out hours, out minutes, out seconds);

      Debug.WriteLine("ETA ="
                + " " + years.ToString()
                + "-" + months.ToString()
                + "-" + days.ToString()
                + " " + hours.ToString()
                + ":" + minutes.ToString()
                + ":" + seconds.ToString());
}
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments