The Network Callback Manager example demonstrates the following:
- How to build a plugin module for the VR-Forces GUI
- How to create a protocol dependent accessory and add GUI elements to it
- How to update and retrieve data from the new state component in a sim component
- How to access data from a new state component in a network interface
- How to add data to a state view and retrieve that information in a state view and display it in an information panel
In order to incorporate a protocol-specific extension in the VR-Forces front-end, the VR-Vantage Accessories concept is used. An accessory is an external plugin that can be used in association with a particular application driver (scene, transport, etc). In the case of this example, a transport driver is used to extend functionality of the system.
The example adds a new remote entity net interface to read the new reflected state repository that contains the temperature:
{
DtSimObjectNetInterface::factory()->addCreatorFcn(
DtReflectedEntity::setStateRepCreator((DtReflectedEntity::DtStateRepCreator)
DtSimDataProcessorManager::instance(*connection).addDataProcessor(iffdp);
}
Make sure to create a new DtEntityStateInterceptor that is derived from the new reflected class
And, when the network interface needs to update itself from the network, it places the internal temperature into the state component:
if (netState)
{
try
{
if (stateComp)
{
stateComp->setInternalCoreTemperature(netState->
temperature());
}
}
catch(...)
{
}
}
When using accessories to extend the protocol-specific workings, it is important to note the following:
- The isCompatible method must be overriden to return "true" if the accessory is compatible with the supplied driver
- The install method must be overriden so as to set up connections that send notifications when the driver has been connected
- Similarly, the uninstall method must be overridden so that any connections made during the run of this plugin are disconnected
Usage
In the Launcher, . Enable the Add State Component plugin. Add the appropriate FOM module to the FOM modules line in the launcher and launch the front and back-end.
-
Copy AddStateComponent.fed, AddStateComponent.xml, and AddStateComponent_evolved.xml from examples to the bin64 directory.
-
If you are using HLA, edit FED File Name to be AddStateComponent.fed (HLA 1.3), AddStateComponet.xml (HLA 1516-2000), or AddStateComponent_evolved.xml (HLA Evolved).
-
Click the Plug-ins button to bring up the Plug-ins Selection dialog.
-
Enable the Add State Component plugin.
-
Start the launcher.
-
Load the addStateComponent developer example.
Plugin Entry Points
examplePlugin.cxx
#include <QtWidgets/QMessageBox>
using namespace makVrv;
using namespace makVrf;
{
}
{
if (!inter)
{
QMessageBox::warning(0, "Received Incorrect Pdu", "Received Incorrect Pdu");
return;
}
QString message;
message.sprintf("Received pdu message ");
message += inter->
message().c_str();
QMessageBox::information(0, "Received Pdu", message);
}
{
if(igApp)
{
initPluginMenus(*igApp, *de);
}
return true;
}
{
info.
pluginDescription =
"This is an example of how to send interactions/pdus from the front-end and then receive those pdus/interactions and report that information to the front-end.";
}