C++ SDK

◆ SetRoute() [3/3]

static int CApplicationAPI::SetRoute ( LpError  lpError,
LPCTSTR  lpszItineraryName,
DWORD  dwFlags,
BOOL  bCloseDelivery,
BOOL  bShowApplication,
int &  nWrongWaypointsCount,
int *&  lpWrongWaypoints,
DWORD  dwMaxTime = DEFAULT_MAX_TIME 
)
static

The function computes route based on taken itinerary. If Drive has valid GPS signal it starts navigation.

Parameters
lpErrorAdditional error information returned from Drive.
lpszItineraryNameName of the itinerary which will be used to compute route.
dwMaxTimeMaximum time (in milliseconds) function can take. If dwMaxTime=0 function execution is not time limited.
bShowApplicationFlag determining whether Drive should be brought to foreground automatically.
true - Drive will be brought to foreground.
false - Drive will stay in background.
dwFlagsParameter Flags determines route computing properties.
Possible values are enumerated in:
NavigationParams.
bCloseDeliveryParameter determining whether the waypoint is in restricted area or not
true - if a waypoint is in delivery area, the route will be calculated
false - if a waypoint is in delivery area, it will be considered restricted area
Returns
1 if successful, other value otherwise.

If Drive does not have valid GPS signal first waypoint in itinerary must be marked as START.

Parameter Flags determines route computing properties.
For example it is possible to ask user to avoid toll roads or (later) 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.

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

Itinerary used to compute route must contain item of type "finish". If you do not have valid GPS position itinerary must contain also item of type "start".

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.
  • -7 - Itinerary is empty
  • -8 - Itinerary has invalid format (from version 15j)
  • -9 - One or more waypoints were not found (from version 15j)
  • -10 - Itinerary was not found (from version 15j)