10 #include <json/json.h>
103 default:
return "Unknown";
130 return "ConnectResponse";
136 return "ConfigureResponse";
140 return "EntityAttributeUpdate";
142 return "EntityAttributeUpdateMultiple";
146 return "TacticalGraphicAttributeUpdate";
148 return "TacticalGraphicAttributeUpdateMultiple";
152 return "AggregateAttributeUpdate";
154 return "AggregateAttributeUpdateMultiple";
158 return "ContactReportAttributeUpdate";
160 return "ContactReportAttributeUpdateMultiple";
164 return "ObjectDeleted";
166 return "ObjectDeletedMultiple";
168 return "ResetObjects";
172 return "Interaction";
174 return "InteractionMultiple";
180 return "LogResponse";
187 return "ScenarioStatus";
191 return "ScenarioRolesStatus";
193 return "PlayerRolesStatus";
197 return "SubscribeMessageTypes";
210 if (str ==
"Connect")
214 if (str ==
"ConnectResponse")
220 if (str ==
"Configure")
224 if (str ==
"ConfigureResponse")
230 if (str ==
"EntityAttributeUpdate")
234 if (str ==
"EntityAttributeUpdateMultiple")
240 if (str ==
"TacticalGraphicAttributeUpdate")
244 if (str ==
"TacticalGraphicAttributeUpdateMultiple")
250 if (str ==
"AggregateAttributeUpdate")
254 if (str ==
"AggregateAttributeUpdateMultiple")
260 if (str ==
"ContactReportAttributeUpdate")
264 if (str ==
"ContactReportAttributeUpdateMultiple")
270 if (str ==
"ObjectDeleted")
274 if (str ==
"ObjectDeletedMultiple")
278 if (str ==
"ResetObjects")
284 if (str ==
"Interaction")
288 if (str ==
"InteractionMultiple")
294 if (str ==
"LogRequest")
298 if (str ==
"LogResponse")
309 if (str ==
"ScenarioStatus")
314 if (str ==
"ScenarioRolesStatus")
319 if (str ==
"PlayerRolesStatus")
324 if (str ==
"SubscribeMessageTypes")
368 if (str ==
"AttributeUpdate")
411 msg.
clientName = json.get(
"ClientName",
"").asString();
412 msg.
wsUserName = json.get(
"userName",
"").asString();
413 msg.
hostname = json.get(
"hostname",
"").asString();
414 msg.
webLVCVersion = json.get(
"WebLVCVersion", 1.0).asDouble();
416 if (json.isMember(
"UpdateFrequency"))
429 if (json.isMember(
"OnChangeOnly"))
434 if (json.isMember(
"Messages") && json[
"Messages"].isArray())
436 for (
const auto& m : json[
"Messages"])
456 obj[
"OnChangeOnly"] =
true;
465 obj[
"Messages"] = arr;
491 for (
const auto& e :
errors)
493 errArr.append(e.toJson());
495 obj[
"Errors"] = errArr;
510 if (json.isMember(
"TimestampFormat"))
574 for (
const auto& key :
attributes.getMemberNames())
590 msg.
uuid = json.get(
"UUID",
"").asString();
591 msg.
objectType = json.get(
"ObjectType",
"").asString();
592 msg.
timestamp = json.get(
"Timestamp",
"").asString();
596 for (
const auto& key : json.getMemberNames())
598 if (key !=
"MessageKind" && key !=
"UUID" && key !=
"ObjectType" && key !=
"Timestamp")
639 for (
const auto&
id :
uuids)
682 msg.
timestamp = json.get(
"Timestamp",
"").asString();
700 if (json.isMember(
"Length"))
702 msg.
length = json[
"Length"].asInt();
712 std::vector<DtLogEntry>
log;
719 for (
const auto& entry :
log)
721 logArr.append(entry.toJson());
736 std::vector<DtEntityAttributeUpdateMessage>
updates;
745 for (
const auto& update :
updates)
749 updateObj[
"UUID"] = update.uuid;
750 if (update.isInitial || !update.objectType.empty())
752 updateObj[
"ObjectType"] = update.objectType;
755 if (update.attributes.isObject())
757 for (
const auto& key : update.attributes.getMemberNames())
759 updateObj[key] = update.attributes[key];
762 if (!update.timestamp.empty())
764 updateObj[
"Timestamp"] = update.timestamp;
766 updatesArr.append(updateObj);
768 obj[
"Updates"] = updatesArr;
780 msg.
timestamp = json.get(
"Timestamp",
"").asString();
782 if (json.isMember(
"Updates") && json[
"Updates"].isArray())
784 for (
const auto& updateJson : json[
"Updates"])
803 std::vector<DtEntityAttributeUpdateMessage>
updates;
812 for (
const auto& update :
updates)
815 updateObj[
"UUID"] = update.uuid;
816 if (!update.objectType.empty())
818 updateObj[
"ObjectType"] = update.objectType;
820 if (update.attributes.isObject())
822 for (
const auto& key : update.attributes.getMemberNames())
824 updateObj[key] = update.attributes[key];
827 if (!update.timestamp.empty())
829 updateObj[
"Timestamp"] = update.timestamp;
831 updatesArr.append(updateObj);
833 obj[
"Updates"] = updatesArr;
848 std::vector<DtEntityAttributeUpdateMessage>
updates;
857 for (
const auto& update :
updates)
860 updateObj[
"UUID"] = update.uuid;
861 if (update.isInitial || !update.objectType.empty())
863 updateObj[
"ObjectType"] = update.objectType;
865 if (update.attributes.isObject())
867 for (
const auto& key : update.attributes.getMemberNames())
869 updateObj[key] = update.attributes[key];
872 if (!update.timestamp.empty())
874 updateObj[
"Timestamp"] = update.timestamp;
876 updatesArr.append(updateObj);
878 obj[
"Updates"] = updatesArr;
953 std::vector<DtEntityAttributeUpdateMessage> entities;
bool onChangeOnly
Definition: webLVCMessage.h:404
Json::Value toJson() const
Definition: webLVCMessage.h:664
std::string wsUserName
Definition: webLVCMessage.h:400
std::string uuid
Definition: webLVCMessage.h:555
Json::Value toJson() const
Definition: webLVCMessage.h:714
ContactReportAttributeUpdate / ContactReportAttributeUpdateMultiple / ObjectDeleted for contact repor...
std::string interactionType
Definition: webLVCMessage.h:660
Json::Value toJson() const
Definition: webLVCMessage.h:739
Json::Value interaction
Definition: webLVCMessage.h:661
std::vector< DtEntityAttributeUpdateMessage > getAllEntityStates()
Get all entity states from DtVrfManager TODO: Implement to retrieve all entity data for batch updates...
Definition: webLVCMessage.h:951
DtMessageKind
WebLVC DtMessageKind enum per message specification All WebLVC Messages shall include the DtMessageKi...
Definition: webLVCMessage.h:17
static DtEntityAttributeUpdateMultipleMessage fromJson(const Json::Value &json)
Definition: webLVCMessage.h:777
ConnectResponse Message - Section 5.3.2 Sent by server in response to Connect.
Definition: webLVCMessage.h:473
std::vector< DtEntityAttributeUpdateMessage > updates
Definition: webLVCMessage.h:736
std::vector< Json::Value > messages
Definition: webLVCMessage.h:406
EntityAttributeUpdate Message - per message specification Conveys values of entity attributes (positi...
Definition: webLVCMessage.h:553
Json::Value toJson() const
Definition: webLVCMessage.h:899
std::string timestamp
Definition: webLVCMessage.h:632
DtMessageCategory DtParseMessageCategory(const std::string &str)
Parse a wire string to DtMessageCategory.
Definition: webLVCMessage.h:108
AggregateAttributeUpdateMultiple Message — batch update for multiple aggregate entities in a single m...
Definition: webLVCMessage.h:801
std::string message
Definition: webLVCMessage.h:380
AggregateAttributeUpdate / AggregateAttributeUpdateMultiple / ObjectDeleted for aggregates.
DtMessageCategory
Logical categories of server-to-client push messages a client may subscribe to. A client that does no...
Definition: webLVCMessage.h:78
std::string clientName
Definition: webLVCMessage.h:399
std::string DtMessageCategoryToString(DtMessageCategory cat)
Convert DtMessageCategory enum to its wire string.
Definition: webLVCMessage.h:91
Json::Value toJson() const
Definition: webLVCMessage.h:923
Json::Value toJson() const
Definition: webLVCMessage.h:614
std::vector< DtLogEntry > errors
Definition: webLVCMessage.h:477
int length
Definition: webLVCMessage.h:695
std::vector< DtEntityAttributeUpdateMessage > updates
Definition: webLVCMessage.h:803
LogResponse Message - Section 5.7.2 Response containing log entries.
Definition: webLVCMessage.h:710
Json::Value coordinates
Definition: webLVCMessage.h:896
Json::Value toJson() const
Definition: webLVCMessage.h:806
std::string timestamp
Definition: webLVCMessage.h:612
ObjectDeleted Message - Section 5.4.3 Notification that an object no longer exists or is out of scope...
Definition: webLVCMessage.h:609
double webLVCVersion
Definition: webLVCMessage.h:476
Json::Value toJson() const
Definition: webLVCMessage.h:561
std::vector< DtLogEntry > log
Definition: webLVCMessage.h:712
DtEntityAttributeUpdateMessage getEntityState(const std::string &uuid)
Get entity state from DtVrfManager TODO: Implement to retrieve actual entity data.
Definition: webLVCMessage.h:941
std::string timestamp
Definition: webLVCMessage.h:737
EntityAttributeUpdate / EntityAttributeUpdateMultiple / ObjectDeleted for entities.
std::string timestamp
Definition: webLVCMessage.h:379
bool isInitial
Definition: webLVCMessage.h:559
IMGUI_API void Value(const char *prefix, bool b)
std::string hostname
Definition: webLVCMessage.h:401
bool connected
Definition: webLVCMessage.h:475
Log entry per Section 5.7.2.
Definition: webLVCMessage.h:377
Json::Value attributes
Definition: webLVCMessage.h:557
std::string DtMessageKindToString(DtMessageKind kind)
Convert DtMessageKind enum to string for JSON DtSerialization Uses human-readable string values per m...
Definition: webLVCMessage.h:122
EntityAttributeUpdateMultiple Message - per message specification Batch update for multiple entities ...
Definition: webLVCMessage.h:734
static DtLogRequestMessage fromJson(const Json::Value &json)
Definition: webLVCMessage.h:697
Json::Value toJson() const
Definition: webLVCMessage.h:479
Geometry record for tactical graphics.
Definition: webLVCMessage.h:893
double radius
Definition: webLVCMessage.h:897
std::string timestamp
Definition: webLVCMessage.h:558
std::string timestamp
Definition: webLVCMessage.h:662
ScenarioRolesStatus / PlayerRolesStatus.
std::string type
Definition: webLVCMessage.h:895
Ping Message - keep-alive message Sent by server during idle periods (40-60 seconds) ...
Definition: webLVCMessage.h:919
LogRequest Message - Section 5.7.1 Request log entries from server.
Definition: webLVCMessage.h:693
Json::Value toJson() const
Definition: webLVCMessage.h:634
static DtInteractionMessage fromJson(const Json::Value &json)
Definition: webLVCMessage.h:677
std::string uuid
Definition: webLVCMessage.h:611
Interaction Message - Section 5.5.1 Conveys parameters of a simulation event.
Definition: webLVCMessage.h:658
Connect Message - Section 5.3.1 Sent by client to initiate connection handshake.
Definition: webLVCMessage.h:397
Json::Value toJson() const
Definition: webLVCMessage.h:444
static DtConnectMessage fromJson(const Json::Value &json)
Definition: webLVCMessage.h:408
std::string timestamp
Definition: webLVCMessage.h:804
std::vector< std::string > uuids
Definition: webLVCMessage.h:631
Json::Value toJson() const
Definition: webLVCMessage.h:382
TacticalGraphicAttributeUpdate / TacticalGraphicAttributeUpdateMultiple / ObjectDeleted for TGs...
std::string objectType
Definition: webLVCMessage.h:556
static DtEntityAttributeUpdateMessage fromJson(const Json::Value &json)
Definition: webLVCMessage.h:587
std::string timestamp
Definition: webLVCMessage.h:921
double webLVCVersion
Definition: webLVCMessage.h:402
ObjectDeletedMultiple Message Batches deletion notifications for multiple objects into a single messa...
Definition: webLVCMessage.h:629
Interaction / InteractionMultiple.
DtMessageKind DtParseMessageKind(const std::string &str)
Parse DtMessageKind from string Accepts human-readable string names per message specification.
Definition: webLVCMessage.h:207
bool hasUpdateFrequency
Definition: webLVCMessage.h:405
double updateFrequencyHz
Definition: webLVCMessage.h:403