The Interface Content example demonstrates the following:
- How to create a new interface content message
- How to install the interface content message in the factory
- How to send and receive the new interface content message
The Interface Content example creates a new type of VRF interface message class MyInterfaceContent which demonstrates how to send and receive interface content messages.
Since this example is loaded as a plugin, it can be used in conjunction with the released VR-Forces application
To view the new behavior:
-
Start vrfSim.
-
Start vrfGui.
A menu item to send the interface content message will be created under the Simulation menu. Type in a message. The back-end will receive the message and send an acknowledgement to the front-end
Classes
Plugin Entry Points
#include <vlutil/vlPrint.h>
#include <vl/exerciseConn.h>
static DtSimulationAddress theSimulationAddress;
static int theOutgoingMessageNumber = 0;
extern "C" {
{
{
}
else if (ifMsg->
sender() == theSimulationAddress)
{
}
else if (theSimManager)
{
DtInfo("messageCallback received MyInterfaceContent:\n");
DtInfo("--------------------------------------------\n");
DtInfo("%s\n", output.string());
response = "Server Response (";
response += theSimulationAddress.string();
response += "): Received: ";
msg.setMessage(response);
msg.setNumber(myContent->
number());
msg.setAck(true);
}
}
{
~DtPingCommand() { };
{
messageToSend = "Test message from (";
messageToSend += theSimulationAddress.string();
messageToSend += "): Sending Text: ";
messageToSend += parameters;
return true;
}
{
return "Send a message with the given text.";
};
};
static DtPingCommand* thePingCommand = new DtPingCommand();
{
info.
pluginDescription =
"This is an example of how to add a new interface message in the VRF back-end.";
}
{
return true;
}
{
theSimulationAddress = cgf->
exerciseConn()->applicationId();
thePingCommand);
return true;
}
}