Add experience mode plugins

This commit is contained in:
Michael Zanetti 2019-10-10 11:39:51 +02:00
parent 5e3bc2acbd
commit f1ca2a5b86
8 changed files with 66 additions and 2 deletions

View File

@ -0,0 +1,11 @@
#include "experiencemanager.h"
#include "jsonrpc/jsonrpcserver.h"
namespace nymeaserver {
ExperienceManager::ExperienceManager(JsonRPCServer *jsonRpcServer, QObject *parent) : QObject(parent)
{
// jsonRpcServer->registerHandler();
}
}

View File

@ -0,0 +1,22 @@
#ifndef EXPERIENCEMANAGER_H
#define EXPERIENCEMANAGER_H
#include <QObject>
namespace nymeaserver {
class JsonRPCServer;
class ExperienceManager : public QObject
{
Q_OBJECT
public:
explicit ExperienceManager(JsonRPCServer *jsonRpcServer, QObject *parent = nullptr);
signals:
public slots:
};
}
#endif // EXPERIENCEMANAGER_H

View File

@ -71,6 +71,8 @@ public:
void registerTransportInterface(TransportInterface *interface, bool authenticationRequired); void registerTransportInterface(TransportInterface *interface, bool authenticationRequired);
void unregisterTransportInterface(TransportInterface *interface); void unregisterTransportInterface(TransportInterface *interface);
void registerHandler(JsonHandler *handler);
private: private:
QHash<QString, JsonHandler *> handlers() const; QHash<QString, JsonHandler *> handlers() const;
@ -117,8 +119,6 @@ private:
int m_notificationId; int m_notificationId;
void registerHandler(JsonHandler *handler);
QString formatAssertion(const QString &targetNamespace, const QString &method, QMetaMethod::MethodType methodType, JsonHandler *handler, const QVariantMap &data) const; QString formatAssertion(const QString &targetNamespace, const QString &method, QMetaMethod::MethodType methodType, JsonHandler *handler, const QVariantMap &data) const;
}; };

View File

@ -18,6 +18,7 @@ RESOURCES += $$top_srcdir/icons.qrc \
HEADERS += nymeacore.h \ HEADERS += nymeacore.h \
devices/devicemanagerimplementation.h \ devices/devicemanagerimplementation.h \
devices/translator.h \ devices/translator.h \
experiences/experiencemanager.h \
ruleengine/ruleengine.h \ ruleengine/ruleengine.h \
ruleengine/rule.h \ ruleengine/rule.h \
ruleengine/stateevaluator.h \ ruleengine/stateevaluator.h \
@ -95,6 +96,7 @@ HEADERS += nymeacore.h \
SOURCES += nymeacore.cpp \ SOURCES += nymeacore.cpp \
devices/devicemanagerimplementation.cpp \ devices/devicemanagerimplementation.cpp \
devices/translator.cpp \ devices/translator.cpp \
experiences/experiencemanager.cpp \
ruleengine/ruleengine.cpp \ ruleengine/ruleengine.cpp \
ruleengine/rule.cpp \ ruleengine/rule.cpp \
ruleengine/stateevaluator.cpp \ ruleengine/stateevaluator.cpp \

View File

@ -171,6 +171,9 @@ void NymeaCore::init() {
qCDebug(dcApplication) << "Creating Cloud Manager"; qCDebug(dcApplication) << "Creating Cloud Manager";
m_cloudManager = new CloudManager(m_configuration, m_networkManager, this); m_cloudManager = new CloudManager(m_configuration, m_networkManager, this);
qCDebug(dcApplication()) << "Loading experiences";
CloudNotifications *cloudNotifications = m_cloudManager->createNotificationsPlugin(); CloudNotifications *cloudNotifications = m_cloudManager->createNotificationsPlugin();
m_deviceManager->registerStaticPlugin(cloudNotifications, cloudNotifications->metaData()); m_deviceManager->registerStaticPlugin(cloudNotifications, cloudNotifications->metaData());

View File

@ -0,0 +1,6 @@
#include "experienceplugin.h"
ExperiencePlugin::ExperiencePlugin(QObject *parent) : JsonHandler(parent)
{
}

View File

@ -0,0 +1,18 @@
#ifndef EXPERIENCEPLUGIN_H
#define EXPERIENCEPLUGIN_H
#include <QObject>
#include "jsonrpc/jsonhandler.h"
class ExperiencePlugin : public JsonHandler
{
Q_OBJECT
public:
explicit ExperiencePlugin(QObject *parent = nullptr);
signals:
public slots:
};
#endif // EXPERIENCEPLUGIN_H

View File

@ -26,6 +26,7 @@ HEADERS += \
devices/browseresult.h \ devices/browseresult.h \
jsonrpc/jsonhandler.h \ jsonrpc/jsonhandler.h \
jsonrpc/jsonreply.h \ jsonrpc/jsonreply.h \
experiences/experienceplugin.h \
libnymea.h \ libnymea.h \
platform/package.h \ platform/package.h \
platform/repository.h \ platform/repository.h \
@ -102,6 +103,7 @@ SOURCES += \
devices/browseresult.cpp \ devices/browseresult.cpp \
jsonrpc/jsonhandler.cpp \ jsonrpc/jsonhandler.cpp \
jsonrpc/jsonreply.cpp \ jsonrpc/jsonreply.cpp \
experiences/experienceplugin.cpp \
loggingcategories.cpp \ loggingcategories.cpp \
nymeasettings.cpp \ nymeasettings.cpp \
platform/package.cpp \ platform/package.cpp \