Home · All Commands · First Steps · Tutorials · Demos · FAQ
 

Remote Interface Documentation

Variables

StartNavigation: Start Navigation

Variables

const UINT RI_MESSAGE_STARTNAVIGATION = RegisterWindowMessage(TEXT("RI_MESSAGE_STARTNAVIGATION"))

Variable Documentation

const UINT RI_MESSAGE_STARTNAVIGATION = RegisterWindowMessage(TEXT("RI_MESSAGE_STARTNAVIGATION"))

Message ID for the Request "start navigation":
RI_MESSAGE_STARTNAVIGATION

Write Memory:

This function has no writer.

Read Memory:

This function has no reader.

Return Values for StartNavigation:

RI_NOERROR = Navigation succeeded
RI_NOTADDED = Tracking Modus succeeded
RI_NOFIX = Navigation not succeeded, no GPS Fix
RI_NOTRUN = Navigation not succeeded, error in route calculation
RI_USER = Navigation not succeeded, User abort Navigation
RI_START_RETRACTED = Navigation succeeded. start was retracted
RI_TARGET_RETRACTED = Navigation succeeded. Target was retracted
RI_START_TARGET_RETRACTED = Navigation succeeded. Start and target was retracted

Description:

Sending this message will start the navigation to a previously set stop-off-point. If no stop-off-point is given, the navigator will go into tracking mode.
If there's no gps fix, the command will wait for up to 60 seconds for gps.
The acknowledgement message of the command will return after the route calculation, so be prepared that the message can take a while to arrive.
The remote interface will disable user interaction before executing the command and allow user interaction after the command if there was no previously call to BlockUserInteraction.

Example:

#define USE_LOADLIBRARY
#include "TNSRemoteInterfaceDll.h"

LPARAM GetUniqueID()
{
    //generate unique ID
    static LPARAM id = 0;
    if (++id == 0) ++id; // do not use 0 !!!!!
    return id;
}

inline LRESULT RI_MESSAGE( const UINT request, HWND h_client, LPARAM id )
{
    //check if RI handle is valid
    if ( !IsWindow( RI_GetTNS() ) )
        return RI_NAVIGATIONNOTACTIVE;
    PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
    return RI_NOERROR;
}

LRESULT CDlgMFC_StartNavigation::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_STARTNAVIGATION )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
            //Navigation succeeded. errorcode (0)
        else if ( (LRESULT)wParam == RI_USER)
            //Navigation not succeeded, User abort Navigation. errorcode (20)
        else if ( (LRESULT)wParam == RI_NOTADDED)
            //Tracking Modus succeeded. errorcode (11)
        else if ( (LRESULT)wParam == RI_NOFIX)
            //Navigation not succeeded, no GPS Fix. errorcode (18)
        else if ( (LRESULT)wParam == RI_NOTRUN)
            //Navigation not succeeded, Route calculation failed. errorcode (17)
        else if ( (LRESULT)wParam == RI_START_RETRACTED )
            //Navigation succeeded. Start was retracted. errorcode (21)
        else if ( (LRESULT)wParam == RI_TARGET_RETRACTED )
            //Navigation succeeded. Target was retracted. errorcode (22)
        else if ( (LRESULT)wParam == RI_START_TARGET_RETRACTED )
            //Navigation succeeded. Start and Target was retracted.errorcode (23)
        else 
            //Navigation not succeeded. errorcode (-1)
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_StartNavigation::foo()
{
    LPARAM id = GetUniqueID();
    if ( RI_MESSAGE( RI_MESSAGE_STARTNAVIGATION, GetSafeHwnd(), id ) == RI_NOERROR )
        //message sending succeeded
    else
        //navigation software not running
}


Flowchart:

RI-StartNavigation.gif



© PTV AG 2011 Generated on Fri Oct 14 2011 10:17:32 for RI by doxygen 1.7.1