VR-Engage  2.3
Loading...
Searching...
No Matches
ifVreStatus.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file ifVreStatus.h
7//! \ingroup vreVrfMessages
8//! \brief Interface message class for VREngage status information
9//!
10//! This file defines the DtIfVreStatus class, which is used by VREngage
11//! applications to announce their availability as role players and their
12//! current entity assignment status.
13
14#pragma once
15
17#include <vrfExtProtocol/simInterfaceContent.h>
18#include <vrfutil/uuid.h>
19#include <vlutil/vlString.h>
20#include <vlpi/simulationAddress.h>
21
22//! \brief Current version of the VREngage status message
24
25//! \brief Interface message for VREngage status information
26//!
27//! Instances of DtIfVreStatus messages are sent out by a VREngage application
28//! to announce its availability as a role player and its current entity
29//! assignment status. These status messages enable coordination between
30//! multiple VREngage stations and other simulation components.
31
32class VRFMESSAGES_DLL DtIfVreStatus : public DtSimInterfaceContent
33{
34public:
35 //! \brief Default constructor
36 //!
37 //! Initializes an empty VREngage status message.
39
40 //! \brief Virtual destructor
41 virtual ~DtIfVreStatus() override;
42
43 //! \brief Copy constructor
44 //! \param orig The VREngage status message to copy from
45 //!
46 //! Creates a new VREngage status message by copying an existing one.
48
49 //! \brief Assignment operator
50 //! \param orig The VREngage status message to copy from
51 //! \return Reference to this object after assignment
52 //!
53 //! Copies the contents of another VREngage status message into this one.
55
56 //! \brief Gets the interface message type
57 //! \return The message type identifier
58 //!
59 //! Returns DtVreStatusMessageType as defined in vreVrfMessageTypes.h.
60 virtual int type() const override;
61
62 //! \brief Creates a copy of this message
63 //! \return Pointer to the new copy
64 //!
65 //! Creates a dynamically allocated copy of this message.
66 virtual DtSimInterfaceContent* clone() const override;
67
68 //! \brief Sets the station id of the VREngage application
69 //! \param id The station id to set
70 //!
71 //! Sets the station id of the VREngage application. This should be unique across
72 //! all participating VREngage applications in an exercise, but unlike the ID,
73 //! it may be changed during the lifetime of the application.
74 virtual void setStationId(const DtString& id);
75
76 //! \brief Gets the station id of the VREngage application
77 //! \return The station id
78 virtual DtString stationId() const;
79
80 //! \brief Sets the name of the player using the VREngage application
81 //! \param name The player name to set
82 //!
83 //! Sets the optional name of the human player using the VREngage application.
84 //! This can be used for display purposes and user identification.
85 virtual void setPlayerName(const DtString& name);
86
87 //! \brief Gets the name of the player
88 //! \return The player name
89 virtual DtString playerName() const;
90
91 //! \brief Sets the UUID of the entity being controlled
92 //! \param uuid The entity UUID to set
93 //!
94 //! Sets the UUID of the entity currently controlled by this VREngage station.
95 //! If no entity is currently controlled, this may be empty.
96 virtual void setUUID(const DtUUID& uuid);
97
98 //! \brief Gets the UUID of the entity being controlled
99 //! \return The entity UUID
100 virtual DtUUID uuid() const;
101
102 //! \brief Sets the station/role name for the player
103 //! \param name The station name to set
104 //!
105 //! Sets the station name (role) assumed by the player at the VREngage station.
106 //! Available string identifiers for station names are defined in the
107 //! VREngage player definition .entity files (e.g., "driver", "gunner", "commander").
108 virtual void setStationName(const DtString& name);
109
110 //! \brief Gets the station/role name for the player
111 //! \return The station name
112 virtual DtString stationName() const;
113
114 //! \brief Sets the spectator mode flag
115 //! \param mode True for spectator mode, false for active player mode
116 //!
117 //! Sets whether the player at the VREngage station is in spectator mode.
118 //! In spectator mode, the player can observe but not interact with the entity.
119 virtual void setSpectatorMode(bool mode);
120
121 //! \brief Gets the spectator mode flag
122 //! \return True if in spectator mode, false otherwise
123 virtual bool spectatorMode() const;
124
125 //! \brief Sets the final status message flag
126 //! \param yesNo True if this is the final status message, false otherwise
127 //!
128 //! Sets whether this status message is the final one to be sent by this
129 //! VREngage application. When true, it indicates the application is shutting down.
130 virtual void setFinalStatusMessage(bool yesNo);
131
132 //! \brief Gets the final status message flag
133 //! \return True if this is the final status message, false otherwise
134 virtual bool finalStatusMessage() const;
135
136 virtual void setOwnshipSimAddress(const DtSimulationAddress& simAddress);
137
138 virtual DtSimulationAddress ownshipSimAddress() const;
139
140
141 //! \brief Gets the network representation size
142 //! \return Size in bytes of the network representation
143 //!
144 //! Returns the size of the network buffer needed to store this message.
145 virtual int netRepSize() const override;
146
147 //! \brief Deserializes the message from a network buffer
148 //! \param contentBuffer Pointer to the network buffer
149 //! \param contentSize Size of the buffer in bytes
150 //! \return True if deserialization was successful
151 //!
152 //! Fills the message from the provided network buffer.
153 virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
154
155 //! \brief Serializes the message for network transmission
156 //! \return True if serialization was successful
157 //!
158 //! Prepares the message for network transmission.
159 virtual bool setToNet() override;
160
161 //! \brief Formats the message data as a string
162 //! \param str String to store the formatted message data
163 //!
164 //! Appends a human-readable representation of the message to the provided string.
165 virtual void printDataToString(DtString& str) override;
166
167 //! \brief Static creator function for factory registration
168 //! \return Pointer to a new instance of DtIfVreStatus
169 //!
170 //! This static function is used for registration with DtInterfaceContentFactory.
171 static DtSimInterfaceContent* creator();
172
173
174protected:
175 //! \brief Version information for the message
176 //!
177 //! The high word is a signal that the version exists, and the
178 //! low word is the actual version. If this information does not exist,
179 //! it is assumed to be an older status message.
181
182 //! \brief Station ID of the VREngage application
183 //!
184 //! Should be unique across all VREngage stations in an exercise.
185 DtString myStationId;
186
187 //! \brief Name of the player using the VREngage application
188 //!
189 //! Optional identifier for the human user of the application.
190 DtString myPlayerName;
191
192 //! \brief UUID of the entity being controlled
193 //!
194 //! Identifies the entity currently controlled by this VREngage station.
195 //! May be empty if no entity is currently controlled.
196 DtUUID myUUID;
197
198 //! \brief Station/role name for the player
199 //!
200 //! The station name (role) assumed by the player at the VREngage station
201 //! (defined in the .entity file, e.g., "driver", "gunner", "commander").
203
204 //! \brief Flag indicating whether player is in spectator mode
205 //!
206 //! When true, the player can observe but not interact with the entity.
208
209 //! \brief Flag indicating whether this is the final status message
210 //!
211 //! When true, indicates this is the final status message to be sent by
212 //! this VREngage application before shutting down.
214
215 DtSimulationAddress myOwnshipSimAddress;
216};
bool mySpectatorMode
Flag indicating whether player is in spectator mode.
Definition ifVreStatus.h:207
virtual DtString stationId() const
Gets the station id of the VREngage application.
virtual void setStationName(const DtString &name)
Sets the station/role name for the player.
DtString myPlayerName
Name of the player using the VREngage application.
Definition ifVreStatus.h:190
DtUUID myUUID
UUID of the entity being controlled.
Definition ifVreStatus.h:196
virtual void setUUID(const DtUUID &uuid)
Sets the UUID of the entity being controlled.
virtual DtUUID uuid() const
Gets the UUID of the entity being controlled.
DtString myStationName
Station/role name for the player.
Definition ifVreStatus.h:202
virtual void setFinalStatusMessage(bool yesNo)
Sets the final status message flag.
virtual int netRepSize() const override
Gets the network representation size.
static DtSimInterfaceContent * creator()
Static creator function for factory registration.
virtual DtSimulationAddress ownshipSimAddress() const
virtual bool finalStatusMessage() const
Gets the final status message flag.
virtual DtSimInterfaceContent * clone() const override
Creates a copy of this message.
virtual void setSpectatorMode(bool mode)
Sets the spectator mode flag.
virtual DtString playerName() const
Gets the name of the player.
virtual int type() const override
Gets the interface message type.
DtString myStationId
Station ID of the VREngage application.
Definition ifVreStatus.h:185
virtual void setStationId(const DtString &id)
Sets the station id of the VREngage application.
virtual void printDataToString(DtString &str) override
Formats the message data as a string.
DtIfVreStatus()
Default constructor.
virtual bool spectatorMode() const
Gets the spectator mode flag.
DtIfVreStatus(const DtIfVreStatus &orig)
Copy constructor.
DtU32 myVersion
Version information for the message.
Definition ifVreStatus.h:180
virtual void setOwnshipSimAddress(const DtSimulationAddress &simAddress)
DtSimulationAddress myOwnshipSimAddress
Definition ifVreStatus.h:215
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Deserializes the message from a network buffer.
bool myFinalStatusMessage
Flag indicating whether this is the final status message.
Definition ifVreStatus.h:213
virtual ~DtIfVreStatus() override
Virtual destructor.
virtual bool setToNet() override
Serializes the message for network transmission.
virtual DtString stationName() const
Gets the station/role name for the player.
virtual void setPlayerName(const DtString &name)
Sets the name of the player using the VREngage application.
DtIfVreStatus & operator=(const DtIfVreStatus &orig)
Assignment operator.
const int DtIfVreStatusVersion
Current version of the VREngage status message.
Definition ifVreStatus.h:23
Export/import macros for the VRF Messages library.
#define VRFMESSAGES_DLL
Definition export.h:23