80 lines
2.8 KiB
C++
Executable File
80 lines
2.8 KiB
C++
Executable File
/**
|
|
* @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>
|
|
|
|
namespace ExerciseManagement
|
|
{
|
|
namespace WebSocketInterface
|
|
{
|
|
namespace Messages
|
|
{
|
|
using namespace JsonKeys;
|
|
using namespace LtsWebSocket::JsonKeys;
|
|
|
|
// ####### ExercisePhaseBaseData begin #######
|
|
ExercisePhaseBaseData::ExercisePhaseBaseData(const QJsonArray &data, const QString &uuid)
|
|
: LtsWebSocket::ReplyMessage (EXERCISE_PHASE_BASE_DATA(), 1, uuid) // Todo: Check whether typeId is correct
|
|
{
|
|
m_jsonRepresentation.insert(DATA(), data);
|
|
}
|
|
// ####### ExercisePhaseBaseData begin #######
|
|
|
|
// ####### ExerciseStateChangeBaseData begin #######
|
|
ExerciseStateChangeBaseData::ExerciseStateChangeBaseData(const QJsonArray &data, const QString &uuid)
|
|
: LtsWebSocket::ReplyMessage (EXERCISE_STATE_CHANGE_BASE_DATA(), 2, uuid) // Todo: Check whether typeId is correct
|
|
{
|
|
m_jsonRepresentation.insert(DATA(), data);
|
|
}
|
|
// ####### ExerciseStateChangeBaseData begin #######
|
|
|
|
// ####### ExerciseBaseData begin #######
|
|
ExerciseBaseData::ExerciseBaseData(const QJsonArray &data, const QString &uuid)
|
|
: LtsWebSocket::ReplyMessage (EXERCISE_BASE_DATA(), 3, uuid) // Todo: Check whether typeId is correct
|
|
{
|
|
m_jsonRepresentation.insert(DATA(), data);
|
|
}
|
|
|
|
/**************************************************************
|
|
* Attention: 6004 is negotiated with ESG for use with ADLER! *
|
|
**************************************************************/
|
|
ExerciseInformationMessage::ExerciseInformationMessage(const QVector<ExInformation> &data, const QString &uuid)
|
|
: ReplyMessage (EXERCISE_INFORMATION(), 6004, uuid) // Todo: Check whether typeId is correct
|
|
{
|
|
QJsonArray exercises;
|
|
for (const auto &exercise : data)
|
|
{
|
|
QJsonObject ex;
|
|
ex.insert(QStringLiteral("id"), exercise.exerciseId);
|
|
ex.insert(QStringLiteral("name"), exercise.name);
|
|
ex.insert(QStringLiteral("beginTime"), exercise.beginTime);
|
|
ex.insert(QStringLiteral("endTime"), exercise.endTime);
|
|
ex.insert(QStringLiteral("startTime"), exercise.startTime);
|
|
ex.insert(QStringLiteral("stopTime"), exercise.stopTime);
|
|
ex.insert(QStringLiteral("timeZone"), exercise.timeZone);
|
|
ex.insert(QStringLiteral("status"), exercise.status);
|
|
ex.insert(QStringLiteral("description"), exercise.description);
|
|
ex.insert(QStringLiteral("trainingAreaId"), exercise.trainingAreaId);
|
|
|
|
exercises.append(ex);
|
|
}
|
|
|
|
m_jsonRepresentation.insert(DATA(), exercises);
|
|
}
|
|
|
|
// ####### ExerciseBaseData begin #######
|
|
|
|
} // namespace Messages
|
|
} // namespace WebSocketInterface
|
|
} // namespace ExerciseManagement
|