Classes | Functions | Variables
GPSLog: send NMEA Data to the navigator

Classes

struct  RI_CGPSLog
 Data structure for the Request "GPSLog". More...
 

Functions

LRESULT RI_GPSLog_WriteData (LPARAM, RI_CGPSLog &)
 Write data to shared memory for "GPS Log".
 

Variables

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

Detailed Description

Variable Documentation

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

Message ID for the Request "transfer NMEA Data over RI":
RI_MESSAGE_GPSLOG

Write Memory:

RI_GPSLog_WriteData(LPARAM id, RI_CGPSLog data );

Return Values for GPSLog:

RI_NOERROR = NMEA transfer succeeded
RI_NOTADDED = Data not added, because simulation is active
RI_NOTRUN = GPS transfer is stopped

Description:

Sends NMEA-Data over RI to the navigation software.
The data sentences "$GPGGA", "$GPRMC" and "$GPVTG" are mandatory.
Be sure that the date in the sentences is correct, because it's needed by some modules. The setences has to be complete, substrings are not supported. Also the NMEA strings must have a correct checksum, overwise they will be discarded.
Don't use this method together with a GPS-Device, the signals would be mixed!

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_GPSLog::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam )
{
//check messages for answer from RI
if ( message == RI_MESSAGE_GPSLOG )
{
if ( (LRESULT)wParam == RI_NOERROR )
//NMEA transfer succeeded. errorcode(0)
else if ( (LRESULT)wParam == RI_NOTRUN )
//GPS transfer is stopped. errorcode(17)
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_GPSLog::foo()
{
// *** define struct ***
RI_CGPSLog data;
// *** copy data ***
wcscpy (data.m_Nmea,
L"$GPGGA,171710.350,4900.5533,N,00826.3949,E,1,05,3.5,168.0,M,,,,0000*02\r\n
$GPGLL,4900.5533,N,00826.3949,E,171710.350,A*35\r\n
$GPRMC,171710.350,A,4900.5533,N,00826.3949,E,0.0,175.8,261103,,*0E\r\n
$GPVTG,175.8,T,,M,0.0,N,0.0,K*6B\r\n
$GPGGA,171711.350,4900.5533,N,00826.3950,E,1,05,3.5,168.5,M,,,,0000*0E\r\n");
//write data to shared memory
LPARAM id = GetUniqueID();
LRESULT sharing_ret = RI_GPSLog_WriteData( id, data );
if ( sharing_ret != RI_NOERROR )
return;
if ( RI_MESSAGE( RI_MESSAGE_GPSLOG, 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