|
VR-Engage
2.2
|
This class is responsible for broadcasting status information about a VREngage application to other applications in the distributed simulation environment, such as VR-Forces GUI and other control applications. It sends periodic heartbeat messages containing application identity, player information, and entity state.
The status publisher maintains information such as the application ID, name, player name, controlled entity ID, station name, and operational mode. This information can be updated at runtime, and the publisher will automatically track changes and send updated status messages when necessary.
#include <vrengageStatusPublisher.h>
Public Member Functions | |
| DtVreStatusPublisher () | |
| virtual | ~DtVreStatusPublisher () |
| virtual void | sendStatus () |
| virtual void | setHeartbeatInterval (int heartbeatInterval) |
| virtual int | heartbeatInterval () |
| virtual void | tick () |
| virtual void | setId (unsigned long id) |
| virtual unsigned long | id () const |
| virtual void | setName (const std::string &name) |
| virtual std::string | name () const |
| virtual void | setPlayerName (const DtString &name) |
| virtual DtString | playerName () const |
| virtual void | setEntityId (const DtEntityIdentifier &entityId) |
| virtual DtEntityIdentifier | entityId () const |
| virtual void | setStationName (const std::string &name) |
| virtual std::string | stationName () const |
| virtual void | setSpectatorMode (bool mode) |
| virtual bool | spectatorMode () const |
| virtual void | setFinalStatus (bool status) |
| virtual bool | finalStatus () const |
Static Public Member Functions | |
| static DtEntityIdentifier | getEntityId () |
Protected Member Functions | |
| DtVreStatusPublisher (const DtVreStatusPublisher &orig) | |
| DtVreStatusPublisher & | operator= (const DtVreStatusPublisher &orig) |
Protected Attributes | |
| int | myHeartbeatInterval |
| DtTime | myTimeLastSent |
| bool | myHasBeenModified |
| unsigned long long | myId |
| std::string | myName |
| std::string | myPlayerName |
| DtEntityIdentifier | myEntityId |
| std::string | myStationName |
| bool | mySpectatorMode |
| bool | myFinalStatus |
Static Protected Attributes | |
| static DtEntityIdentifier | theEntityId |
| makVre::DtVreStatusPublisher::DtVreStatusPublisher | ( | ) |
Constructor.
Initializes a new status publisher with default values for all properties. The heartbeat interval is initialized to a default value, and the publisher is marked as modified to ensure a status message is sent on the next tick.
Referenced by DtVreStatusPublisher(), and operator=().
|
virtual |
Virtual destructor.
Ensures proper cleanup of derived classes.
|
protected |
Copy constructor.
| orig | Original status publisher to copy |
This copy constructor creates a new status publisher that is a copy of the specified original. It is protected to prevent unintended copying.
References DtVreStatusPublisher().
|
virtual |
Sends a status message immediately.
This method immediately broadcasts a status message containing the current state of the publisher. It resets the last sent time and clears the modified flag. This method is called automatically by tick() when necessary, but can also be called manually to force an immediate status update.
|
virtual |
Sets the heartbeat interval.
| heartbeatInterval | Interval in milliseconds between status messages |
This method sets the interval at which status messages are automatically sent. The interval is specified in milliseconds. If the publisher has not been modified since the last status message, a new status message will be sent every heartbeatInterval milliseconds.
References heartbeatInterval().
|
virtual |
Gets the current heartbeat interval.
This method returns the current interval at which status messages are automatically sent.
Referenced by setHeartbeatInterval().
|
virtual |
Updates the publisher and sends status messages when necessary.
This method is called periodically (typically by the simulation manager) to update the publisher and send status messages when necessary. It checks if the publisher has been modified or if the heartbeat interval has elapsed, and sends a status message if either condition is true.
|
virtual |
Sets the application ID.
| id | Unique identifier for this application |
This method sets the unique identifier for this VREngage application. The ID should be unique across all participating VREngage applications in an exercise. Setting a new ID marks the publisher as modified.
|
virtual |
Gets the application ID.
This method returns the unique identifier for this VREngage application.
|
virtual |
Sets the application name.
| name | Name for this application |
This method sets the name for this VREngage application. The name should be unique across all participating VREngage applications in an exercise, but may be changed over the lifetime of an application. Setting a new name marks the publisher as modified.
References name().
|
virtual |
Gets the application name.
This method returns the name for this VREngage application.
Referenced by setName(), setPlayerName(), and setStationName().
|
virtual |
Sets the player name.
| name | Name of the player using this application |
This method sets the name of the player using this VREngage application. The player name is optional and can be used to identify the human user controlling the application. Setting a new player name marks the publisher as modified.
References name().
|
virtual |
Gets the player name.
This method returns the name of the player using this VREngage application.
|
virtual |
Sets the controlled entity ID.
| entityId | Identifier of the entity controlled by this application |
This method sets the identifier of the entity controlled by this VREngage application. This is typically the primary entity that the player is controlling or inhabiting. Setting a new entity ID marks the publisher as modified and updates the static entity ID.
References entityId().
|
virtual |
Gets the controlled entity ID.
This method returns the identifier of the entity controlled by this VREngage application.
Referenced by setEntityId().
|
static |
Gets the static controlled entity ID.
This static method provides access to the entity ID from anywhere in the application without needing a reference to the status publisher instance.
|
virtual |
Sets the station name (player role)
| name | Name of the station/role this player is operating |
This method sets the station name, which identifies the player's role. Available string identifiers for roles are defined in VR-Engage player definition lua files (e.g., "Pilot", "Human", "LAV Driver", etc.). Setting a new station name marks the publisher as modified.
References name().
|
virtual |
Gets the station name (player role)
This method returns the station name, which identifies the player's role.
|
virtual |
Sets the spectator mode flag.
| mode | True if the player is in spectator mode, false otherwise |
This method sets the flag indicating whether the player is in spectator mode. In spectator mode, the player is observing the simulation but not actively controlling an entity. Setting a new spectator mode marks the publisher as modified.
|
virtual |
Gets the spectator mode flag.
This method returns the flag indicating whether the player is in spectator mode.
|
virtual |
Sets the final status flag.
| status | True if this is the final status message, false otherwise |
This method sets the flag indicating if this is a final status message for the VREngage application. A final status message indicates that the application is shutting down and will no longer be sending status updates. Setting the final status flag to true marks the publisher as modified.
|
virtual |
Gets the final status flag.
This method returns the flag indicating if this is a final status message for the VREngage application.
|
protected |
Assignment operator.
| orig | Original status publisher to assign from |
This assignment operator assigns the state of the specified original status publisher to this status publisher. It is protected to prevent unintended assignment.
References DtVreStatusPublisher().
|
protected |
Interval in milliseconds between status messages.
|
protected |
Time when the last status message was sent.
|
protected |
Flag indicating if the publisher has been modified since the last message.
|
protected |
Unique identifier for this application.
|
protected |
Name of this application.
|
protected |
Name of the player using this application.
|
protected |
Identifier of the entity controlled by this application.
|
protected |
Name of the station/role this player is operating.
|
protected |
Flag indicating whether the player is in spectator mode.
|
protected |
Flag indicating if this is a final status message.
|
staticprotected |
Static entity identifier for global access.
This static member provides access to the entity ID from anywhere in the application without needing a reference to the status publisher instance.