Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,53 @@
|
||||
#include "message_factory.h"
|
||||
#include "messages.h"
|
||||
#include "json_keys.h"
|
||||
|
||||
#include <LtsWebSocket/client_message.h>
|
||||
#include <LtsWebSocket/json_keys.h>
|
||||
|
||||
#include <QUuid>
|
||||
|
||||
namespace LtsProjectionWorkstation
|
||||
{
|
||||
|
||||
LtsWebSocket::AbstractClientMessage *MessageFactory::createMessage(LtsWebSocket::ReplyHandler *client, const QString &message)
|
||||
{
|
||||
// because this factory is used for server AND client the uuid has to be set in error case
|
||||
// if not this would lead to infinite sending of error messages
|
||||
if (m_uuid.isEmpty())
|
||||
{
|
||||
WARNING_LOG(m_logger) << "Got message without uuid: " << message << "'";
|
||||
WARNING_LOG(m_logger) << "Created UUID for error message!";
|
||||
return new ErrorMessage(QUuid::createUuid().toString(), QStringLiteral("Got message without uuid"));
|
||||
}
|
||||
|
||||
LtsWebSocket::AbstractClientMessage *result = checkAttributes(client, message);
|
||||
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
if (m_type == JsonKeys::DEDICAED_DISCONNECT())
|
||||
result = new STC::DedicatedDisconnect(m_handler, client, m_type, m_uuid, m_data);
|
||||
|
||||
if (m_type == JsonKeys::LOGIN_REPLY())
|
||||
result = new STC::LoginRequestReply(m_handler, client, m_type, m_uuid, m_data);
|
||||
|
||||
if (m_type == JsonKeys::LOGOUT_REPLY())
|
||||
result = new STC::LoginRequestReply(m_handler, client, m_type, m_uuid, m_data);
|
||||
|
||||
if (m_type == JsonKeys::LOGIN_REQUEST())
|
||||
result = new CTS::LoginRequest(m_handler, client, m_type, m_uuid, m_data);
|
||||
|
||||
if (m_type == JsonKeys::LOGOUT_REQUEST())
|
||||
result = new CTS::LogoutRequest(m_handler, client, m_type, m_uuid, m_data);
|
||||
|
||||
if (m_type == JsonKeys::DISCONNECT_REQUEST())
|
||||
result = new CTS::DisconnectRequest(m_handler, client, m_type, m_uuid, m_data);
|
||||
|
||||
if (m_type == LtsWebSocket::JsonKeys::ERROR_())
|
||||
return nullptr;
|
||||
|
||||
return checkResult(client, message, result);
|
||||
}
|
||||
|
||||
} // namespace LtsProjectionWorkstation
|
||||
Reference in new issue
Block a user