Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+286
@@ -0,0 +1,286 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The ClientMessage class is an abstract base class for concrete ClientMessage objects
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLST, 2017-12-05
|
||||
*/
|
||||
#include "client_message.h"
|
||||
|
||||
#include <AssetManagement/asm_db.h>
|
||||
#include <ExerciseManagement/exm_db.h>
|
||||
#include <FileManagement/flm_db.h>
|
||||
#include <InfrastructureManagement/ism_db.h>
|
||||
#include <ParticipantManagement/ppm_db.h>
|
||||
#include <OperatorManagement/opm_db.h>
|
||||
|
||||
#include "WebSocketInterface/Messages/reply_message.h"
|
||||
#include "WebSocketInterface/json_keys.h"
|
||||
#include "WebSocketInterface/data_manager.h"
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QUuid>
|
||||
|
||||
namespace OcBaseDownload
|
||||
{
|
||||
namespace WebSocketInterface
|
||||
{
|
||||
namespace Messages
|
||||
{
|
||||
using namespace JsonKeys;
|
||||
|
||||
// ####### ClientMessageFactory begin #######
|
||||
ClientMessageFactory::ClientMessageFactory(DataManager *dataManager)
|
||||
: LtsWebSocket::AbstractClientMessageFactory(getLogger("ClientMessageFactory"))
|
||||
, m_dataManager(dataManager)
|
||||
{}
|
||||
|
||||
LtsWebSocket::AbstractClientMessage *ClientMessageFactory::createMessage(LtsWebSocket::ReplyHandler *client,
|
||||
const QString &message)
|
||||
{
|
||||
LtsWebSocket::AbstractClientMessage *result = checkAttributes(client, message);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
if (m_type == LtsWebSocket::JsonKeys::ERROR_())
|
||||
result = new ErrorMessage(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// SCM telegram
|
||||
else if (m_type == ServiceManagement::WebSocketInterface::JsonKeys::SERVICE_PORTS_INFORMATION())
|
||||
result = new ServicePortsInformation(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// ASM telegrams
|
||||
else if (m_type == AssetManagement::WebSocketInterface::JsonKeys::TRAINING_AREA_BASE_DATA())
|
||||
result = new BaseData<AssetManagement::DatabaseInterface, AssetManagement::Database::AsmTrainingArea>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == AssetManagement::WebSocketInterface::JsonKeys::TECHNICAL_AREA_BASE_DATA())
|
||||
result = new BaseData<AssetManagement::DatabaseInterface, AssetManagement::Database::AsmTechnicalArea>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == AssetManagement::WebSocketInterface::JsonKeys::LOCATION_BASE_DATA())
|
||||
result = new BaseData<AssetManagement::DatabaseInterface, AssetManagement::Database::AsmLocation>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == AssetManagement::WebSocketInterface::JsonKeys::ASM_ASSET_BASE_DATA())
|
||||
result = new BaseData<AssetManagement::DatabaseInterface, AssetManagement::Database::AsmAsset>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// EXM telegrams
|
||||
else if (m_type == ExerciseManagement::WebSocketInterface::JsonKeys::EXERCISE_BASE_DATA())
|
||||
result = new BaseData<ExerciseManagement::DatabaseInterface, ExerciseManagement::Database::ExmExercise>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == ExerciseManagement::WebSocketInterface::JsonKeys::EXERCISE_PHASE_BASE_DATA())
|
||||
result = new BaseData<ExerciseManagement::DatabaseInterface, ExerciseManagement::Database::ExmExercisePhase>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == ExerciseManagement::WebSocketInterface::JsonKeys::EXERCISE_STATE_CHANGE_BASE_DATA())
|
||||
result = new BaseData<ExerciseManagement::DatabaseInterface, ExerciseManagement::Database::ExmExerciseStateChange>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// ISM telegrams
|
||||
else if (m_type == InfrastructureManagement::WebSocketInterface::JsonKeys::ISM_ASSET_BASE_DATA())
|
||||
result = new BaseData<InfrastructureManagement::DatabaseInterface, InfrastructureManagement::Database::IsmAsset>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == InfrastructureManagement::WebSocketInterface::JsonKeys::MAIN_STRUCTURE_ELEMENT_BASE_DATA())
|
||||
result = new BaseData<InfrastructureManagement::DatabaseInterface, InfrastructureManagement::Database::IsmMainStructureElement>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == InfrastructureManagement::WebSocketInterface::JsonKeys::STRUCTURE_ELEMENT_BASE_DATA())
|
||||
result = new BaseData<InfrastructureManagement::DatabaseInterface, InfrastructureManagement::Database::IsmStructureElement>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == InfrastructureManagement::WebSocketInterface::JsonKeys::STRUCTURE_ELEMENT_FOOTPRINT_BASE_DATA())
|
||||
result = new BaseData<InfrastructureManagement::DatabaseInterface, InfrastructureManagement::Database::IsmStructureElementFootprint>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == InfrastructureManagement::WebSocketInterface::JsonKeys::MOUNTING_POINT_ASSET_BASE_DATA())
|
||||
result = new BaseData<InfrastructureManagement::DatabaseInterface, InfrastructureManagement::Database::IsmMountingPointAsset>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == InfrastructureManagement::WebSocketInterface::JsonKeys::MOUNTING_POINT_SCHEDULE_BASE_DATA())
|
||||
result = new BaseData<InfrastructureManagement::DatabaseInterface, InfrastructureManagement::Database::IsmMountingPointSchedule>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == InfrastructureManagement::WebSocketInterface::JsonKeys::MOUNTING_POINT_PLAN_BASE_DATA())
|
||||
result = new BaseData<InfrastructureManagement::DatabaseInterface, InfrastructureManagement::Database::IsmMountingPointPlan>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// PPM Ex0 telegrams
|
||||
else if (m_type == ParticipantManagement::WebSocketInterface::JsonKeys::EQUIPMENT_TYPE_BASE_DATA())
|
||||
result = new BaseData<ParticipantManagement::DatabaseInterface, ParticipantManagement::Database::PpmEquipmentType>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == ParticipantManagement::WebSocketInterface::JsonKeys::TYPE_BASE_DATA())
|
||||
result = new BaseData<ParticipantManagement::DatabaseInterface, ParticipantManagement::Database::PpmType>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// PPM ExN telegrams
|
||||
else if (m_type == ParticipantManagement::WebSocketInterface::JsonKeys::PARTY_BASE_DATA())
|
||||
result = new BaseData<ParticipantManagement::DatabaseInterface, ParticipantManagement::Database::PpmParty>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == ParticipantManagement::WebSocketInterface::JsonKeys::PARTICIPANT_BASE_DATA())
|
||||
result = new BaseData<ParticipantManagement::DatabaseInterface, ParticipantManagement::Database::PpmParticipant>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// OPM telegrams
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::GROUP_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmGroup>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::GROUP_GROUP_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmGroupGroup>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::OPERATOR_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmOperator>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::OPERATOR_EXERCISE_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmOperatorExercise>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::SETTINGS_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmSettings>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::ACCESS_CONTROL_LEVEL_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmAccessControlLevel>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::ACL_ALLOW_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmAclAllow>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == OperatorManagement::WebSocketInterface::JsonKeys::ACL_DENY_BASE_DATA())
|
||||
result = new BaseData<OperatorManagement::DatabaseInterface, OperatorManagement::Database::OpmAclDeny>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
// FLM telegrams
|
||||
else if (m_type == FileManagement::WebSocketInterface::JsonKeys::FOLDER_BASE_DATA())
|
||||
result = new BaseData<FileManagement::DatabaseInterface, FileManagement::Database::FlmFolder>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == FileManagement::WebSocketInterface::JsonKeys::FILE_CONTENT_BASE_DATA())
|
||||
result = new BaseData<FileManagement::DatabaseInterface, FileManagement::Database::FlmFileContent>(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
else if (m_type == FileManagement::WebSocketInterface::JsonKeys::PDF_LIST_DATA())
|
||||
result = new PdfListMessage(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
||||
|
||||
return checkResult(client, message, result);
|
||||
}
|
||||
// ####### ClientMessageFactory end #######
|
||||
|
||||
// ####### ClientMessage begin #######
|
||||
ClientMessage::ClientMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
|
||||
: LtsWebSocket::AbstractClientMessage(client, type, typeId, uuid, data)
|
||||
, m_dataManager(dataManager)
|
||||
, m_logger(getLogger("ClientMessage"))
|
||||
{}
|
||||
// ####### ClientMessage end #######
|
||||
|
||||
// ####### ServicesInformation begin #######
|
||||
ErrorMessage::ErrorMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
|
||||
: ClientMessage(dataManager, client, type, typeId, uuid, data)
|
||||
{}
|
||||
|
||||
void ErrorMessage::process()
|
||||
{
|
||||
ErrorData err;
|
||||
err.errorClass = m_data.toObject().value(LtsWebSocket::JsonKeys::ERROR_CLASS()).toInt();
|
||||
err.uuid = m_data.toObject().value(LtsWebSocket::JsonKeys::UUID_()).toString();
|
||||
err.errorMessage = m_data.toObject().value(LtsWebSocket::JsonKeys::ERROR_MESSAGE()).toString();
|
||||
m_dataManager->handleErrorMessage(err);
|
||||
}
|
||||
|
||||
bool ErrorMessage::hasValidData() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// ####### ErrorMessage end #######
|
||||
|
||||
// ####### ServicesInformation begin #######
|
||||
ServicePortsInformation::ServicePortsInformation(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data)
|
||||
: ClientMessage(dataManager, client, type, typeId, uuid, data)
|
||||
{}
|
||||
|
||||
void ServicePortsInformation::process()
|
||||
{
|
||||
const QJsonArray exerciseInformationArray = m_data.toArray();
|
||||
QVector<ExerciseInformation> exercises;
|
||||
QVector<ServiceInformation> services;
|
||||
QVector<PortInformation> ports;
|
||||
exercises.reserve(exerciseInformationArray.size());
|
||||
|
||||
for (const auto &exerciseJsonValue : exerciseInformationArray)
|
||||
{
|
||||
QJsonObject exerciseJsonObject = exerciseJsonValue.toObject();
|
||||
ExerciseInformation exercise;
|
||||
|
||||
exercise.exerciseId = exerciseJsonObject.value(ServiceManagement::WebSocketInterface::JsonKeys::EXERCISE_ID()).toInt();
|
||||
if (exerciseJsonObject.contains(ServiceManagement::WebSocketInterface::JsonKeys::REPLAY_PARTITION_ID()))
|
||||
exercise.replayPartitionId = dds::core::optional<int32_t>(exerciseJsonObject.value(ServiceManagement::WebSocketInterface::JsonKeys::REPLAY_PARTITION_ID()).toInt());
|
||||
|
||||
const QJsonArray servicesJsonArray = exerciseJsonObject.value(ServiceManagement::WebSocketInterface::JsonKeys::SERVICES()).toArray();
|
||||
|
||||
// prepare vector
|
||||
services.clear();
|
||||
services.reserve(servicesJsonArray.size());
|
||||
|
||||
for (const auto &serviceValue : servicesJsonArray)
|
||||
{
|
||||
ServiceInformation service;
|
||||
QJsonObject serviceObject = serviceValue.toObject();
|
||||
|
||||
service.name = serviceObject.value(ServiceManagement::WebSocketInterface::JsonKeys::NAME()).toString();
|
||||
service.abbreviation = serviceObject.value(ServiceManagement::WebSocketInterface::JsonKeys::NAME_ABBR()).toString();
|
||||
|
||||
const QJsonArray portsJsonArray = serviceObject.value(ServiceManagement::WebSocketInterface::JsonKeys::PORTS()).toArray();
|
||||
|
||||
// prepare vector
|
||||
ports.clear();
|
||||
ports.reserve(portsJsonArray.size());
|
||||
|
||||
for (const auto &portValue : portsJsonArray)
|
||||
{
|
||||
QJsonObject portObject = portValue.toObject();
|
||||
PortInformation port;
|
||||
|
||||
port.number = portObject.value(ServiceManagement::WebSocketInterface::JsonKeys::NUMBER()).toInt();
|
||||
port.type = portObject.value(ServiceManagement::WebSocketInterface::JsonKeys::TYPE_ID()).toInt();
|
||||
|
||||
ports.append(port);
|
||||
}
|
||||
service.ports = ports;
|
||||
services.append(service);
|
||||
}
|
||||
exercise.services = services;
|
||||
exercises.append(exercise);
|
||||
}
|
||||
|
||||
m_dataManager->servicePortsInformation(exercises);
|
||||
}
|
||||
|
||||
bool ServicePortsInformation::hasValidData() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// ####### ServicesInformation end #######
|
||||
|
||||
// ####### BaseData begin #######
|
||||
template <typename DB, typename T>
|
||||
BaseData<DB, T>::BaseData(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, QJsonValue &data)
|
||||
: ClientMessage(dataManager, client, type, typeId, uuid, data)
|
||||
{}
|
||||
|
||||
template <typename DB, typename T>
|
||||
void BaseData<DB, T>::process()
|
||||
{
|
||||
m_dataManager->baseData<T>(DB::template fromJson<T>(m_data.toArray()));
|
||||
}
|
||||
|
||||
template <typename DB, typename T>
|
||||
bool BaseData<DB, T>::hasValidData() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// ####### BaseData end #######
|
||||
|
||||
// ####### PdfListData begin #######
|
||||
PdfListMessage::PdfListMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, QJsonValue &data)
|
||||
: ClientMessage(dataManager, client, type, typeId, uuid, data)
|
||||
{}
|
||||
|
||||
void PdfListMessage::process()
|
||||
{
|
||||
PdfListData data;
|
||||
|
||||
using namespace FileManagement::WebSocketInterface::JsonKeys;
|
||||
|
||||
if (m_data.isArray())
|
||||
{
|
||||
data.pdfData.reserve(m_data.toArray().size());
|
||||
|
||||
QJsonArray arr = m_data.toArray();
|
||||
|
||||
for (const QJsonValue ¤t : qAsConst(arr))
|
||||
{
|
||||
if (!current.isObject())
|
||||
continue;
|
||||
|
||||
QJsonObject obj = current.toObject();
|
||||
|
||||
data.pdfData.append({obj.value(FILE_ID()).toInt(),
|
||||
obj.value(NAME()).toString(),
|
||||
obj.value(FILE_SIZE()).toInt(),
|
||||
FileManagement::FileCategory::inner_enum(obj.value(FILE_CATEGORY()).toInt()),
|
||||
obj.value(IS_TEMPLATE()).toBool(),
|
||||
obj.value(PROPERTIES()),
|
||||
FileManagement::FileStatus::inner_enum(obj.value(FILE_STATUS()).toInt()),
|
||||
obj.value(FOLDER_ID()).toInt(),
|
||||
obj.value(PHASE_ID()).toInt(),
|
||||
obj.value(OPERATOR_ID()).toInt(),
|
||||
obj.value(EXERCISE_ID()).toInt()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
m_dataManager->handlePdfListMessage(data);
|
||||
}
|
||||
|
||||
bool PdfListMessage::hasValidData() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// ####### PdfListData end #######
|
||||
|
||||
} // namespace Messages
|
||||
} // namespace WebSocketInterface
|
||||
} // namespace OcBaseDownload
|
||||
@@ -0,0 +1,198 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* The ClientMessage class is an abstract base class for concrete ClientMessage objects
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Philipp Dassow, SLST, 2017-12-05
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QVector>
|
||||
|
||||
#include <DDS/Core/core.hpp>
|
||||
|
||||
#include <LtsWebSocket/client_message_factory.h>
|
||||
#include <LtsWebSocket/client_message.h>
|
||||
|
||||
#include <FileManagement/flm_enums.hpp>
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
namespace OcBaseDownload
|
||||
{
|
||||
namespace WebSocketInterface
|
||||
{
|
||||
class DataManager;
|
||||
|
||||
namespace Messages
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief The ClientMessageFactory class creates ClientMessages which will then be processed
|
||||
*/
|
||||
class ClientMessageFactory final : public LtsWebSocket::AbstractClientMessageFactory
|
||||
{
|
||||
public:
|
||||
explicit ClientMessageFactory(DataManager *dataManager);
|
||||
|
||||
/**
|
||||
* @brief create Only way to create a ClientMessage object
|
||||
* @param message Text message which will be converted to a ClientMessage object
|
||||
* @return A ClientMessage object, which represents a concrete ClientMessage
|
||||
*/
|
||||
LtsWebSocket::AbstractClientMessage *createMessage(LtsWebSocket::ReplyHandler *client,
|
||||
const QString &message);
|
||||
|
||||
private:
|
||||
DataManager *m_dataManager;
|
||||
|
||||
}; // class ClientMessageFactory
|
||||
|
||||
/**
|
||||
* @brief The ClientMessage class is an abstract base class for concrete ClientMessage objects
|
||||
*/
|
||||
class ClientMessage : public LtsWebSocket::AbstractClientMessage
|
||||
{
|
||||
protected: // method
|
||||
explicit ClientMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data = QJsonValue());
|
||||
|
||||
protected: // attributes
|
||||
DataManager *m_dataManager;
|
||||
LOGGER_T m_logger;
|
||||
}; // class ClientMessage
|
||||
|
||||
// ################## Message Implementations ##################
|
||||
class ErrorMessage : public ClientMessage
|
||||
{
|
||||
public:
|
||||
explicit ErrorMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data);
|
||||
|
||||
/**
|
||||
* @brief The ErrorData struct represents the data part of an ErrorMessage object
|
||||
*/
|
||||
struct ErrorData
|
||||
{
|
||||
int errorClass = 0;
|
||||
QString uuid;
|
||||
QString errorMessage;
|
||||
};
|
||||
|
||||
void process();
|
||||
bool hasValidData() const;
|
||||
};
|
||||
|
||||
class ServicePortsInformation : public ClientMessage
|
||||
{
|
||||
public:
|
||||
explicit ServicePortsInformation(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, const QJsonValue &data);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief The PortInformation struct holds the information what kind of port we have here
|
||||
*/
|
||||
struct PortInformation
|
||||
{
|
||||
int32_t number = 0;
|
||||
int32_t type = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ServiceInformation struct information about a service
|
||||
*/
|
||||
struct ServiceInformation
|
||||
{
|
||||
QString name;
|
||||
QString abbreviation;
|
||||
QVector<PortInformation> ports;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The ExerciseInformation struct with information about an exercise (could also be a replay)
|
||||
*/
|
||||
struct ExerciseInformation
|
||||
{
|
||||
int32_t exerciseId = 0;
|
||||
dds::core::optional<int32_t> replayPartitionId;
|
||||
QVector<ServiceInformation> services;
|
||||
};
|
||||
|
||||
void process();
|
||||
bool hasValidData() const;
|
||||
}; // class ServicesInformation
|
||||
|
||||
/**
|
||||
* @brief Handle a BaseData telegram
|
||||
*/
|
||||
template <typename DB, typename T>
|
||||
class BaseData final : public ClientMessage
|
||||
{
|
||||
public:
|
||||
explicit BaseData(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, QJsonValue &data);
|
||||
|
||||
void process();
|
||||
bool hasValidData() const;
|
||||
}; // class BaseData
|
||||
|
||||
/**
|
||||
* @brief Handle a PdfListData telegram
|
||||
*/
|
||||
class PdfListMessage : public ClientMessage
|
||||
{
|
||||
public:
|
||||
explicit PdfListMessage(DataManager *dataManager, LtsWebSocket::ReplyHandler *client, const QString &type, const int typeId, const QString &uuid, QJsonValue &data);
|
||||
|
||||
struct PdfInformation
|
||||
{
|
||||
int32_t id = -1;
|
||||
QString name;
|
||||
int fileSize = -1;
|
||||
FileManagement::FileCategory fileCategory = FileManagement::FileCategory::Global;
|
||||
bool isTemplate = false;
|
||||
QJsonValue properties;
|
||||
FileManagement::FileStatus fileStatus = FileManagement::FileStatus::Deleted;
|
||||
int folderId = -1;
|
||||
int phaseId = -1;
|
||||
int operatorId = -1;
|
||||
int exerciseId = -1;
|
||||
|
||||
PdfInformation() = default;
|
||||
PdfInformation(int32_t id,
|
||||
const QString &name,
|
||||
int fileSize,
|
||||
FileManagement::FileCategory fileCategory,
|
||||
bool isTemplate,
|
||||
const QJsonValue &properties,
|
||||
FileManagement::FileStatus fileStatus,
|
||||
int folderId,
|
||||
int phaseId,
|
||||
int operatorId,
|
||||
int exerciseId)
|
||||
: id(id)
|
||||
, name(name)
|
||||
, fileSize(fileSize)
|
||||
, fileCategory(fileCategory)
|
||||
, isTemplate(isTemplate)
|
||||
, properties(properties)
|
||||
, fileStatus(fileStatus)
|
||||
, folderId(folderId)
|
||||
, phaseId(phaseId)
|
||||
, operatorId(operatorId)
|
||||
, exerciseId(exerciseId)
|
||||
{}
|
||||
};
|
||||
|
||||
struct PdfListData
|
||||
{
|
||||
QVector<PdfInformation> pdfData;
|
||||
};
|
||||
|
||||
void process();
|
||||
bool hasValidData() const;
|
||||
}; // class PdfListData
|
||||
|
||||
} // namespace Messages
|
||||
} // namespace WebSocketInterface
|
||||
} // namespace OcBaseDownload
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @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 OcBaseDownload
|
||||
{
|
||||
namespace WebSocketInterface
|
||||
{
|
||||
namespace Messages
|
||||
{
|
||||
using namespace JsonKeys;
|
||||
using namespace LtsWebSocket::JsonKeys;
|
||||
|
||||
// ####### ServicePortsInformationRequest begin #######
|
||||
ServicePortsInformationRequest::ServicePortsInformationRequest(const QString &uuid)
|
||||
: ReplyMessage(ServiceManagement::WebSocketInterface::JsonKeys::SERVICE_PORTS_INFORMATION_REQUEST(), 6002, uuid)
|
||||
{}
|
||||
// ####### ServicePortsInformationRequest end #######
|
||||
|
||||
// ####### BaseDlRequest begin #######
|
||||
/************************************************************
|
||||
* Attention! TypeId 6006 is negotiated with ESG for ADLER! *
|
||||
************************************************************/
|
||||
BaseDlRequest::BaseDlRequest(const QString &uuid, int exerciseId)
|
||||
: LtsWebSocket::ReplyMessage(BASE_DL_REQUEST(), 6006, uuid) // Todo: Check whether typeId is correct
|
||||
{
|
||||
if (0 < exerciseId)
|
||||
{
|
||||
QJsonObject data;
|
||||
data.insert(EXERCISE_ID(), QJsonValue(exerciseId));
|
||||
m_jsonRepresentation.insert(DATA(), data);
|
||||
}
|
||||
}
|
||||
// ####### BaseDlRequest end #######
|
||||
|
||||
// ####### PdfListRequest begin #######
|
||||
PdfListRequest::PdfListRequest(const QString &uuid, int exerciseId)
|
||||
: LtsWebSocket::ReplyMessage(PDF_LIST_REQUEST(), 2, uuid) // Todo: Check whether typeId is correct
|
||||
{
|
||||
if (0 < exerciseId)
|
||||
{
|
||||
QJsonObject data;
|
||||
data.insert(EXERCISE_ID(), QJsonValue(exerciseId));
|
||||
m_jsonRepresentation.insert(DATA(), data);
|
||||
}
|
||||
}
|
||||
// ####### PdfListRequest end #######
|
||||
|
||||
} // namespace Messages
|
||||
} // namespace WebSocketInterface
|
||||
} // namespace OcBaseDownload
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <LtsWebSocket/client_message_factory.h>
|
||||
|
||||
#include <DDS/Core/core.hpp>
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
|
||||
#include <QtCore/QVector>
|
||||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QJsonArray>
|
||||
|
||||
namespace OcBaseDownload
|
||||
{
|
||||
namespace WebSocketInterface
|
||||
{
|
||||
namespace Messages
|
||||
{
|
||||
/**
|
||||
* @brief The ServicePortsInformationRequest class
|
||||
*/
|
||||
class ServicePortsInformationRequest : public LtsWebSocket::ReplyMessage
|
||||
{
|
||||
public:
|
||||
explicit ServicePortsInformationRequest(const QString &uuid);
|
||||
}; // class ServicePortsInformationRequest
|
||||
|
||||
/**
|
||||
* @brief The BaseDlRequest class
|
||||
*/
|
||||
class BaseDlRequest : public LtsWebSocket::ReplyMessage
|
||||
{
|
||||
public:
|
||||
explicit BaseDlRequest(const QString &uuid, int exerciseId);
|
||||
}; // class BaseDlRequest
|
||||
|
||||
/**
|
||||
* @brief The BaseDlRequest class
|
||||
*/
|
||||
class PdfListRequest : public LtsWebSocket::ReplyMessage
|
||||
{
|
||||
public:
|
||||
explicit PdfListRequest(const QString &uuid, int exerciseId);
|
||||
}; // class PdfListRequest
|
||||
|
||||
} // namespace Messages
|
||||
} // namespace WebSocketInterface
|
||||
} // namespace OcBaseDownload
|
||||
|
||||
Reference in new issue
Block a user