mirror of https://github.com/nymea/nymea.git
Provide access to the experience manager and offer possiblity for loading own plugin instance
parent
3e1e7b5a01
commit
0615808ee4
|
|
@ -48,6 +48,11 @@ ExperienceManager::ExperienceManager(ThingManager *thingManager, JsonRPCServer *
|
|||
staticMetaObject.invokeMethod(this, "loadPlugins", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QList<ExperiencePlugin *> ExperienceManager::plugins() const
|
||||
{
|
||||
return m_plugins;
|
||||
}
|
||||
|
||||
void ExperienceManager::loadPlugins()
|
||||
{
|
||||
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:
|
||||
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:
|
||||
void loadPlugins();
|
||||
|
||||
private:
|
||||
QStringList pluginSearchDirs() const;
|
||||
|
||||
private:
|
||||
ThingManager *m_thingManager = nullptr;
|
||||
JsonRPCServer *m_jsonRpcServer = nullptr;
|
||||
QList<ExperiencePlugin *> m_plugins;
|
||||
|
||||
QStringList pluginSearchDirs() const;
|
||||
void loadExperiencePlugin(const QString &file);
|
||||
|
||||
private:
|
||||
QList<ExperiencePlugin*> m_plugins;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -665,6 +665,11 @@ ModbusRtuManager *NymeaCore::modbusRtuManager() const
|
|||
return m_modbusRtuManager;
|
||||
}
|
||||
|
||||
ExperienceManager *NymeaCore::experienceManager() const
|
||||
{
|
||||
return m_experienceManager;
|
||||
}
|
||||
|
||||
void NymeaCore::onEventTriggered(const Event &event)
|
||||
{
|
||||
emit eventTriggered(event);
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ public:
|
|||
Platform *platform() const;
|
||||
ZigbeeManager *zigbeeManager() const;
|
||||
ModbusRtuManager *modbusRtuManager() const;
|
||||
ExperienceManager *experienceManager() const;
|
||||
|
||||
static QStringList getAvailableLanguages();
|
||||
static QStringList loggingFilters();
|
||||
|
|
|
|||
Loading…
Reference in New Issue