VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Network Callback Manager (networkCallbackManager)

Table of Contents

The Network Callback Manager example demonstrates the following:

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, in this case the HLA13 and HLA1516 drivers.

When using accessories to extend the protocol-specific workings, it is important to note the following:

This accessory introduces the concept of the DtNetworkMessageInterface which is used to as a base class for subclasses that want to send specific content of a PDU to the GUI thread. The developer will create a subclass (e.g. DtTestInteractionInterface) to store the content of the PDU they wish to communicate to the GUI. Then, the receivedNetworkMessage call of the DtVrfDriver is used to communicate that message to the GUI thread.

On the GUI side, the developer registers for callbacks for a particular network message by using the registerNetworkMessageInterfaceCallback method of the DtGuiThreadNetworkCallbackManager class. When a message of this type is received, the boost bound method is called in response.

This example also shows how to use an event signaler to signal events from the GUI thread to the network thread. In this case in response to a menu item being selected the VR-Link comment interaction being published on the network.

Usage

Since this example is loaded as a plugin Select Settings, Plugins... and on the Plugins Editor page, use the combo box at the top of the page to select the plug-in. Then enable the Load Plugin checkbox for the networkCallbackManager example and re-start VR-Forces.

  1. Start vrfGui in either HLA13 or HLA1516 mode.
  2. Choose Network Callback Menu
  3. A dialog will be displayed on receipt of the comment interaction, showing the protocol used to receive it
  4. Select the Send Network Message menu item

Classes

DtCallbackMenuThe menu that contains the item to send the interaction.
DtNetworkCallbackManagerAccessoryThe accessory class used to send and receive the DtCommentInteraction.
DtTestInteractionInterfaceInterface used to take network dependent content to transfer to the GUI thread.
DtExampleEventSignalerSignaler used by the GUI to notify the network thread to send the comment interaction.

Plugin Entry Points

examplePlugin.cxx

/*******************************************************************************
** Copyright (c) 2012 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//\file examplePlugin.cxx
//\brief Loads the plugin
//This file defines the generic DT_DLL_VRF_PLUGIN_EXPORT_MACRO. Use that macro when
//you want to export symbols. Also, in your CMakeLists.txt file, make sure to
//define the VRFPLUGIN_EXPORTS define to tell the compiler to define the macro as an
//export
#include "exampleMenu.h"
#include <vrvCore/DtDe.h>
#include <QtGui/QMessageBox>
using namespace makVrv;
using namespace makVrf;
void initPluginMenus(DtVrvApplication& app, DtDe& de)
{
//First, register the creators with the menu assember
//Now, add the menu to the master mode configuration. mainMenu indicates that
//the example menu is going to be used as a top-level main menu rather than a
//sub-menu. Add it before the Task menu. To leave off the path will
//put the menu at the end of the menu bar
DtMenuPath::mainMenu("DtTaskMenu"));
//Now, register the DtCallbackMenuItem as an item of DtCallbackMenu
DtMenuPath::mainMenu("DtCallbackMenu").item("DtCallbackMenuItem"));
}
void DtTestInteractionInterfaceCallback(DtNetworkMessageInterface* iface)
{
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);
}
//Implemented to be able to use the INIT_ONCE method
bool initDeModule(DtDe* de)
{
//Add this accessory into the accessory manager so it can be loaded by the VRL drivers
if(igApp)
{
initPluginMenus(*igApp, *de);
//Add callbacks for test interaction callback and test pdu callback
DtTestInteractionInterface::theName()).connect(boost::bind(&DtTestInteractionInterfaceCallback, _1));
}
return true;
}
{
info.pluginName = "networkCallbackManager";
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.";
info.pluginVersion = "1.00";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "150 Cambridge Park Drive 3rd Floor - Cambridge, MA 02140 USA";
info.pluginContactPhone = "(617) 876 8085";
}

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)