2017-12-20 14:54:05 +01:00
|
|
|
/*!
|
2018-03-28 15:10:51 +02:00
|
|
|
* \copyright Copyright (c) 2017-2018 Governikus GmbH & Co. KG, Germany
|
2017-12-20 14:54:05 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "RemoteConnector.h"
|
|
|
|
|
|
|
|
#include "Initializer.h"
|
|
|
|
|
|
|
|
#include <QWebSocket>
|
|
|
|
|
|
|
|
using namespace governikus;
|
|
|
|
|
|
|
|
|
|
|
|
static Initializer::Entry E([] {
|
|
|
|
qRegisterMetaType<QHostAddress>("QHostAddress");
|
|
|
|
qRegisterMetaType<RemoteErrorCode>("RemoteErrorCode");
|
|
|
|
qRegisterMetaType<QSharedPointer<QWebSocket> >("QSharedPointer<QWebSocket>");
|
|
|
|
qRegisterMetaType<QAbstractSocket::SocketState>("QAbstractSocket::SocketState");
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
RemoteConnector::RemoteConnector()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GlobalStatus RemoteConnector::errorToGlobalStatus(RemoteErrorCode pDeviceError)
|
|
|
|
{
|
|
|
|
switch (pDeviceError)
|
|
|
|
{
|
|
|
|
case RemoteErrorCode::INVALID_REQUEST:
|
|
|
|
return GlobalStatus::Code::RemoteConnector_InvalidRequest;
|
|
|
|
|
|
|
|
case RemoteErrorCode::EMPTY_PASSWORD:
|
|
|
|
return GlobalStatus::Code::RemoteConnector_EmptyPassword;
|
|
|
|
|
|
|
|
case RemoteErrorCode::NO_SUPPORTED_API_LEVEL:
|
|
|
|
return GlobalStatus::Code::RemoteConnector_NoSupportedApiLevel;
|
|
|
|
|
|
|
|
case RemoteErrorCode::CONNECTION_TIMEOUT:
|
|
|
|
return GlobalStatus::Code::RemoteConnector_ConnectionTimeout;
|
|
|
|
|
|
|
|
case RemoteErrorCode::CONNECTION_ERROR:
|
|
|
|
return GlobalStatus::Code::RemoteConnector_ConnectionError;
|
|
|
|
|
|
|
|
case RemoteErrorCode::REMOTE_HOST_REFUSED_CONNECTION:
|
|
|
|
return GlobalStatus::Code::RemoteConnector_RemoteHostRefusedConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
Q_UNREACHABLE();
|
|
|
|
}
|