![]() |
VR-Forces 5.0.1 Developer's Guide
|
The network component runs in its own thread in parallel to the visualization thread.
The network piece is responsible for taking protocol specific information and using classes wrapped around that information to present a general interface such that the creation of the visuals and data does not need to know which protocol is providing the information. Two that, the network is broken up into two pieces: The protocol specific piece and the protocol independent piece. The protocol independent piece is built on top of the protocol specific piece. The gui has plugins that are loaded depending on the protocol the user has selected in order to determine which kind of exercise connection to make to get the data from the protocol specific to protocol independent part.
Each protocol has a plugin that can be loaded to implement the interface between that protocol and the protocol independent portion of the code. The protocol interface subclasses from a class called makVrf::VRF_PROTOCOL_NAMESPACE::DtVrfDriver. The driver class is installed as part of the plugin initialization and is tied to the driver that is being created as part of the command line argument (for example, –dis will create a driver of type DtDisDriver)
It should not be necessary for you to ever override the main driver. All additional functionality can be added on accesory plugins. See Adding Protocol Functionality
The makVrf::VRF_PROTOCOL_NAMESPACE::DtVrfDriver class is responsible for creating:
The classes that are typically subclassed and replaced are the DtVrlinkVrfRemoteController class to implement (or change) a particular piece of code that will communicate with the back end, the maka reflected list to read additional information from the network that is not part of the standard protocol, or a sim data processor that will take that information read from the network and put it into structures to allow the visualization piece to have access to this data.
The VR-Link Netwok Iterface library contains network interfaces to read from the netwwork (Remote Interface) or write to the network (Local Interface) using the makVrf::DtStateData and makVrf::DtStateDataComponent in order to transfer the data from/to the network. This library is shared by the front-end and the back-end. The makVrf::DtSimObjectNetInterfaceFactory contains entries for creating interfaces based on keys in the .ope file:
The DtSimObjectNetInterfaceFactory class has a method addCreatorFcn that allows you to add network interfaces by their keyword. The vrfNetInterfaceTypes.h contains a list of all the current keywords.
See Subclassing Network Interfaces for how to install your own version of a network interface
This class will hold creators for the main global instances of functionality contains in the DtVrfDriver:
To replace any of the classes contained in the factory, you would need to create a static creator method that would create a subclass of the intended class, and the subclass of that class. The Network Callback Manager example shows how this can be done
When this example is run you will see that anytime a user loads a scenario, a message will be printed to the console with the scenario they are loading.
Generally, when thinking about sending extended data over the network, using VR-Forces State Properties is the best and easiest way to do this. State Properties are sent in a VR-Forces PDU that knowns how to serialize/desieralize DtReaderWriter content. The Add State Property GUI example shows how to reference newly addded state property data from the back-end (Add State Property Sim) and reference in the front-end via the makVrf::DtVrfObjectDataState state view data (stateviews).
For those times, however, where you need to publish to or read data from an external simulation, then, overriding the network interface and supplying encoders/decoders and FOM files is the appropriate way to do this. The Add State Component GUI example shows how to add a state component and receive published information over the network. This information is currently published by the back-end in the Add State Component Sim example. See stateComponentAddition for how to add your own state components
The example adds a new remote entity net interface to read the new reflected state repository that contains the temperature:
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:
In order to send data from the network side to visualization side of the front-end you must use agents (see Agent Connectivity). The first agent created will be the DtTemperatureStateObject agent. This agent will be used to serialize DtTemperatureStateData from the network thread to be processed in the visualization thread:
Once the state data and agent are created, the state data processor can be created and added to the network. The state data processor uses the agent to send through a state data that is set from the network side with network data and received on the gui side.
Once the state processor is set up, the setState method will be called when the state has changed or wants to be updated into the visualization thread.
The state is then set into the agent for processing in the visualization thread.
5.3 - Adding Functionality to a Driver (Accessories) There are a few important methods to call out, as, implementing these methods and connecting to signals sent by the driver will allow for the proper use of the accessory in a VR-Forces front-end. The first method to overrride is the install method. This will allow the connection to three important signals sent from the driver:
There are times when a user wants to filter visuals and items from the object list that meet certain criteria. This is called Fog Of War filtering. The selection filters are described in Selection Filters Selection Filters, and, the visuals are filtered out using the makVrf::VRF_PROTOCOL_NAMESPACE::DtVrfFogOfWarHandler. This handler will determine whether or not the filters set into the makVrf::DtVrfSpotReportManager via the addFogOfWarFilter pass the filter test for each object in the system and then hide the visuals if it does pass the test. The fog of war filters are also execture in the makVrf::DtVrfFilteredListView and makVrf::DtVrfHierarchyPageLogic classes. The Object Filtering example shows an example of how to add a new filter to the makVrf::DtVrfSpotReportManager to hide visuals based on certain criteria.