24#include <vlpi/simulationAddress.h>
26#include <boost/signals2/connection.hpp>
36class DtExerciseConnInitializer;
49class DtVrlinkVrfRemoteController;
85 makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection* connection,
86 makVrf::DtVrlinkVrfRemoteController* vrfRemoteController);
94 virtual void tick(
double dt)
override;
181 static bool backendRemapper(DtBackendMap* map,
const std::set<DtSimulationAddress>& expectedBackends,
void* usr);
250 virtual bool remapBackends(DtBackendMap* map,
const std::set<DtSimulationAddress>& expectedBackends);
260 const std::set<std::string>& sessionSmsList,
261 const DtFilename& terrain,
262 const DtFilename& guiTerrain);
284 const std::vector<std::string>& pluginBaseNames,
286 std::string& additionalArguments);
299 const std::vector<std::string>& pluginBaseNames,
300 std::string& additionalArguments);
311 virtual std::string
connectionParameters(
const DtSimulationAddress& address, std::string& additionalArguments)
const;
Provides handle classes for safe access to attributes.
Base class for all simulation event connectors in VREngage.
Definition simEventConnector.h:53
Type-specific handle class for attributes.
Definition attributeHandle.h:229
DtAttributeHandleType< std::set< std::string > > mySessionSmsListAttr
Current set of simulation model set filenames for this session.
Definition vreBackendConnector.h:401
static bool backendRemapper(DtBackendMap *map, const std::set< DtSimulationAddress > &expectedBackends, void *usr)
Static callback for remapping backend addresses during scenario load.
virtual void processBackendDiscovered(const DtSimulationAddress &addr)
Processes a backend discovery notification.
std::string vrfSimEngineCommand(const DtSimulationAddress &address, int sessionId, int simType, const std::vector< std::string > &pluginBaseNames, std::string &additionalArguments)
Builds the full command-line string for the sim engine process.
boost::signals2::scoped_connection myChatEventConnection
Connection for chat event forwarding callback.
Definition vreBackendConnector.h:329
virtual void updateBackendStatus()
Evaluates the current backend status and broadcasts changes to the frontend.
virtual std::string connectionParameters(const DtSimulationAddress &address, std::string &additionalArguments) const
Builds protocol-specific connection parameters for the sim engine command line.
virtual DtVreMessageResult handleSetBackendConfig(DtVreMessage *message)
Backend lifecycle message handlers.
virtual void processLoadCompleteMessage(DtSimMessage *msg)
Processes a load-complete message from the VRE backend.
virtual ~DtVreBackendConnector() override
Virtual destructor.
virtual void tick(double dt) override
Performs periodic backend status evaluation.
static void BackendDiscovered(const DtSimulationAddress &addr, void *usr)
Static callbacks for VRF backend events.
virtual std::string application() const
Returns the sim engine executable name (protocol- and build-variant-aware)
DtVreBackendConnector()
Default constructor. Initializes all state to default values.
virtual std::string protocol() const
Returns the protocol name string used in command-line arguments.
virtual void install(makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection *connection, makVrf::DtVrlinkVrfRemoteController *vrfRemoteController)
Installs the backend connector with shared infrastructure.
virtual void shutdown() override
Shuts down the connector.
virtual DtVreMessageResult handleRequestBackendStatus(DtVreMessage *message)
Handles a request for the current backend status.
DtAttributeHandleType< BackendStatusMessage::BackendStatusData > myBackendStatusAttr
Published backend status data.
Definition vreBackendConnector.h:409
std::string myArguments
Additional command-line arguments for the backend process.
Definition vreBackendConnector.h:352
std::set< DtSimulationAddress > mySimulationAddresses
Set of all discovered backend simulation addresses.
Definition vreBackendConnector.h:393
virtual void processBackendRemoved(const DtSimulationAddress &addr)
Processes a backend removal notification.
virtual void * launchVrfBackend(const DtSimulationAddress &address, int sessionId, int simType, const std::vector< std::string > &pluginBaseNames, bool showConsole, std::string &additionalArguments)
Launches a VR-Forces backend process with the specified parameters.
virtual DtVreMessageResult handleWindRequest(DtVreMessage *message)
Handles wind state request messages.
virtual bool remapBackends(DtBackendMap *map, const std::set< DtSimulationAddress > &expectedBackends)
Remaps all backend addresses in a scenario to the current VRE backend address.
virtual void sendBackendStatusMessage()
Sends the current cached backend status to the frontend.
std::chrono::steady_clock::time_point myBackendLaunchTime
Time point at which the backend process was launched.
Definition vreBackendConnector.h:381
const DtExerciseConnInitializer * myExerciseConnInitializer
Launch configuration.
Definition vreBackendConnector.h:340
DtSimulationAddress myBackendStartingAddress
Backend state.
Definition vreBackendConnector.h:368
int myStartupTimeoutSeconds
Startup timeout in seconds for detecting backends that fail to connect.
Definition vreBackendConnector.h:388
void clearBackendState()
Clears all backend-owned state atomically.
DtSimulationAddress backendAddress() const
Returns the current VRE backend simulation address.
makVrf::DtVrlinkVrfRemoteController * myVrfRemoteController
Infrastructure pointers (NON-OWNING — owned by DtConnectorAccessory)
Definition vreBackendConnector.h:326
std::vector< std::string > myPlugins
List of plugin base names to load in the backend process.
Definition vreBackendConnector.h:346
bool myTookSnapshot
True if a TakeBaseSnapshot save was issued after the scenario loaded.
Definition vreBackendConnector.h:371
DtAttributeHandleType< bool > mySessionPlayStateAttr
True if the session is currently playing (not paused)
Definition vreBackendConnector.h:397
virtual DtVreMessageResult handleChatEvent(DtVreMessage *message)
Chat and environmental message handlers.
void * myBackendProcessHandle
Handle to the launched backend process (Windows only; nullptr on other platforms)
Definition vreBackendConnector.h:213
virtual void sendTerrainScenario(DtScenario &scenario, const LoadBackendMessage *loadMsg, const std::set< std::string > &sessionSmsList, const DtFilename &terrain, const DtFilename &guiTerrain)
Configures a scenario with terrain, SMS, and component attachment settings, then sends it to the back...
bool hasBackendAddress() const
Returns true if this connector has a pending or active VRE backend address.
virtual void processChatEvent(const makVrfEvents::DtEvent &evt)
Processes a chat event received from the VRF event manager.
virtual void sendSessionSmsUpdate()
void setStartupTimeoutSeconds(int seconds)
Sets the startup timeout used to detect backends that fail to connect.
virtual DtVreMessageResult handleStopBackend(DtVreMessage *message)
Handles a request to stop the VRE backend process.
double mySnapshotSimTime
Simulation time at which the base snapshot was taken.
Definition vreBackendConnector.h:374
virtual DtVreMessageResult handleLoadBackend(DtVreMessage *message)
Handles a request to load a scenario on the VRE backend.
DtAttributeHandleType< bool > myBackendIsHostAttr
Indicates whether this station is the backend host; true if started in full-forces (host) mode.
Definition vreBackendConnector.h:405
static void BackendRemoved(const DtSimulationAddress &addr, void *usr)
Static callback invoked when a backend simulation address is removed.
DtAttributeHandleType< VrfSessionStatusMessage::VrfSessionStatusData > mySessionStatusAttr
Current cached session status data.
Definition vreBackendConnector.h:413
virtual DtVreMessageResult handleStartBackend(DtVreMessage *message)
Handles a request to launch the VRE backend process.
bool myShowConsole
Whether to open a console window for the backend process.
Definition vreBackendConnector.h:349
static void ifLoadCompleteMessageCallback(DtSimMessage *msg, void *usr)
Static callback invoked when a VRE backend reports scenario load complete.
int mySessionId
VR-Engage session ID passed to the backend process on launch.
Definition vreBackendConnector.h:343
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Send to create a new scenario or load an existing scenario on this Vr-Engage's sim engine.
Definition loadBackend.h:33
Defines export macros and protocol namespace for vrePlayerStationConnector.
#define VRL_DLL
Empty definition for non-Windows platforms.
Definition export.h:52
!
Definition glsVreMessageUtil.h:50
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Definition vreBackendConnector.h:43
Definition connectorAccessory.h:38
Defines the base DtSimEventConnector class for VREngage simulation events.