Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+38
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Logging for SAAInterfaceAdapterAdler Plugin
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
|
||||
namespace SAAInterfaceAdapterAdler
|
||||
{
|
||||
|
||||
LOGGER_T getLogger(const char *name)
|
||||
{
|
||||
static const char ns[] = "SAA.";
|
||||
std::string loggerName;
|
||||
const size_t len = strlen(name);
|
||||
loggerName.reserve(sizeof(ns) + len);
|
||||
loggerName.append(ns, sizeof(ns) - 1);
|
||||
loggerName.append(name, len);
|
||||
|
||||
try
|
||||
{
|
||||
return NGL::NGLLoggerBootstrap::getNGLRootLogger().
|
||||
getNGLLogger(loggerName);
|
||||
}
|
||||
catch (const std::exception &ex)
|
||||
{
|
||||
fprintf(stderr, "Error retrieving logger: %s", ex.what());
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace EffectManagement
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Logging for SAAInterfaceAdapterAdler Plugin
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <NGLLogger/INGLLogger.h>
|
||||
|
||||
|
||||
namespace SAAInterfaceAdapterAdler
|
||||
{
|
||||
|
||||
using LOGGER_T = NGL::INGLLogger &;
|
||||
|
||||
LOGGER_T getLogger(const char *name);
|
||||
|
||||
inline LOGGER_T getLogger(const QString &loggerName)
|
||||
{
|
||||
return getLogger(loggerName.toUtf8().constData());
|
||||
}
|
||||
|
||||
} // namespace EffectManagement
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#pragma once
|
||||
|
||||
#include <QProcess>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <ParticipantManagement/ppm_enums.hpp>
|
||||
|
||||
namespace SAAUtils
|
||||
{
|
||||
|
||||
struct PingItem
|
||||
{
|
||||
int assetId = -1;
|
||||
QString host;
|
||||
int port;
|
||||
QProcess *process = nullptr;
|
||||
bool reachable = false;
|
||||
bool connected = false;
|
||||
};
|
||||
|
||||
struct AsmAssetProps
|
||||
{
|
||||
AsmAssetProps(const QString &properties)
|
||||
{
|
||||
if (properties.isEmpty())
|
||||
return;
|
||||
const QJsonObject propObj = QJsonDocument::fromJson(properties.toUtf8()).object();
|
||||
if (propObj.contains(QStringLiteral("credentials")) )
|
||||
{
|
||||
const QJsonObject adlerObj = propObj[QStringLiteral("credentials")].toObject();
|
||||
exId = propObj.value(QStringLiteral("exerciseId")).toInt(-1);
|
||||
userName = adlerObj.value(QStringLiteral("username")).toString();
|
||||
password = adlerObj.value(QStringLiteral("password")).toString();
|
||||
host = adlerObj.value(QStringLiteral("host")).toString();
|
||||
port = adlerObj.value(QStringLiteral("port")).toInt(-1);
|
||||
}
|
||||
|
||||
}
|
||||
bool hasCredential() const { return (!userName.isEmpty() && !password.isEmpty()); }
|
||||
bool hasExerciseId() const { return exId > 0;}
|
||||
QString userName;
|
||||
QString password;
|
||||
QString host;
|
||||
int port=-1;
|
||||
int exId = -1;
|
||||
};
|
||||
|
||||
struct SaaProps
|
||||
{
|
||||
SaaProps(const QString &properties)
|
||||
{
|
||||
if ( properties.isEmpty())
|
||||
return;
|
||||
const QJsonObject propertiesObj = QJsonDocument::fromJson(properties.toUtf8()).object();
|
||||
if (!propertiesObj.contains(QStringLiteral("Adler")) )
|
||||
return;
|
||||
const QJsonObject adlerObj = propertiesObj[QStringLiteral("Adler")].toObject();
|
||||
isConnected = (adlerObj.value(QStringLiteral("saaConnectedState")).toInt() == ParticipantManagement::ConnectState::Connected);
|
||||
name = adlerObj.value(QStringLiteral("SaaName")).toString(QStringLiteral(""));
|
||||
assetId = adlerObj.value(QStringLiteral("assetId")).toInt(-1);
|
||||
}
|
||||
bool hasAsset() const { return assetId > 0; }
|
||||
QString name;
|
||||
QString ipAdress;
|
||||
int assetId = -1;
|
||||
bool isConnected = false;
|
||||
};
|
||||
|
||||
|
||||
} // namespace SAAUtils
|
||||
Reference in new issue
Block a user