Provide access to the experience manager and offer possiblity for loading own plugin instance
This commit is contained in:
parent
3e1e7b5a01
commit
0615808ee4
@ -48,6 +48,11 @@ ExperienceManager::ExperienceManager(ThingManager *thingManager, JsonRPCServer *
|
|||||||
staticMetaObject.invokeMethod(this, "loadPlugins", Qt::QueuedConnection);
|
staticMetaObject.invokeMethod(this, "loadPlugins", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<ExperiencePlugin *> ExperienceManager::plugins() const
|
||||||
|
{
|
||||||
|
return m_plugins;
|
||||||
|
}
|
||||||
|
|
||||||
void ExperienceManager::loadPlugins()
|
void ExperienceManager::loadPlugins()
|
||||||
{
|
{
|
||||||
foreach (const QString &path, pluginSearchDirs()) {
|
foreach (const QString &path, pluginSearchDirs()) {
|
||||||
@ -107,4 +112,12 @@ void ExperienceManager::loadExperiencePlugin(const QString &file)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExperienceManager::loadExperiencePlugin(ExperiencePlugin *experiencePlugin)
|
||||||
|
{
|
||||||
|
qCDebug(dcExperiences()) << "Adding experience plugin:" << experiencePlugin;
|
||||||
|
m_plugins.append(experiencePlugin);
|
||||||
|
experiencePlugin->setParent(this);
|
||||||
|
experiencePlugin->initPlugin(m_thingManager, m_jsonRpcServer);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,24 +45,22 @@ class ExperienceManager : public QObject
|
|||||||
public:
|
public:
|
||||||
explicit ExperienceManager(ThingManager *thingManager, JsonRPCServer *jsonRpcServer, QObject *parent = nullptr);
|
explicit ExperienceManager(ThingManager *thingManager, JsonRPCServer *jsonRpcServer, QObject *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
QList<ExperiencePlugin *> plugins() const;
|
||||||
|
|
||||||
public slots:
|
// This method is used for testing
|
||||||
|
void loadExperiencePlugin(ExperiencePlugin *experiencePlugin);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void loadPlugins();
|
void loadPlugins();
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList pluginSearchDirs() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThingManager *m_thingManager = nullptr;
|
ThingManager *m_thingManager = nullptr;
|
||||||
JsonRPCServer *m_jsonRpcServer = nullptr;
|
JsonRPCServer *m_jsonRpcServer = nullptr;
|
||||||
|
QList<ExperiencePlugin *> m_plugins;
|
||||||
|
|
||||||
|
QStringList pluginSearchDirs() const;
|
||||||
void loadExperiencePlugin(const QString &file);
|
void loadExperiencePlugin(const QString &file);
|
||||||
|
|
||||||
private:
|
|
||||||
QList<ExperiencePlugin*> m_plugins;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -665,6 +665,11 @@ ModbusRtuManager *NymeaCore::modbusRtuManager() const
|
|||||||
return m_modbusRtuManager;
|
return m_modbusRtuManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExperienceManager *NymeaCore::experienceManager() const
|
||||||
|
{
|
||||||
|
return m_experienceManager;
|
||||||
|
}
|
||||||
|
|
||||||
void NymeaCore::onEventTriggered(const Event &event)
|
void NymeaCore::onEventTriggered(const Event &event)
|
||||||
{
|
{
|
||||||
emit eventTriggered(event);
|
emit eventTriggered(event);
|
||||||
|
|||||||
@ -110,6 +110,7 @@ public:
|
|||||||
Platform *platform() const;
|
Platform *platform() const;
|
||||||
ZigbeeManager *zigbeeManager() const;
|
ZigbeeManager *zigbeeManager() const;
|
||||||
ModbusRtuManager *modbusRtuManager() const;
|
ModbusRtuManager *modbusRtuManager() const;
|
||||||
|
ExperienceManager *experienceManager() const;
|
||||||
|
|
||||||
static QStringList getAvailableLanguages();
|
static QStringList getAvailableLanguages();
|
||||||
static QStringList loggingFilters();
|
static QStringList loggingFilters();
|
||||||
|
|||||||
Reference in New Issue
Block a user