/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2016 Simon Stürz * * * * This file is part of guh. * * * * Guh is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, version 2 of the License. * * * * Guh is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with guh. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "cloudconnectionhandler.h" #include "loggingcategories.h" #include "guhcore.h" namespace guhserver { CloudConnectionHandler::CloudConnectionHandler(QObject *parent) : CloudJsonHandler(parent) { } QString CloudConnectionHandler::nameSpace() const { return "Connection"; } void CloudConnectionHandler::processGetConnections(const QVariantMap ¶ms) { Q_UNUSED(params) } void CloudConnectionHandler::processGetTunnels(const QVariantMap ¶ms) { foreach (const QVariant &tunnelVariant, params.value("tunnel").toList()) { QVariantMap tunnelMap = tunnelVariant.toMap(); QUuid tunnelId = tunnelMap.value("id").toUuid(); QUuid serverId = tunnelMap.value("serverConnection").toMap().value("id").toUuid(); QUuid clientId = tunnelMap.value("clientConnection").toMap().value("id").toUuid(); GuhCore::instance()->cloudManager()->onTunnelAdded(tunnelId, serverId, clientId); } } void CloudConnectionHandler::processSendData(const QVariantMap ¶ms) { Q_UNUSED(params) } void CloudConnectionHandler::processConnectionAdded(const QVariantMap ¶ms) { Q_UNUSED(params) } void CloudConnectionHandler::processConnectionRemoved(const QVariantMap ¶ms) { Q_UNUSED(params) } void CloudConnectionHandler::processTunnelAdded(const QVariantMap ¶ms) { QVariantMap tunnelMap = params.value("tunnel").toMap(); QUuid tunnelId = tunnelMap.value("id").toUuid(); QUuid serverId = tunnelMap.value("serverConnection").toMap().value("id").toUuid(); QUuid clientId = tunnelMap.value("clientConnection").toMap().value("id").toUuid(); GuhCore::instance()->cloudManager()->onTunnelAdded(tunnelId, serverId, clientId); } void CloudConnectionHandler::processTunnelRemoved(const QVariantMap ¶ms) { QUuid tunnelId = params.value("tunnelId").toUuid(); GuhCore::instance()->cloudManager()->onTunnelRemoved(tunnelId); } void CloudConnectionHandler::processDataReceived(const QVariantMap ¶ms) { QUuid tunnelId = params.value("tunnelId").toUuid(); GuhCore::instance()->cloudManager()->onCloudDataReceived(tunnelId, params.value("data").toMap()); } }