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

Remote Interface Documentation

Classes | Functions | Variables

GetFavoriteList: Get all stop off points from the favoritelist

Classes

struct  RI_CGetFavoriteList
 Data structure for the Request "GetFavoriteList". More...

Functions

LRESULT RI_GetFavoriteList_ReadData (LPARAM, RI_CGetFavoriteList &)
 Read data from shared memory for "Get stop off point from FavoriteList".
LRESULT RI_GetFavoriteList_WriteData (LPARAM, RI_CGetFavoriteList &)
 Write data to shared memory for "Get stop off point from FavoriteList".

Variables

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

Variable Documentation

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

Message ID for the Request "Get Favoritelist":
RI_MESSAGE_GETFAVORITELIST

Write Memory:

RI_GetFavoriteList_WriteData(LPARAM id, RI_CGetFavoriteList data );

Read Memory:

RI_GetFavoriteList_ReadData(LPARAM id, RI_CGetFavoriteList data );

Return Values for GetFavoriteList:

RI_NOERROR = Get Favorite List succeeded

Description:

Gets the favorite list.
If more than one station is in the list, the first received data structure will include the number of stations. The user will have explicitly send a new message to get the next station until all stations are transfered.

Can return multiple packages

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_GetFavoriteList::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_GETFAVORITELIST )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
        {
            RI_CGetFavoriteList data;
            LRESULT read_suc = RI_GetFavoriteList_ReadData( lParam, data );
            if ( read_suc != RI_NOERROR )
                //...data was overwritten. errorcode (-2)
            else
            {
                //examine whether station is smaller than more stationscounter
                if (data.m_index < data.m_listcount )
                {
                    TRACE(TEXT("Caption: %s"),data.m_Caption);
                    TRACE(TEXT("Description: %s"),data.m_Description);
                    TRACE(TEXT("X-Koordinate: %i"),data.m_mercator_x);
                    TRACE(TEXT("Y-Koordinate: %i"),data.m_mercator_y);
                    TRACE(TEXT("ID: %i"),data.m_StationID);
                    //advance station counter
                    data.m_index = data.m_index + 1;
                    //write data
                    LRESULT sharing_ret = RI_GetFavoriteList_WriteData( data.m_ID, data );
                    //get next station from the list
                    RI_MESSAGE( RI_MESSAGE_GETFAVORITELIST, GetSafeHwnd(), data.m_ID );
                 }
            }
        }
        else 
            //Get Stop of Point List not succeeded. errorcode (-1)
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_GetFavoriteList::foo()
{
    //*** copy data ***
    RI_CGetFavoriteList data;
    //write flag and index
    data.m_index = 0;

    //*** write data in shared memory ***
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_GetFavoriteList_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR )
        return;
    if ( RI_MESSAGE( RI_MESSAGE_GETFAVORITELIST, GetSafeHwnd(), id ) == RI_NOERROR )
        //message sending succeeded
    else
        //navigation software not running
}

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