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