Classes | Functions | Variables
SwitchMap: Change the map

Classes

struct  RI_CSwitchMap
 Data structure for the Request "SwitchMap". More...
 

Functions

LRESULT RI_SwitchMap_ReadData (LPARAM, RI_CSwitchMap &)
 Read data from shared memory for "switch map".
 
LRESULT RI_SwitchMap_WriteData (LPARAM, RI_CSwitchMap &)
 Write data to shared memory for "switch map".
 

Variables

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

Detailed Description

Variable Documentation

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

Message ID for the Request "SwitchMap":
RI_MESSAGE_SWITCHMAP

Write Memory:

RI_SwitchMap_WriteData(LPARAM id, RI_CSwitchMap data );

Read Memory:

RI_SwitchMap_ReadData(LPARAM id, RI_CSwitchMap data );

Return Values for SwitchMap:

RI_NOERROR = SwitchMap succeeded
RI_NOTADDED = Switch Map not succeeded, because no map found

Description:

Switches the map to the given one. If the map doesn't exist, returns an error. Also returns the available maps as a string list.

Returns a single package

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() ) )
//send the request
PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
return RI_NOERROR;
}
LRESULT CDlgMFC_SwitchMap::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam )
{
//check messages for answer from RI
if ( message == RI_MESSAGE_SWITCHMAP )
{
if ( (LRESULT)wParam == RI_NOERROR )
{
LRESULT read_suc = RI_SwitchMap_ReadData( lParam, data );
//Switch Map succeeded. errorcode (0)
TRACE( TEXT("Map Name: %s"),data.m_MapName );
TRACE( TEXT("Current Map Name: %s"),data.m_CurrentMapName );
TRACE( TEXT("Current Map Date: %s"),data.m_Currentmapdate );
TRACE( TEXT("Current Map Version: %s"),data.m_CurrentMapversion );
for (int i=0; i<data.m_MapCount; i++)
{
TRACE(TEXT("Available Maps: %s"),data.m_AvailableMaps[i]);
}
}
else if ( (LRESULT)wParam == RI_NOTADDED )
//Switch Map not succeeded. errorcode (-1)
}
return CDialog::WindowProc( message, wParam, lParam );
}
void CDlgMFC_SwitchMap::foo()
{
//define struct
// *** copy data ***
wcscpy (data.m_MapName, L"deu_08Q2");
// *** write data in shared memory ***
LPARAM id = GetUniqueID();
LRESULT sharing_ret = RI_SwitchMap_WriteData( id, data );
if ( sharing_ret != RI_NOERROR )
return;
if ( RI_MESSAGE( RI_MESSAGE_SWITCHMAP, GetSafeHwnd(), id ) == RI_NOERROR )
//message sending succeeded
else
//navigation software not running
}

© PTV Group 2020 Generated on Wed Apr 15 2020 12:47:52 for by doxygen 1.8.8