VR-Engage  2.2
Loading...
Searching...
No Matches
connectorAccessory.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file connectorAccessory.h
7//! \brief Contains the DtConnectorAccessory class that manages VREngage connectivity
8//!
9//! This accessory establishes the connection between VREngage components and VR-Link,
10//! handling installation, connection events, coordinate systems, and event messaging.
11
14
15
16#ifndef DT_PROTOCOL_NAMESPACE
17 #error Namespace Protocol Macro DT_PROTOCOL_NAMESPACE not defined.
18#endif
19
20#pragma once
21
22#include <vrvCore/DtBaseAccessory.h>
23
24#include <list>
25
26namespace makVrv
27{
28class DtVrlinkDriver;
29class DtVrlinkBaseConnection;
30class DtCoordinateSystem;
31
33{
34class DtVrlinkConnection;
35}
36} // namespace makVrv
37
38namespace makVrf
39{
40class DtVrlinkNetworkInterface;
41}
42
43namespace makVre
44{
45//! \brief Forward declaration of the player station application
46class DtPlayerStationApp;
47
48//! \brief Forward declaration of the network forwarder
49class DtExerciseConnNetworkForwarder;
50
51//! \brief Forward declaration of the message factory
52class DtVreMessageFactory;
53
54//! \brief Forward declaration of the communication manager
55class DtVreCommunicationManager;
56
58{
59//! \brief Forward declaration of the simulation event connector
61
62//! \brief Accessory that manages connections between VREngage and VR-Link
63//!
64//! DtConnectorAccessory establishes and manages the connection between VREngage
65//! components and the VR-Link simulation environment. It handles installation of
66//! various connector types, manages connection events, coordinates system changes,
67//! and processes simulation messages.
68//!
69//! This class is protocol-specific, with behavior defined by the DT_PROTOCOL_NAMESPACE macro
70//! which determines whether DIS, HLA 1.3, HLA 1516, or HLA 1516e is being used.
71class VRL_DLL DtConnectorAccessory : public makVrv::DtBaseAccessory
72{
73public:
74 //! \brief Constructor for the connector accessory
75 //! \param de Reference to the distributed environment to use
76 //!
77 //! Initializes member variables and sets up message handlers for connector
78 //! installation and removal
79 DtConnectorAccessory(makVrv::DtDe& de);
80
81 //! \brief Virtual destructor
82 //!
83 //! Disconnects signals, cleans up connections, and removes message handlers
84 virtual ~DtConnectorAccessory() override;
85
86 //! \brief Determines if this accessory is compatible with a given driver
87 //! \param driver Pointer to the driver to check compatibility with
88 //! \return True if compatible, false otherwise
89 //!
90 //! Checks if the driver is of the correct protocol-specific type for this accessory
91 virtual bool isCompatible(makVrv::DtDriver* driver) override;
92
93 //! \brief Installs this accessory into a compatible driver
94 //! \param driver Pointer to the driver to install this accessory into
95 //!
96 //! Connects signals, sets up callbacks, and prepares the accessory for use
97 virtual void install(makVrv::DtDriver* driver) override;
98
99 //! \brief Uninstalls this accessory from a driver
100 //! \param baseConn Pointer to the driver to uninstall from
101 //!
102 //! Removes all connectors, disconnects signals, and cleans up resources
103 virtual void uninstall(makVrv::DtDriver* baseConn) override;
104
105 //! \brief Callback for when a simulation connection is created
106 //! \param connection Pointer to the newly created connection
107 //!
108 //! Sets up the connection, registers extensions, and prepares coordinate systems
109 virtual void slot_onSimCreated(makVrv::DtVrlinkBaseConnection* connection);
110
111 //! \brief Callback for when a simulation connection is established
112 //! \param connection Pointer to the connected connection
113 //!
114 //! Initializes simulation parameters, installs connectors, and sends notification
115 virtual void slot_onSimConnected(makVrv::DtVrlinkBaseConnection* connection);
116
117 //! \brief Callback for when the coordinate system changes
118 //! \param connection Pointer to the connection with the changed coordinate system
119 //!
120 //! Updates the coordinate system for all components
121 virtual void slot_onCoordinateSystemChanged(makVrv::DtVrlinkBaseConnection* connection);
122
123 //! \brief Callback for when a simulation is about to disconnect
124 //! \param connection Pointer to the connection about to disconnect
125 //!
126 //! Cleans up resources and sends notifications before disconnection
127 virtual void slot_onSimAboutToBeDisconnected(makVrv::DtVrlinkBaseConnection* connection);
128
129 //! \brief Callback for periodic thread ticks
130 //!
131 //! Processes time updates and performs periodic tasks
132 virtual void slot_onThreadTick();
133
134 //! \brief Sets the coordinate system for the simulation
135 //! \param vrvCS Reference to the coordinate system to use
136 //!
137 //! Creates and configures the appropriate coordinate converter based on the
138 //! provided coordinate system
139 virtual void setCoordinateSystem(const makVrv::DtCoordinateSystem& vrvCS);
140
141protected:
142 //! \brief Handles messages to install connectors
143 //! \param msg Pointer to the message containing installation parameters
144 //! \return Message result indicating how the message was handled
145 //!
146 //! Processes requests to install specific connectors for an entity
148
149 //! \brief Handles messages to remove connectors
150 //! \param msg Pointer to the message containing removal parameters
151 //! \return Message result indicating how the message was handled
152 //!
153 //! Processes requests to remove specific connectors for an entity
155
156 //! \brief Installs the base set of connectors for the simulation
157 //!
158 //! Creates and installs the standard set of connectors that all simulations need
159 virtual void installBaseConnectors();
160
161 //! \brief Uninstalls all base connectors
162 //!
163 //! Cleans up and removes all base connectors
165
166 //! \brief Clears all entity-specific connectors
167 //!
168 //! Removes all connectors associated with specific entities
169 virtual void clearEntityConnectors();
170
171protected:
172 //! \brief Reference to the distributed environment
173 makVrv::DtDe& myDe;
174
175 //! \brief Pointer to the player station application
177
178 //! \brief Type of connector being used
180
181 //! \brief List of base simulation event connectors
182 //!
183 //! These connectors handle core simulation functionality and are not entity-specific
184 std::list<makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector*> myBaseConnectors;
185
186 //! \brief Map of entity-specific connectors grouped by entity ID and connector name
187 //!
188 //! First key is entity ID, second key is connector name, value is the connector instance
189 std::map<std::string, std::map<std::string, makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector*>> myEntityConnectors;
190
191 //! \brief Pointer to the VR-Link driver
192 makVrv::DtVrlinkDriver* myDriver;
193
194 //! \brief Pointer to the protocol-specific VR-Link connection
195 makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection* myVrlConnection;
196
197 //! \brief Pointer to the message factory for creating VREngage messages
199
200 //! \brief Pointer to the network forwarder for transferring messages
202
203 //! \brief Pointer to the communication manager that handles messages
205
206 //! \brief Pointer to the VR-Link network interface
207 makVrf::DtVrlinkNetworkInterface* myVrlinkNetworkInterface;
208};
209} // namespace DT_PROTOCOL_NAMESPACE
210} // namespace makVre
virtual void slot_onThreadTick()
Callback for periodic thread ticks.
DtVreCommunicationManager * myCommunicationManager
Pointer to the communication manager that handles messages.
Definition connectorAccessory.h:204
virtual void clearEntityConnectors()
Clears all entity-specific connectors.
DtVreMessageFactory * myMessageFactory
Pointer to the message factory for creating VREngage messages.
Definition connectorAccessory.h:198
virtual void slot_onSimConnected(makVrv::DtVrlinkBaseConnection *connection)
Callback for when a simulation connection is established.
makVrf::DtVrlinkNetworkInterface * myVrlinkNetworkInterface
Pointer to the VR-Link network interface.
Definition connectorAccessory.h:207
virtual makVre::DtVreMessageResult handleRemoveConnectors(makVre::DtVreMessage *msg)
Handles messages to remove connectors.
DtExerciseConnNetworkForwarder * myNetworkForwarder
Pointer to the network forwarder for transferring messages.
Definition connectorAccessory.h:201
virtual makVre::DtVreMessageResult handleInstallConnectors(makVre::DtVreMessage *msg)
Handles messages to install connectors.
virtual void slot_onCoordinateSystemChanged(makVrv::DtVrlinkBaseConnection *connection)
Callback for when the coordinate system changes.
virtual void setCoordinateSystem(const makVrv::DtCoordinateSystem &vrvCS)
Sets the coordinate system for the simulation.
virtual void slot_onSimCreated(makVrv::DtVrlinkBaseConnection *connection)
Callback for when a simulation connection is created.
virtual void installBaseConnectors()
Installs the base set of connectors for the simulation.
makVrv::DtVrlinkDriver * myDriver
Pointer to the VR-Link driver.
Definition connectorAccessory.h:192
virtual bool isCompatible(makVrv::DtDriver *driver) override
Determines if this accessory is compatible with a given driver.
makVre::DtPlayerStationApp * myApp
Pointer to the player station application.
Definition connectorAccessory.h:176
virtual void install(makVrv::DtDriver *driver) override
Installs this accessory into a compatible driver.
std::map< std::string, std::map< std::string, makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector * > > myEntityConnectors
Map of entity-specific connectors grouped by entity ID and connector name.
Definition connectorAccessory.h:189
makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection * myVrlConnection
Pointer to the protocol-specific VR-Link connection.
Definition connectorAccessory.h:195
makVrv::DtDe & myDe
Reference to the distributed environment.
Definition connectorAccessory.h:173
makVre::DtConnector::DtConnectorType myType
Type of connector being used.
Definition connectorAccessory.h:179
virtual void slot_onSimAboutToBeDisconnected(makVrv::DtVrlinkBaseConnection *connection)
Callback for when a simulation is about to disconnect.
virtual void uninstallBaseConnectors()
Uninstalls all base connectors.
virtual void uninstall(makVrv::DtDriver *baseConn) override
Uninstalls this accessory from a driver.
std::list< makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector * > myBaseConnectors
List of base simulation event connectors.
Definition connectorAccessory.h:184
virtual ~DtConnectorAccessory() override
Virtual destructor.
DtConnectorAccessory(makVrv::DtDe &de)
Constructor for the connector accessory.
Base class for all simulation event connectors in VREngage.
Definition simEventConnector.h:54
DtConnectorType
Enumeration of supported connector types.
Definition connector.h:36
Network forwarder that uses an exercise connection to send and receive VREngage messages.
Definition exerciseConnNetForwarder.h:48
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
This class manages communication between player stations and VR-Link connections.
Definition vreCommunicationManager.h:38
Factory for creating VREngage messages from serialized data.
Definition vreMessageFactory.h:48
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Defines export macros and protocol namespace for vrePlayerStationConnector.
#define VRL_DLL
Empty definition for non-Windows platforms.
Definition export.h:52
Definition connectorAccessory.h:58
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition connectorAccessory.h:39
Definition connectorAccessory.h:33
Definition appLauncherComponent.h:28
makVrv::DtDe * de()
Gets the display element pointer used by the plugin.
Defines the base DtSimEventConnector class for VREngage simulation events.