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

Remote Interface Documentation

Classes | Functions | Variables

StartGPSRecord: Start GPS recording

Classes

struct  RI_CStartGPSRecord
 Data structure for the Request "StartGPSRecord". More...

Functions

LRESULT RI_StartGPSRecord_WriteData (LPARAM, RI_CStartGPSRecord &)
 Write data to shared memory for "Start GPS Record".

Variables

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

Variable Documentation

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

Message ID for the Request "start GPS Record":
RI_MESSAGE_STARTGPSRECORD

Write Memory:

RI_StartGPSRecord_WriteData(LPARAM id, RI_CStartGPSRecord data );

Return Values for StartGPSRecord:

RI_NOERROR = Start recording of GPS positions succeeded
RI_TOBIG = GPS recording file reached maximum file size
RI_ALREADY = Start recording of GPS positions is already running
RI_NOTWRITE = Error while opening GPS recording file

Description:

Records the GPS-coordinates in a separate file (see data structure for more details).

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_StartGPSRecord::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_STARTGPSRECORD )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
            //Start recording of GPS positions succeeded. errorcode(0)
        else if ( (LRESULT)wParam == RI_ALREADY )
            //Start recording of GPS positions is already running. errorcode(13)
        else if ( (LRESULT)wParam == RI_NOTWRITE )
            //Error while opening GPS recording file. errorcode(15)
        else if ( (LRESULT)wParam == RI_TOBIG )
            //GPS recording file reached maximum file size. errorcode(14)
        else 
            //Start recording of GPS positions not succeeded. errorcode(-1)
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_StartGPSRecord::foo()
{
    //define struct
    RI_CStartGPSRecord data;
    // *** copy data ***
    wcscpy (data.m_FileName, L"gpsrecord.out");
    data.m_MaxFileSize = 1048576;
    data.m_Interval = 10;
    data.m_OutputFormat = 1;
    // *** write data to shared memory ***
    LPARAM id = GetUniqueID();
    LRESULT sharing_ret = RI_StartGPSRecord_WriteData( id, data );
    if ( sharing_ret != RI_NOERROR ) 
        return;
    if ( RI_MESSAGE( RI_MESSAGE_STARTGPSRECORD, 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