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

Remote Interface Documentation

Variables

StartSimulation: Start Simulation

Variables

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

Variable Documentation

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

Message ID for the Request "start simulation":
RI_MESSAGE_STARTSIMULATION

Write Memory:

This function has no writer.

Read Memory:

This function has no reader.

Return Values for StartSimulation:

RI_NOERROR = Simulation succeeded
RI_NOTADDED = Simulation not succeeded
RI_START_RETRACTED = Simulation succeeded. Start was retracted
RI_TARGET_RETRACTED = Simulation succeeded. Target was retracted
RI_START_TARGET_RETRACTED = Simulation succeeded. Start and target was retracted

Description:

Sending this message will start a simulation.
Requires two previously added stop-off-points.
The remote interface will disable user interaction before executing the command and allow user interaction after the command if there was no previously call to BlockUserInteraction.

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_StartSimulation::WindowProc ( UINT  message , WPARAM  wParam , LPARAM  lParam )
{
    //check messages for answer from RI
    if ( message == RI_MESSAGE_STARTSIMULATION )
    {
        if ( (LRESULT)wParam == RI_NOERROR )
            //Simulation succeeded. errorcode (0)
        else if ( (LRESULT)wParam == RI_NOTADDED)
            //Simulation not succeeded, invalid points. errorcode (11)
        else if ( (LRESULT)wParam == RI_START_RETRACTED )
            //Simulation succeeded. errorcode (21)
        else if ( (LRESULT)wParam == RI_TARGET_RETRACTED )
            //Simulation succeeded. errorcode (22)
        else if ( (LRESULT)wParam == RI_START_TARGET_RETRACTED )
            //Simulation succeeded. errorcode (23)
        else 
            //Simulation not succeeded. errorcode (-1)
    }
    return CDialog::WindowProc( message, wParam, lParam );
}

void CDlgMFC_StartSimulation::foo()
{
    LPARAM id = GetUniqueID();
    if ( RI_MESSAGE( RI_MESSAGE_STARTSIMULATION, GetSafeHwnd(), id ) == RI_NOERROR )
        //message sending succeeded
    else
        //navigation software not running
}


Flowchart:

RI-StartSimulation.gif



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