VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GUI Send Interaction (guiSendInteraction)

Table of Contents

The GUI Send Interaction example demonstrates the following:

Accessing the VR-Link DtExerciseConnection

This example demonstrates how to access the VR-Link DtExerciseConnection from the VRF GUI application. This process is somewhat complex due to the fact that the DtExerciseConnection, and related networking classes are run in a seperate thread from the main application to improve performance. This thread is referred to as the "driver" thread, since the network is a driver of the VR-Vantage scene.

In this example, a new menu item is added to the VRF GUI, which triggers a user prompt for some text, and then that text is sent out in a comment interaction from the GUI using the DtExerciseConnection.

The DtExConnInterface class that is part of this example is the class that manages data flow from the main GUI thread (where the menu item is activated) to the driver thread. Actions that are taken on this object are put in a queue, and then processed by the driver thread. The DtGuiExConnAccessory class is a utility class that is used to add new functionallity to the driver in VR-Forces. This is used to set up the instance of the DtExConnInterface, and to set up the driver thread to call the processing queue in order to process the actions.

While this example does not display the contents of the interaction being sent, if you wish to see the contents:

  1. Build the networkCallbackManager example for the protocol you wish to use.
  2. Enable the networkCallbackManager example either by going to the Settings.. dialog and checking the box to enable the networkCallbackManager example or enable this example from the Plugins... button on the launcher the next time you run it. If you check the box on the Settings... page you will need to stop and restart the GUI to load the plugin.

How to Run the Example

Usage

In the Launcher, click the Plug-ins button to bring up the Plug-ins Selection dialog. Enable the plugin.

To view the new behavior:

  1. Start VR-Forces GUI and SIM.
  2. No need to load or create scenario or to load a terain.
  3. Choose 'Simulation -> Send Comment Interaction' menu item.
  4. Enter some text
  5. Press OK
  6. A comment interaction will be sent./LI>
  7. You can use VR-Link's NetDump program to view the network traffic.
  8. If you are using DIS protocol - you can use the WireShark app to observe the comment interaction PDU.

Classes

DtExampleMenuItemThe menu item for sending a comment interaction
DtExConnInterfaceThe thread safe interface for calling the DtExerciseConnection from the main GUI thread.
DtGuiExConnAccessoryThe utility for adding the DtExConnInterface into the connection driver thread.

Plugin Entry Points

/*******************************************************************************
** Copyright (c) 2015 MAK Technologies, Inc.
** All rights reserved.
*******************************************************************************/
//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 <vl/diGuyObjectStateRepository.h>
#include <vrvCore/DtDe.h>
// This is the function called by VRF when this plugin is loaded.
{
// Add the accessory to the accessory manager. This will cause
// the accessory methods to get called when various driver actions occur,
// such as starting a connection, connecting and disconnecting.
// Set up the new menu item in the menu item structure.
makVrv::DtMenuPath::mainMenu("DtSimulationMenu").item("DtExampleMenuItem"),
makVrv::DtMenuPath::mainMenu("DtSimulationMenu").item("DtGlobalPlansMenuItem"));
return true;
}
// Function that is called by VRF to get general information about the plugin.
{
info.pluginName = "guiSendInteraction Example";
info.pluginDescription = "Example showing how to send PDUs using the DtExerciseConn from a GUI plugin.";
info.pluginVersion = "1.00";
info.pluginCreator = "MAK Technologies";
info.pluginCreatorEmail = "sales@mak.com";
info.pluginContactWebPage = "www.mak.com";
info.pluginContactMailingAddress = "10 Fawcett Street, Suite 204, Cambridge, MA 02138 USA";
info.pluginContactPhone = "(617) 876 8085";
}

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)