Bring the validation-scope line (in-tree Jenkins CI copy, lcov coverage wiring, step-by-step release-scope README, TetraIF unit tests, the LogView runtime icon/resource fix, Dockerfile, rpmbuild and the new_docker_build.sh driver with the DEB output path) on top of the XmlPatterns branch pruned to the Release 2 scope. Conflict policy: - Out-of-scope targets/modules: keep the prune (deletion wins). - In-scope files that validation had deleted: restored from story/release-2-cleanup (the Release 2 closure, with the pruned-module guards). - In-scope sources carrying migration work: XmlPatterns versions (Qt XmlPatterns rework on QDomDocument, DDS member and logger fixes, first-build fixes). - Scope-aware CMakeLists (top level, PluginInterfaces, LtsWidgets) and .envrc: story/release-2-cleanup / ours versions.
75 lines
2.1 KiB
C++
Executable File
75 lines
2.1 KiB
C++
Executable File
/**
|
|
* @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 "WebSocketInterface/Messages/reply_message.h"
|
|
#include "WebSocketInterface/json_keys.h"
|
|
#include "WebSocketInterface/data_manager.h"
|
|
|
|
#include <NGLLogger/NGLLoggerBootstrap.h>
|
|
|
|
#include <QtCore/QJsonDocument>
|
|
#include <QtCore/QUuid>
|
|
|
|
namespace TrainingAreaBase
|
|
{
|
|
namespace WebSocketInterface
|
|
{
|
|
namespace ClientMessages
|
|
{
|
|
using namespace JsonKeys;
|
|
|
|
|
|
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 == WebSocketInterface::JsonKeys::SEND_BITE_REQUEST())
|
|
result = new SendBiteRequest(m_dataManager, client, m_type, m_typeId, m_uuid, m_data);
|
|
|
|
return checkResult(client, message, result);
|
|
}
|
|
|
|
|
|
|
|
|
|
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(NGL::NGLLoggerBootstrap::getNGLRootLogger())
|
|
{}
|
|
|
|
|
|
|
|
SendBiteRequest::SendBiteRequest(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 SendBiteRequest::process()
|
|
{
|
|
m_client->addReply(m_dataManager->sendBiteRequest(m_uuid, m_data.toObject().value(WebSocketInterface::JsonKeys::EQUIP_NO()).toInt()));
|
|
}
|
|
|
|
bool SendBiteRequest::hasValidData() const
|
|
{
|
|
return true;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|