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

Remote Interface Documentation

Classes | Variables

StartNavigationOverBCR: Start a navigation from a BCR File

Classes

struct  RI_CStartNavigationOverBCR
 Data structure for the Request "StartNavigationOverBCR". More...

Variables

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

Variable Documentation

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

Message ID for the Request "StartNavigationOverBCR":
RI_MESSAGE_STARTNAVIGATIONOVERBCR

Write Memory:

RI_StartNavigationOverBCR_WriteData(LPARAM id, RI_CStartNavigationOverBCR data);

Return Values for StartNavigationOverBCR:

RI_NOERROR = Navigation succeeded
RI_ALREADY = Navigation not succeeded, Navigation is already running
RI_NOTFOUND = Navigation not succeeded, no BCR File found
RI_NOFIX = Navigation not succeeded, no GPS Fix
RI_NOTAV = Navigation not succeeded, no GPS avalable
RI_START_RETRACTED = Navigation succeeded. Start retracted
RI_TARGET_RETRACTED = Navigation succeeded. Target retracted
RI_START_TARGET_RETRACTED = Navigation succeeded. Start and target retracted

Description:

Calculates a route from an existent BCR-File and starts the navigation.
The file must be present in the bcr-directory of the navigation software and the BCR filename has to be given without path extensions, e.g. don't use "/truck/bcr/foo.bcr" but "foo.bcr".
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;
    //send the request
    PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
    return RI_NOERROR;
}

LRESULT CDlgMFC_StartNavigationOverBCR::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_STARTNAVIGATIONOVERBCR )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
            //Navigation succeeded. errorcode (0)
        else if ( (LRESULT)wParam == RI_NOFIX)
            //Navigation not succeeded, no GPS Fix. errorcode (18)
        else if ( (LRESULT)wParam == RI_NOTAV)
            //Navigation not succeeded, no GPS avalable. errorcode (19)
        else if ( (LRESULT)wParam == RI_NOTFOUND)
            //Navigation not succeeded, no BCR File found. errorcode (5)
        else if ( (LRESULT)wParam == RI_ALREADY)
            //Navigation not succeeded, Navigation is already running. errorcode (17)
        else if ( (LRESULT)wParam == RI_START_RETRACTED )
            //Navigation succeeded. errorcode (21)
        else if ( (LRESULT)wParam == RI_TARGET_RETRACTED )
            //Navigation succeeded. errorcode (22)
        else if ( (LRESULT)wParam == RI_START_TARGET_RETRACTED )
            //Navigation succeeded. errorcode (23)
        else if ( (LRESULT)wParam == RI_NAVIGATIONNOTACTIVE)
            //Navigator is not running or the configuration is not complete. errorcode(3)
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_StartNavigationOverBCR::foo()
{
    //define struct
    RI_CStartNavigationOverBCR data;
    //copy data
    wcscpy(data.m_BCRFileName,L"tour.bcr");
    //write data in shared memory
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_StartNavigationOverBCR_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR ) 
        return;
    if ( RI_MESSAGE( RI_MESSAGE_STARTNAVIGATIONOVERBCR, GetSafeHwnd(), id ) == RI_NOERROR )
        //message sending succeeded
    else
        //navigation software not running
}

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