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

Remote Interface Documentation

Classes | Functions | Variables

GPSInfo: Get GPS information

Classes

struct  RI_CGPSInfo
 Data structure for the Request "GPSInfo". More...

Functions

LRESULT RI_GPSInfo_ReadData (LPARAM, RI_CGPSInfo &)
 Read data from shared memory for "GPS Info".

Variables

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

Variable Documentation

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

Message ID for the Request "GPS info":
RI_MESSAGE_GPSINFO

Read Memory:

RI_GPSInfo_ReadData(LPARAM id, RI_CGPSInfo data );

Return Values for InverseGeoCoding:

RI_NOERROR = GPS Signal ok
RI_NOFIX = No GPS fix
RI_NOTAV = No GPS Device available

Description:

Returns GPS-Informations like position and velocity (see data structure for more details).

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() ) ) 
        return RI_NAVIGATIONNOTACTIVE;
    //send the request
    PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
    return RI_NOERROR;
}

LRESULT CDlgMFC_GPSInfo::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_GPSINFO )
    {
        if ( (LRESULT)wParam == RI_NOFIX )
            //No Fix. errorcode (18)
        else if ( (LRESULT)wParam == RI_NOTAV)
            //No GPS Device available. errorcode (19)
        else if ( (LRESULT)wParam == RI_NOERROR)
        {
            //read data from Shared Memory
            RI_CGPSInfo data;
            LRESULT read_suc = RI_GPSInfo_ReadData( lParam, data );
            //GPS Signal ok.errorcode (0)
            TRACE(TEXT("Geodec Pos: %i,%i"), data.m_geodec_x, data.m_geodec_y);
            TRACE(TEXT("Mercator Pos: %i,%i"), data.m_mercator_x, data.m_mercator_y);
            TRACE(TEXT("Longitude: %i"), data.m_lon);
            TRACE(TEXT("Latitude: %i"), data.m_lat);
            TRACE(TEXT("Course: %i"), data.m_course);
            TRACE(TEXT("Speed: %i"), data.m_velocity);
            TRACE(TEXT("Satellites: %i"), data.m_noSatsUsed);
            TRACE(TEXT("Altitude: %i"), data.m_Altitude);
            TRACE(TEXT("Satellite Date: %s"), data.m_date);
            TRACE(TEXT("Satellite Time: %s"), data.m_time);
            TRACE(TEXT("Last Valid Pos: %i"), data.m_lastdata);
            //read data, when navigation is running (data.flag == true)
            if (data.flag == true)
            {
                TRACE(TEXT("Current Street: %s"), data.m_street);
                TRACE(TEXT("Target: %s"), data.m_target);
                TRACE(TEXT("Roadmatched Mercator Pos: %s"), data.n_mercator);
                TRACE(TEXT("Roadmatched Geodec. Pos: %i,%i"), data.n_geodec_x, data.n_geodec_y);
                TRACE(TEXT("Distance to Target: %i"), data.m_disttotarget);
                TRACE(TEXT("Time to Target: %i"), data.m_timetotarget);
                TRACE(TEXT("SpeedLimit: %i"), data.m_SpeedLimit);
            }
        }       
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_GPSInfo::foo()
{
    LPARAM id = GetUniqueID();
    if ( RI_MESSAGE( RI_MESSAGE_GPSINFO, 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