Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+69
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The ReplyMessage class is an abstract base class for all possible messages which are sent to the client
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLST, 2017-12-05
|
||||
*/
|
||||
#include "reply_message.h"
|
||||
|
||||
#include <LtsWebSocket/json_keys.h>
|
||||
#include "WebSocketInterface/json_keys.h"
|
||||
|
||||
#include <QtCore/QUuid>
|
||||
#include <QtCore/QJsonDocument>
|
||||
|
||||
namespace ServiceManagement
|
||||
{
|
||||
namespace WebSocketInterface
|
||||
{
|
||||
namespace Messages
|
||||
{
|
||||
using namespace JsonKeys;
|
||||
using namespace LtsWebSocket::JsonKeys;
|
||||
|
||||
// ####### ServicePortsInformationMessage begin #######
|
||||
/********************************************************
|
||||
* Warning: 6002 has been negotiated with ESG for ADLER *
|
||||
********************************************************/
|
||||
ServicePortsInformationMessage::ServicePortsInformationMessage(const QVector<ExerciseInformation> &data, const QString &uuid)
|
||||
: ReplyMessage (SERVICE_PORTS_INFORMATION(), 6002, uuid) // Todo check whether TypeID is correct.
|
||||
{
|
||||
QJsonArray exercises;
|
||||
for (const auto &exercise : data)
|
||||
{
|
||||
QJsonArray services;
|
||||
for (const auto &service : exercise.services)
|
||||
{
|
||||
QJsonArray ports;
|
||||
|
||||
for (const auto &port : service.ports)
|
||||
{
|
||||
ports.append(QJsonObject({{NUMBER(),port.number},
|
||||
{TYPE_ID(),port.type},
|
||||
{PROPERTIES(), port.properties}
|
||||
}));
|
||||
}
|
||||
|
||||
services.append(QJsonObject({{NAME(), service.name},
|
||||
{NAME_ABBR(), service.abbreviation},
|
||||
{PORTS(), ports}
|
||||
}));
|
||||
}
|
||||
QJsonObject obj({{EXERCISE_ID(), exercise.exerciseId},
|
||||
{SERVICES(), services}
|
||||
});
|
||||
if (exercise.replayPartitionId.is_set())
|
||||
obj.insert(REPLAY_PARTITION_ID(), exercise.replayPartitionId.get());
|
||||
|
||||
exercises.append(obj);
|
||||
}
|
||||
|
||||
m_jsonRepresentation.insert(DATA(), exercises);
|
||||
}
|
||||
// ####### ServicePortsInformationMessage end #######
|
||||
|
||||
} // namespace Messages
|
||||
} // namespace WebSocketInterface
|
||||
} // namespace ServiceManagement
|
||||
Reference in new issue
Block a user