The Receive Spot Report example demonstrates the following:
- How to use spot reports and print spot report messages from the sim
- How to interface with the DtVrfRemoteController to receive and display the spot report messages
How to Run the Example
This example demonstrates how to use the remote control API for controlling a VR-Forces back-end. It is a standalone console application that will display spot reports received from the SIM engine when Spot Reports are enabled.
Usage
(Release) receiveSpotReport
(Debug) receiveSpotReportd
To run the application:
-
Open a command line and switch to the VR-Forces "bin" directory
-
Launch VR-Forces with "vrfLauncher.exe"
-
Start the receiveSpotReport application as "receiveSpotReportDIS.exe \--deviceAddress <device address>"
-
Open a scenario.
-
Turn on Spot Report by going to Settings->Application->Spot Report Settings and make sure "Send Spot Reports" is checked.
-
Play the scenario and observe the receiveSpotReport console to view the reported messages.
Classes
Plugin Entry Points
#include "remoteControlInit.h"
#include <vl/exerciseConn.h>
#include <vlutil/vlProcessControl.h>
#include <vlutil/vlKeyboard.h>
#include "vlutil/vlList.h"
#include <vector>
int keybrdTick(void);
{
{
std::vector<DtSimReport*> reports = reportCollection->
reports();
std::vector<DtSimReport*>::const_iterator iter = reports.begin();
while (iter != reports.end())
{
{
case 0:
forceType = "Other";
break;
case 1:
forceType = "Friendly";
break;
case 2:
forceType = "Opposing";
break;
case 3:
forceType = "Neutral";
break;
default:
break;
}
DtInfo("Spot Report: \n\t %s spotted %s of force %s nearby.\n",
forceType.c_str()
);
iter++;
}
return;
}
}
int main(int argc, char** argv)
{
appInitializer.parseCmdLine();
DtExerciseConn* exConn = new DtExerciseConn(appInitializer);
controller->
init(exConn);
while (keybrdTick() != -1)
{
exConn->clock()->setSimTime(exConn->clock()->elapsedRealTime());
exConn->drainInput();
DtSleep(0.1);
}
delete exConn;
return 0;
}
int keybrdTick()
{
char *keyPtr = DtPollInputLine();
if (!keyPtr)
return 0;
switch (*keyPtr)
{
case 'q':
case 'Q':
return -1;
default:
printf("Unrecognized command key <%c>\n", *keyPtr);
break;
}
return 0;
}