![]() |
VR-Forces 4.0.4 Class Documentation
|
The Back-End Remote Control example demonstrates the following:
This example demonstrates how to use the remote control API for controlling a VR-Forces back-end. It is a standalone console application that enables users to create/manipulate VR-Forces scenarios through a simple text interface.
(Release) remoteControl
(Debug) remoteControld
To run the application:
The results of the commands will be observable in the VR-Forces GUI. The GUI only being used as a passive display in this example. The remoteControl application is the one actually controlling VR-Forces back-end.
/******************************************************************************* ** Copyright (c) 2002 MAK Technologies, Inc. ** All rights reserved. *******************************************************************************/ /******************************************************************************* ** $RCSfile: main.cxx,v $ $Revision: 1.13 $ $State: Exp $ *******************************************************************************/ #include "textIf.h" #include "remoteControlInit.h" //VR-Forces headers #include <vrfMsgTransport/vrfMsgIf.h> #include <vrfcontrol/vrfController.h> //VR-Link headers #include <vl/exerciseConn.h> #include <vlutil/vlProcessControl.h> int main(int argc, char** argv) { //Create initializer object used to provide initialization data to the //exercise connection, configured through command line arugments. DtRemoteControlInitializer appInitializer(argc, argv); appInitializer.parseCmdLine(); //Create the controller DtVrfRemoteController* controller = new DtVrfRemoteController(); //Create an exercise connection DtExerciseConn* exConn = new DtExerciseConn(appInitializer); controller->init(exConn); //Create our text interface so we can enter text commands. DtTextInterface* textIf = new DtTextInterface(controller); //Processing: read stdin and call drainInput. //Calling drainInput() ensures that the controller receives //necessary feedback from VR-Forces backend applications. while (!textIf->timeToQuit()) { textIf->readStdin(); exConn->clock()->setSimTime(exConn->clock()->elapsedRealTime()); exConn->drainInput(); DtSleep(0.1); } delete textIf; delete controller; delete exConn; return 0; }