VR-Engage  2.2
Loading...
Searching...
No Matches
vrfLaunchConnector.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4******************************************************************************/
5
6//! \file vrfLaunchConnector.h
7//! \brief Defines the DtVrfLaunchConnector class for launching VR-Forces backends
8//!
9//! This connector provides functionality to configure and launch VR-Forces simulation
10//! backends with various options for protocols, plugins, and runtime parameters.
11
12#pragma once
13
14#include "export.h"
15
18
19#include <vl/exerciseConnInitializer.h>
20
21//! \brief Forward declaration of the exercise connection class
22class DtExerciseConn;
23
24//! \brief Forward declaration of the simulation address class
25class DtSimulationAddress;
26
27namespace makVre
28{
29//! \brief Connector for launching and configuring VR-Forces backends
30//!
31//! DtVrfLaunchConnector handles the configuration and launching of VR-Forces
32//! simulation backends. It generates command lines with appropriate parameters
33//! based on connection settings, protocol-specific options, and user-specified
34//! arguments, then launches the backend process.
36{
37public:
38 //! \brief Default constructor
40
41 //! \brief Virtual destructor
42 virtual ~DtVrfLaunchConnector() override;
43
44 //! \brief Generates a command line for launching the simulation engine
45 //! \param address The site/app ID to use
46 //! \param sessionId VR-Engage's session ID
47 //! \param simType Integer representing the type of simulation use
48 //! (full VR-Forces sim engine, ownship-only sim engine, or limited backend)
49 //! \param pluginBaseNames List of plugin names specified in appData\scripts\playerStation.lua
50 //! \param additionalArguments Value of additionalBackendCommandLineParameters
51 //! defined in playerStation.lua (modified by this function)
52 //! \return The full simulation engine launch command string
53 //!
54 //! Builds a complete command line for launching a VR-Forces backend with
55 //! appropriate connection parameters, plugins, and user-specified arguments.
56 //! Some connection parameters in additionalArguments may be removed and replaced.
57 std::string vrfSimEngineCommand(const DtSimulationAddress& address, int sessionId, int simType,
58 const std::vector<std::string>& pluginBaseNames, std::string& additionalArguments);
59
60 //! \brief Installs the VR-Forces launch connector with the application and connection
61 //! \param app Pointer to the player station application
62 //! \param connection Pointer to the protocol-specific VR-Link connection
63 //! \param exerciseConnInitializer Pointer to the exercise connection initializer
64 //!
65 //! Initializes the connector with the provided connection information and
66 //! registers message handlers for backend configuration and launch requests
67 virtual void install(DtPlayerStationApp* app, makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection* connection,
68 const DtExerciseConnInitializer* exerciseConnInitializer);
69
70 //! \brief Performs periodic processing (currently empty implementation)
71 virtual void tick() override;
72
73 //! \brief Shuts down the VR-Forces launch connector
74 virtual void shutdown() override;
75
76protected:
77 //! \brief Handles messages to set backend configuration
78 //! \param msg Pointer to the backend configuration message
79 //! \return Message result indicating how the message was handled
80 //!
81 //! Processes configuration messages to set session ID, plugins, RTDynamics,
82 //! console visibility, and command line arguments
84
85 //! \brief Handles messages to launch a simulation process
86 //! \param msg Pointer to the launch simulation message
87 //! \return Message result indicating how the message was handled
88 //!
89 //! Processes launch requests by calling launchVrfBackend with the
90 //! current configuration settings
92
93 //! \brief Launches a simulation engine with specified parameters
94 //! \param address The site/app ID to use
95 //! \param sessionId VR-Engage's session ID
96 //! \param simType Integer representing the type of simulation to use
97 //! \param pluginBaseNames List of plugin names to include
98 //! \param showConsole Flag indicating whether to show the console window
99 //! \param additionalArguments Additional command line arguments
100 //!
101 //! Launches a VR-Forces backend process with the specified configuration.
102 //! See vrfSimEngineCommand for details on command line generation.
103 virtual void launchVrfBackend(const DtSimulationAddress& address, int sessionId, int simType,
104 const std::vector<std::string>& pluginBaseNames, bool showConsole,
105 std::string& additionalArguments);
106
107 //! \brief Gets the application executable path
108 //! \return String containing the path to the application executable
109 //!
110 //! Provides the protocol-specific path to the VR-Forces application executable
111 virtual std::string application() const;
112
113 //! \brief Generates connection-specific settings string
114 //! \param address The site/app ID to use
115 //! \param additionalArguments User-defined arguments from playerStation.lua
116 //! \return String containing all relevant connection parameters
117 //!
118 //! Creates a string with protocol-specific connection parameters for
119 //! the VR-Forces backend, merging with user-specified additional arguments
120 virtual std::string connectionParameters(const DtSimulationAddress& address, std::string& additionalArguments) const;
121
122 //! \brief Gets the protocol name
123 //! \return String containing the protocol name (DIS, HLA 1.3, HLA 1516, or HLA 1516e)
124 //!
125 //! Returns the protocol-specific name used in command line parameters
126 virtual std::string protocol() const;
127
128protected:
129 //! \brief Pointer to the exercise connection initializer
130 //!
131 //! Contains connection settings like federation name, exercise ID, etc.
132 const DtExerciseConnInitializer* myExerciseConnInitializer;
133
134 //! \brief Session ID for the backend
135 //!
136 //! Used to uniquely identify this session in the simulation
138
139 //! \brief List of plugin base names to load
140 std::vector<std::string> myPlugins;
141
142 //! \brief Flag indicating whether to show the console window
144
145 //! \brief Additional command line arguments
146 std::string myArguments;
147};
148} // namespace makVre
Base class for all simulation event connectors in VREngage.
Definition simEventConnector.h:54
Top-level class representing the VR-Engage application.
Definition playerStationApp.h:163
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
virtual void shutdown() override
Shuts down the VR-Forces launch connector.
virtual void tick() override
Performs periodic processing (currently empty implementation)
virtual std::string protocol() const
Gets the protocol name.
const DtExerciseConnInitializer * myExerciseConnInitializer
Pointer to the exercise connection initializer.
Definition vrfLaunchConnector.h:132
bool myShowConsole
Flag indicating whether to show the console window.
Definition vrfLaunchConnector.h:143
std::string myArguments
Additional command line arguments.
Definition vrfLaunchConnector.h:146
DtVrfLaunchConnector()
Default constructor.
virtual makVre::DtVreMessageResult handleLaunchSimProcess(makVre::DtVreMessage *msg)
Handles messages to launch a simulation process.
virtual makVre::DtVreMessageResult handleSetBackendConfig(makVre::DtVreMessage *msg)
Handles messages to set backend configuration.
std::vector< std::string > myPlugins
List of plugin base names to load.
Definition vrfLaunchConnector.h:140
std::string vrfSimEngineCommand(const DtSimulationAddress &address, int sessionId, int simType, const std::vector< std::string > &pluginBaseNames, std::string &additionalArguments)
Generates a command line for launching the simulation engine.
virtual void install(DtPlayerStationApp *app, makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection *connection, const DtExerciseConnInitializer *exerciseConnInitializer)
Installs the VR-Forces launch connector with the application and connection.
virtual void launchVrfBackend(const DtSimulationAddress &address, int sessionId, int simType, const std::vector< std::string > &pluginBaseNames, bool showConsole, std::string &additionalArguments)
Launches a simulation engine with specified parameters.
virtual ~DtVrfLaunchConnector() override
Virtual destructor.
virtual std::string application() const
Gets the application executable path.
int mySessionId
Session ID for the backend.
Definition vrfLaunchConnector.h:137
virtual std::string connectionParameters(const DtSimulationAddress &address, std::string &additionalArguments) const
Generates connection-specific settings string.
Defines export macros and protocol namespace for vrePlayerStationConnector.
#define VRL_DLL
Empty definition for non-Windows platforms.
Definition export.h:52
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the base DtSimEventConnector class for VREngage simulation events.
Defines the base class for all VREngage messages.