VR-Engage  2.3
Loading...
Searching...
No Matches
makVre::DtSessionStatusConnector Class Reference

Detailed Description

DtSessionStatusConnector manages VRF session status queries, simulation model set (SMS) lists, session play state, simulation control commands (run/pause/rewind), station identity publication to the VRF backend, and role assignment messages received from the VRF backend.

This connector receives shared infrastructure from DtConnectorAccessory via install() and does not own any infrastructure components. It communicates with the VRF backend through the shared DtVrlinkVrfRemoteController and its associated VRF message interface.

#include <sessionStatusConnector.h>

Inheritance diagram for makVre::DtSessionStatusConnector:
[legend]

Public Member Functions

 DtSessionStatusConnector ()=default
 
virtual ~DtSessionStatusConnector () override=default
 
virtual void install (makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection *connection, makVrf::DtVrlinkVrfRemoteController *vrfRemoteController)
 
virtual void tick (double dt) override
 
virtual void shutdown () override
 
virtual void sendLocalStatusHeartbeat ()
 
virtual DtVreMessageResult handleVrfSessionStatusRequest (DtVreMessage *message)
 
virtual DtVreMessageResult handleSessionSmsListRequest (DtVreMessage *message)
 
virtual DtVreMessageResult handleSessionPlayStateRequest (DtVreMessage *message)
 
virtual DtVreMessageResult handlePendingRoleAssignment (DtVreMessage *message)
 
virtual DtVreMessageResult handleSetDefaultSmsList (DtVreMessage *message)
 
virtual DtVreMessageResult handleVrfRun (DtVreMessage *message)
 
virtual DtVreMessageResult handleVrfPause (DtVreMessage *message)
 
virtual DtVreMessageResult handleVrfRewind (DtVreMessage *message)
 
- Public Member Functions inherited from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector
 DtSimEventConnector ()
 
virtual ~DtSimEventConnector () override
 
virtual void install (makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection *connection)
 
- Public Member Functions inherited from makVre::DtConnector
 DtConnector ()
 
virtual ~DtConnector ()
 
virtual DtConnectorType type ()
 
virtual std::string name ()
 

Static Public Member Functions

static void vreStatusMessageCallback (DtSimMessage *msg, void *usr)
 
static void assignRolePlayerMessageCallback (DtSimMessage *msg, void *usr)
 
static void unassignRolePlayerMessageCallback (DtSimMessage *msg, void *usr)
 
static void backendRemovedCallback (const DtSimulationAddress &addr, void *usr)
 
- Static Public Member Functions inherited from makVre::DtConnector
static std::string extension (DtConnectorType type)
 

Protected Member Functions

virtual void processVreStatusMessage (DtSimMessage *msg)
 
virtual void processAssignRolePlayerMessage (DtSimMessage *msg)
 
virtual void processUnassignRolePlayerMessage (DtSimMessage *msg)
 
virtual void processBackendRemoved (const DtSimulationAddress &addr)
 
virtual void updateSessionStatus ()
 
void clearPendingRoleAssignment ()
 
void cachePendingRoleAssignment (const VreAssignRolePlayerMessage::VreAssignRolePlayerData &assignmentData)
 
virtual void sendSessionStatusMessage ()
 
virtual void sendSessionPlayState ()
 
virtual void sendSessionSmsUpdate ()
 

Protected Attributes

makVrf::DtVrlinkVrfRemoteController * myVrfRemoteController = nullptr
 
- Protected Attributes inherited from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector
makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection * myConnection
 
- Protected Attributes inherited from makVre::DtConnector
std::string myName
 
DtConnectorType myType
 
DtAttributeCallbackManager myAttributeCallbacks
 
DtVreMessageHandlerGroup myMessageHandlers
 
std::string myStationId
 
DtAttributeHandleType< DtSimulationAddress > myVreBackendAddrAttr
 
DtAttributeHandleType< VrfSessionStatusMessage::VrfSessionStatusData > mySessionStatusAttr
 
DtAttributeHandleType< bool > mySessionPlayStateAttr
 
DtAttributeHandleType< bool > myReengageOnRewindAttr
 
DtAttributeHandleType< std::set< std::string > > mySessionSmsListAttr
 
DtAttributeHandleType< bool > myBackendIsHostAttr
 
DtAttributeHandle myVreStatusLocalAttr
 
DtAttributeHandle myBackendsListAttr
 
DtAttributeHandleType< std::vector< std::string > > myVreStatusStationsAttr
 
bool myHasPendingRoleAssignment = false
 
VreAssignRolePlayerMessage::VreAssignRolePlayerData myPendingRoleAssignment
 
double myLastHeartbeatTime
 
static constexpr double theHeartbeatIntervalS = 1.f
 

Additional Inherited Members

- Public Types inherited from makVre::DtConnector
enum  DtConnectorType {
  DIS , HLA13 , HLA1516 , HLA1516E ,
  HLA4
}
 

Constructor & Destructor Documentation

◆ DtSessionStatusConnector()

makVre::DtSessionStatusConnector::DtSessionStatusConnector ( )
default

Default constructor.

Computes a stable unique station identifier (myId) from the station name (or hostname) and process ID, matching the identity used in VRE status messages sent to the VRF backend.

◆ ~DtSessionStatusConnector()

virtual makVre::DtSessionStatusConnector::~DtSessionStatusConnector ( )
overridevirtualdefault

Virtual destructor.

Member Function Documentation

◆ install()

virtual void makVre::DtSessionStatusConnector::install ( makVrv::DT_PROTOCOL_NAMESPACE::DtVrlinkConnection * connection,
makVrf::DtVrlinkVrfRemoteController * vrfRemoteController )
virtual

Installs the session status connector with shared infrastructure.

Parameters
connectionNon-owning pointer to the protocol-specific VR-Link connection.
vrfRemoteControllerNon-owning pointer to the shared VRF remote controller owned by DtConnectorAccessory.

Stores the non-owning infrastructure pointer and registers:

  • VRE message handlers for session status, SMS list, play state, and simulation control
  • VRF message factory creators for VRE status, role assignment, and role unassignment types
  • VRF message callbacks for the same types (inbound from the VRF backend)

Also binds handles from the global App attribute tree and locks write-protected handles (mySessionStatusAttr, mySessionPlayStateAttr) to prevent unintended writes from other connectors. These handles are read-only for this connector.

◆ tick()

virtual void makVre::DtSessionStatusConnector::tick ( double dt)
overridevirtual

Performs periodic session status evaluation.

Calls updateSessionStatus() each tick to detect backend/session changes and broadcast updates to the frontend.

Parameters
dtThe elapsed time in seconds since the last tick

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ shutdown()

virtual void makVre::DtSessionStatusConnector::shutdown ( )
overridevirtual

Shuts down the connector.

Sends a final DtIfVreStatus message (setFinalStatusMessage = true) to inform the VRF backend that this station is disconnecting, then unregisters all VRE message handlers and VRF message callbacks.

Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.

◆ handleVrfSessionStatusRequest()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handleVrfSessionStatusRequest ( DtVreMessage * message)
virtual

Session status and SMS list message handlers.

Handles a request for the current VRF session status

Parameters
messagePointer to the session status request message
Returns
HANDLED

Calls sendSessionStatusMessage() to send the current cached session status to the frontend immediately.

◆ handleSessionSmsListRequest()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handleSessionSmsListRequest ( DtVreMessage * message)
virtual

Handles a request for the current simulation model set (SMS) list.

Parameters
messagePointer to the SMS list request message
Returns
HANDLED

Calls sendSessionSmsUpdate() to send the current SMS list to the frontend.

◆ handleSessionPlayStateRequest()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handleSessionPlayStateRequest ( DtVreMessage * message)
virtual

Handles a request for the current session play state.

Parameters
messagePointer to the play state request message
Returns
HANDLED

Calls sendSessionPlayState() to send the current playing/paused state to the frontend.

◆ handlePendingRoleAssignment()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handlePendingRoleAssignment ( DtVreMessage * message)
virtual

Handles a request or response for the cached role assignment.

Parameters
messagePointer to the pending-role-assignment message.
Returns
HANDLED

◆ handleSetDefaultSmsList()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handleSetDefaultSmsList ( DtVreMessage * message)
virtual

Handles a request to set the default simulation model set (SMS) list.

Parameters
messagePointer to the set default SMS list message
Returns
HANDLED

Updates the cached SMS list and propagates changes to the VRF communication manager. If the list is unchanged, sends an SmsLoadCompleteMessage with changed = false. If changed, calls sendSessionSmsUpdate().

◆ handleVrfRun()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handleVrfRun ( DtVreMessage * message)
virtual

Simulation control message handlers.

Handles a request to start or resume the simulation

Parameters
messagePointer to the VRF run message
Returns
HANDLED

◆ handleVrfPause()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handleVrfPause ( DtVreMessage * message)
virtual

Handles a request to pause the simulation.

Parameters
messagePointer to the VRF pause message
Returns
HANDLED

◆ handleVrfRewind()

virtual DtVreMessageResult makVre::DtSessionStatusConnector::handleVrfRewind ( DtVreMessage * message)
virtual

Handles a request to rewind the simulation initiated by this station.

Parameters
messagePointer to the VRF rewind message
Returns
HANDLED

Pauses the simulation then rewinds it. Snapshot-based rollback is a Phase 3 feature (DtVreBackendConnector) and is not yet supported here.

◆ sendLocalStatusHeartbeat()

virtual void makVre::DtSessionStatusConnector::sendLocalStatusHeartbeat ( )
virtual

Builds and sends a VRE status heartbeat from the local attribute subtree.

Reads the vreStatus.local subtree in the global App attribute tree and delivers a DtIfVreStatus message to the VRF backend at a fixed heartbeat interval.

◆ vreStatusMessageCallback()

static void makVre::DtSessionStatusConnector::vreStatusMessageCallback ( DtSimMessage * msg,
void * usr )
static

Static callbacks for VRF backend messages.

Static callback for inbound VRE status messages (VRF backend → frontend)

Parameters
msgPointer to the simulation message
usrPointer to the connector instance

◆ assignRolePlayerMessageCallback()

static void makVre::DtSessionStatusConnector::assignRolePlayerMessageCallback ( DtSimMessage * msg,
void * usr )
static

Static callback for role assignment messages from the VRF backend.

Parameters
msgPointer to the simulation message
usrPointer to the connector instance

◆ unassignRolePlayerMessageCallback()

static void makVre::DtSessionStatusConnector::unassignRolePlayerMessageCallback ( DtSimMessage * msg,
void * usr )
static

Static callback for role unassignment messages from the VRF backend.

Parameters
msgPointer to the simulation message
usrPointer to the connector instance

◆ backendRemovedCallback()

static void makVre::DtSessionStatusConnector::backendRemovedCallback ( const DtSimulationAddress & addr,
void * usr )
static

Static callback invoked when a backend simulation address is removed.

Parameters
addrSimulation address of the removed backend
usrPointer to the connector instance

◆ processVreStatusMessage()

virtual void makVre::DtSessionStatusConnector::processVreStatusMessage ( DtSimMessage * msg)
protectedvirtual

Instance methods for processing inbound VRF callbacks.

Processes inbound VRE status messages received from the VRF backend

Parameters
msgPointer to the simulation message

Filters out this station's own identity and forwards all other stations' status to the frontend as VreStatusMessage objects.

◆ processAssignRolePlayerMessage()

virtual void makVre::DtSessionStatusConnector::processAssignRolePlayerMessage ( DtSimMessage * msg)
protectedvirtual

Processes role assignment messages received from the VRF backend.

Parameters
msgPointer to the simulation message

Forwards VreAssignRolePlayerMessage to the frontend if the message is addressed to this station's identity. Policy-blocked rewind assignments are forwarded for frontend cleanup but are not cached for subsequent replay.

◆ processUnassignRolePlayerMessage()

virtual void makVre::DtSessionStatusConnector::processUnassignRolePlayerMessage ( DtSimMessage * msg)
protectedvirtual

Processes role unassignment messages received from the VRF backend.

Parameters
msgPointer to the simulation message

Forwards VreUnassignRolePlayerMessage to the frontend if the message is addressed to this station's identity.

◆ processBackendRemoved()

virtual void makVre::DtSessionStatusConnector::processBackendRemoved ( const DtSimulationAddress & addr)
protectedvirtual

Processes a backend removal notification for this connector.

Removes the attribute entry for the departing backend address from the backends attribute subtree.

Parameters
addrSimulation address of the removed backend

◆ updateSessionStatus()

virtual void makVre::DtSessionStatusConnector::updateSessionStatus ( )
protectedvirtual

Internal status evaluation and broadcast methods.

Evaluates current session status from connected backends and broadcasts changes

Iterates the backend list from the VRF remote controller, extracts scenario and terrain names, SMS sets, and control state. Publishes session status, play state, and SMS list updates to the frontend when changes are detected.

Note
mySessionStatusAttr.myWeAreHost is always false in Phase 2. The backend-is-host flag is managed by DtVreBackendConnector (Phase 3).

◆ clearPendingRoleAssignment()

void makVre::DtSessionStatusConnector::clearPendingRoleAssignment ( )
protected

Clears any cached role assignment awaiting acknowledgement.

◆ cachePendingRoleAssignment()

void makVre::DtSessionStatusConnector::cachePendingRoleAssignment ( const VreAssignRolePlayerMessage::VreAssignRolePlayerData & assignmentData)
protected

Caches the latest role assignment until it is acknowledged.

A checkpoint restore can replay an assignment before all VRF simulations report the restored session. The cache must therefore outlive session status changes. A matching acceptance or decline, unassignment, or a local rewind request clears it. Policy-blocked rewind assignments are not cached.

◆ sendSessionStatusMessage()

virtual void makVre::DtSessionStatusConnector::sendSessionStatusMessage ( )
protectedvirtual

Sends the current session status to the frontend.

Creates and queues a VrfSessionStatusMessage from the cached mySessionStatusAttr data.

◆ sendSessionPlayState()

virtual void makVre::DtSessionStatusConnector::sendSessionPlayState ( )
protectedvirtual

Sends the current session play state to the frontend.

Creates and queues a SessionPlayStateMessage indicating whether the simulation is currently running or paused.

◆ sendSessionSmsUpdate()

virtual void makVre::DtSessionStatusConnector::sendSessionSmsUpdate ( )
protectedvirtual

Sends the current SMS list to the frontend and updates the communication manager.

Queues a SessionSmsListMessage with the current SMS filenames and calls setSimulationModelSets() on the VRE communication manager. Also queues an SmsLoadCompleteMessage for the communication manager component.

Member Data Documentation

◆ myVrfRemoteController

makVrf::DtVrlinkVrfRemoteController* makVre::DtSessionStatusConnector::myVrfRemoteController = nullptr
protected

Infrastructure pointer (NON-OWNING - owned by DtConnectorAccessory)

Shared VRF remote controller (NON-OWNING)

Provides access to the VRF message interface, backend listener, and remote control APIs. Lifetime managed by DtConnectorAccessory, guaranteed to outlive this connector.

◆ myStationId

std::string makVre::DtSessionStatusConnector::myStationId
protected

Connector state.

Unique identifier for this station

Computed from the station name (or hostname) and process ID. Used to filter inbound VRE status and role assignment messages to this station only. Stored as a string to match the string IDs in DtIfVreStatus, DtIfAssignRolePlayer, and DtIfUnassignRolePlayer.

◆ myVreBackendAddrAttr

DtAttributeHandleType<DtSimulationAddress> makVre::DtSessionStatusConnector::myVreBackendAddrAttr
protected

Simulation address of this station's VRE backend process.

Stored as an attribute store handle so other connectors (e.g. DtOwnshipCreationConnector) can read the current backend address via DtAttributeHandleType without a connector pointer. Value is DtSimulationAddress::nullId() when no backend is running.

Attribute Store KeyvreBackendStatus.SimAddress

◆ mySessionStatusAttr

DtAttributeHandleType<VrfSessionStatusMessage::VrfSessionStatusData> makVre::DtSessionStatusConnector::mySessionStatusAttr
protected

Current cached session status data.

Attribute Store KeysessionStatus

◆ mySessionPlayStateAttr

DtAttributeHandleType<bool> makVre::DtSessionStatusConnector::mySessionPlayStateAttr
protected

True if the session is currently playing (not paused)

Attribute Store KeysessionPlayState

◆ myReengageOnRewindAttr

DtAttributeHandleType<bool> makVre::DtSessionStatusConnector::myReengageOnRewindAttr
protected

Read-only policy controlling automatic reengagement after rewind.

Attribute Store KeyreengageOnRewind

◆ mySessionSmsListAttr

DtAttributeHandleType<std::set<std::string> > makVre::DtSessionStatusConnector::mySessionSmsListAttr
protected

Current set of simulation model set filenames for this session.

Attribute Store KeysessionSmsList

◆ myBackendIsHostAttr

DtAttributeHandleType<bool> makVre::DtSessionStatusConnector::myBackendIsHostAttr
protected

Indicates whether this station is the backend host.

Attribute Store KeyvreBackendIsHost

◆ myVreStatusLocalAttr

DtAttributeHandle makVre::DtSessionStatusConnector::myVreStatusLocalAttr
protected

Read handle for the local station status attribute subtree.

Bound during install() to the global App attribute tree's vreStatus.local subtree. Read by the network thread in sendLocalStatusHeartbeat() for outbound heartbeats.

Attribute Store KeyvreStatus.local

◆ myBackendsListAttr

DtAttributeHandle makVre::DtSessionStatusConnector::myBackendsListAttr
protected

Connector state.

Unique identifier for this station

Computed from the station name (or hostname) and process ID. Used to filter inbound VRE status and role assignment messages to this station only. Stored as a string to match the string IDs in DtIfVreStatus, DtIfAssignRolePlayer, and DtIfUnassignRolePlayer.

◆ myVreStatusStationsAttr

DtAttributeHandleType<std::vector<std::string> > makVre::DtSessionStatusConnector::myVreStatusStationsAttr
protected

Remote station status attribute subtree.

Bound during install() to the global App attribute tree's vreStatus.stations subtree. Stores a vector of station-ID strings as the root value; each named child holds that station's fields (appName, playerName, entityId, entityUuid, stationName, spectatorMode, lastSeen, id). Written by the network thread on inbound DtIfVreStatus traffic; read by the main thread for UI and ownership-transfer logic.

Attribute Store KeyvreStatus.stations

◆ myHasPendingRoleAssignment

bool makVre::DtSessionStatusConnector::myHasPendingRoleAssignment = false
protected

True when there is a cached assignment awaiting acknowledgement.

◆ myPendingRoleAssignment

VreAssignRolePlayerMessage::VreAssignRolePlayerData makVre::DtSessionStatusConnector::myPendingRoleAssignment
protected

Latest role assignment for this station awaiting acknowledgement.

◆ myLastHeartbeatTime

double makVre::DtSessionStatusConnector::myLastHeartbeatTime
protected

Wall-clock timer tracking when the last outbound heartbeat was sent.

◆ theHeartbeatIntervalS

double makVre::DtSessionStatusConnector::theHeartbeatIntervalS = 1.f
staticconstexprprotected

Heartbeat interval in Seconds for outbound DtIfVreStatus messages.


The documentation for this class was generated from the following file: