C# SDK

◆ StartNavigation() [1/3]

static int StartNavigation ( out SError  Error,
ref SWayPoint  Location,
Int32  Flags,
bool  bShowApplication,
bool  bSearchAddress,
Int32  MaxTime 
)
inlinestatic

The function starts navigate to taken location.

Parameters
ErrorAdditional error information returned from Drive.
LocationReference to instance of SWayPoint class which contains informations about target.
bSearchAddressFlag determining whether GetHistoryList searches for address or not.
true - StartNavigation fills address member of each SHistoryRecord with corresponding address.
false - StartNavigation does not search for address.
MaxTimeMaximum time (in milliseconds) function can take. If MaxTime=0 function execution is not time limited.
FlagsParameter Flags determines route computing properties.
It should be value from NavigationParams.
bShowApplicationFlag determining whether Drive should be brought to foreground automatically.
true - Drive will be brought to foreground
false - Drive will stay in background
Returns
1 if successful, other value otherwise.

To use this function it is necessary to have valid GPS signal and Location must be situated on loaded map. It is necessary to set Location member of Location.

Parameter Flags determines some route computing properties. Possible values are enumerated in NavigationParams enum. For example it is possible notify user that not all toll roads can be avoided.

To join more flags together use logical or operator (|). For more informations see NavigationParams enum.

It is possible to get returned (if address is returned) address by calling function

If waypoint is in restricted area , the function will return lX,lY coordinates of closest reached point in error description (truck attributes enabled) Location.GetAddress().

See Coordinates conversion section in TROUBLESHOOTING page.

Possible error codes returned from Drive are:

  • 0 - Function not succeeded.
  • 1 - Function succeeded.
  • 2 - Drive not succeeded.
  • 3 - Function reached timeout.
  • -1 - Navigation not started because address was not found or closest reached point was found
  • -3 - Navigation not started. Drive is already navigating.
  • -5 - User canceled route computing.
  • -6 - Drive is waiting for valid GPS signal.
SError error;
SWayPoint Location = new SWayPoint();
int Flags;
bool bShowApplication;
bool bSearchAddress;
LONGPOSITION Position;
string strAddress = "SVK,Bratislava,Einsteinova,1";
int MaxTime;
CApplicationAPI.LocationFromAddress(out error, out Position, strAddress, MaxTime);
Location.Location.lX = Position.lX;
Location.Location.lY = Position.lY;
Flags = NavigationParams.NpMessageAvoidTollRoadsUnable;
bShowApplication = true;
bSearchAddress = true;
MaxTime = 10000;
CApplicationAPI.StartNavigation(error, Location, Flags, bShowApplication, bSearchAddress, MaxTime);

This code brings drive to foreground and starts navigate to taken position. If not toll roads can be avoided Drive notify user about this.
After function execution Location.GetAddress function returns destination address.

References SWayPoint.SizeOf(), and SError.SizeOf().