|
VR-Engage
2.3
|
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>
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 () |
Additional Inherited Members | |
Public Types inherited from makVre::DtConnector | |
| enum | DtConnectorType { DIS , HLA13 , HLA1516 , HLA1516E , HLA4 } |
|
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.
|
overridevirtualdefault |
Virtual destructor.
|
virtual |
Installs the session status connector with shared infrastructure.
| connection | Non-owning pointer to the protocol-specific VR-Link connection. |
| vrfRemoteController | Non-owning pointer to the shared VRF remote controller owned by DtConnectorAccessory. |
Stores the non-owning infrastructure pointer and registers:
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.
|
overridevirtual |
Performs periodic session status evaluation.
Calls updateSessionStatus() each tick to detect backend/session changes and broadcast updates to the frontend.
| dt | The elapsed time in seconds since the last tick |
Reimplemented from makVre::DT_PROTOCOL_NAMESPACE::DtSimEventConnector.
|
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.
|
virtual |
Session status and SMS list message handlers.
Handles a request for the current VRF session status
| message | Pointer to the session status request message |
Calls sendSessionStatusMessage() to send the current cached session status to the frontend immediately.
|
virtual |
Handles a request for the current simulation model set (SMS) list.
| message | Pointer to the SMS list request message |
Calls sendSessionSmsUpdate() to send the current SMS list to the frontend.
|
virtual |
Handles a request for the current session play state.
| message | Pointer to the play state request message |
Calls sendSessionPlayState() to send the current playing/paused state to the frontend.
|
virtual |
Handles a request or response for the cached role assignment.
| message | Pointer to the pending-role-assignment message. |
|
virtual |
Handles a request to set the default simulation model set (SMS) list.
| message | Pointer to the set default SMS list message |
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().
|
virtual |
Simulation control message handlers.
Handles a request to start or resume the simulation
| message | Pointer to the VRF run message |
|
virtual |
Handles a request to pause the simulation.
| message | Pointer to the VRF pause message |
|
virtual |
Handles a request to rewind the simulation initiated by this station.
| message | Pointer to the VRF rewind message |
Pauses the simulation then rewinds it. Snapshot-based rollback is a Phase 3 feature (DtVreBackendConnector) and is not yet supported here.
|
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.
|
static |
Static callbacks for VRF backend messages.
Static callback for inbound VRE status messages (VRF backend → frontend)
| msg | Pointer to the simulation message |
| usr | Pointer to the connector instance |
|
static |
Static callback for role assignment messages from the VRF backend.
| msg | Pointer to the simulation message |
| usr | Pointer to the connector instance |
|
static |
Static callback for role unassignment messages from the VRF backend.
| msg | Pointer to the simulation message |
| usr | Pointer to the connector instance |
|
static |
Static callback invoked when a backend simulation address is removed.
| addr | Simulation address of the removed backend |
| usr | Pointer to the connector instance |
|
protectedvirtual |
Instance methods for processing inbound VRF callbacks.
Processes inbound VRE status messages received from the VRF backend
| msg | Pointer to the simulation message |
Filters out this station's own identity and forwards all other stations' status to the frontend as VreStatusMessage objects.
|
protectedvirtual |
Processes role assignment messages received from the VRF backend.
| msg | Pointer 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.
|
protectedvirtual |
Processes role unassignment messages received from the VRF backend.
| msg | Pointer to the simulation message |
Forwards VreUnassignRolePlayerMessage to the frontend if the message is addressed to this station's identity.
|
protectedvirtual |
Processes a backend removal notification for this connector.
Removes the attribute entry for the departing backend address from the backends attribute subtree.
| addr | Simulation address of the removed backend |
|
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.
|
protected |
Clears any cached role assignment awaiting acknowledgement.
|
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.
|
protectedvirtual |
Sends the current session status to the frontend.
Creates and queues a VrfSessionStatusMessage from the cached mySessionStatusAttr data.
|
protectedvirtual |
Sends the current session play state to the frontend.
Creates and queues a SessionPlayStateMessage indicating whether the simulation is currently running or paused.
|
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.
|
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.
|
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.
|
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 Key | vreBackendStatus.SimAddress |
|---|
|
protected |
Current cached session status data.
| Attribute Store Key | sessionStatus |
|---|
|
protected |
True if the session is currently playing (not paused)
| Attribute Store Key | sessionPlayState |
|---|
|
protected |
Read-only policy controlling automatic reengagement after rewind.
| Attribute Store Key | reengageOnRewind |
|---|
|
protected |
Current set of simulation model set filenames for this session.
| Attribute Store Key | sessionSmsList |
|---|
|
protected |
Indicates whether this station is the backend host.
| Attribute Store Key | vreBackendIsHost |
|---|
|
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 Key | vreStatus.local |
|---|
|
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.
|
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 Key | vreStatus.stations |
|---|
|
protected |
True when there is a cached assignment awaiting acknowledgement.
|
protected |
Latest role assignment for this station awaiting acknowledgement.
|
protected |
Wall-clock timer tracking when the last outbound heartbeat was sent.
|
staticconstexprprotected |
Heartbeat interval in Seconds for outbound DtIfVreStatus messages.