Merge PR #540: Provide experience manager access in core instance

This commit is contained in:
jenkins 2022-08-26 12:57:45 +02:00
commit c4ea75a809
30 changed files with 125 additions and 116 deletions

136
debian/control vendored
View File

@ -1,7 +1,7 @@
Source: nymea Source: nymea
Section: utils Section: utils
Priority: optional Priority: optional
Maintainer: Nymea GmbH <developer@nymea.io> Maintainer: nymea GmbH <developer@nymea.io>
Standards-Version: 3.9.7 Standards-Version: 3.9.7
Homepage: https://nymea.io Homepage: https://nymea.io
Vcs-Git: https://github.com/nymea/nymea.git Vcs-Git: https://github.com/nymea/nymea.git
@ -30,6 +30,7 @@ Build-Depends: debhelper (>= 9.0.0),
libqt5serialport5-dev, libqt5serialport5-dev,
libqt5serialbus5-dev libqt5serialbus5-dev
Package: nymea Package: nymea
Architecture: any Architecture: any
Section: metapackages Section: metapackages
@ -39,13 +40,9 @@ Depends: nymead (= ${binary:Version}),
Recommends: qml-module-qtquick2 Recommends: qml-module-qtquick2
Suggests: nymea-doc Suggests: nymea-doc
Description: An open source IoT server - meta package Description: An open source IoT server - meta package
The nymea daemon is a plugin based IoT (Internet of Things) server. The The nymea daemon is a plugin based IoT (Internet of Things) server.
server works like a translator for devices, things and services and The server works like a translator for devices, things and services
allows them to interact. and allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install the server and the default plugins.
Package: nymead Package: nymead
@ -65,29 +62,18 @@ Recommends: nymea-cli,
nymea-zeroconf-plugin-impl, nymea-zeroconf-plugin-impl,
nymea-apikeysprovider-plugin-impl, nymea-apikeysprovider-plugin-impl,
Description: An open source IoT server - daemon Description: An open source IoT server - daemon
The nymea daemon is a plugin based IoT (Internet of Things) server. The The nymea daemon is a plugin based IoT (Internet of Things) server.
server works like a translator for devices, things and services and The server works like a translator for devices, things and services
allows them to interact. and allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install the daemon.
Package: nymea-data Package: nymea-data
Section: misc Section: misc
Architecture: all Architecture: all
Depends: ${misc:Depends} Depends: ${misc:Depends}
Recommends: nymea Recommends: nymead
Description: Optional data for extending functionality in nymea daemon Description: Optional data for extending functionality in nymea daemon - data
The nymea daemon is a plugin based IoT (Internet of Things) server. The Provides application data used by nymea:core
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package provides the MAC address database for nymead and for the plugins in
order to get the manufacturer name for a given MAC address.
Package: nymea-doc Package: nymea-doc
@ -96,14 +82,8 @@ Architecture: all
Depends: ${misc:Depends} Depends: ${misc:Depends}
Recommends: nymea Recommends: nymea
Build-Profiles: <!nodoc> Build-Profiles: <!nodoc>
Description: Documentation for the nymea package (on-site) - documentation Description: Documentation for the nymea library - documentation
The nymea daemon is a plugin based IoT (Internet of Things) server. The This package contains documentation for developing nymea plugins.
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package contains documentation for developing nymea.
Package: nymea-translations Package: nymea-translations
@ -111,14 +91,32 @@ Section: misc
Architecture: all Architecture: all
Depends: ${misc:Depends} Depends: ${misc:Depends}
Recommends: nymea Recommends: nymea
Description: Translation files for nymead and plugins - translations Description: Translation files for nymead - translations
The nymea daemon is a plugin based IoT (Internet of Things) server. The Translation files for the nymea daemon.
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available Package: libnymea-tests
in the system and create individual scenes and behaviors for your environment. Section: libs
. Architecture: any
This package provides the translation files for nymead and for the plugins. Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
libnymea-core (= ${binary:Version})
Description: nymea-tests library - library
Shared resources for nymea-tests.
Package: libnymea-tests-dev
Section: libdevel
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
libnymea-tests (= ${binary:Version}),
libnymea-core-dev (= ${binary:Version})
Description: nymea-tests library - development files
Provides the nymea-tests development files for building
automated tests.
Package: nymea-tests Package: nymea-tests
@ -127,15 +125,10 @@ Architecture: any
Multi-Arch: same Multi-Arch: same
Depends: nymea (= ${binary:Version}), Depends: nymea (= ${binary:Version}),
${shlibs:Depends}, ${shlibs:Depends},
${misc:Depends} ${misc:Depends},
Description: Tests and mock plugin for the nymea daemon - tests libnymea-tests (= ${binary:Version})
The nymea daemon is a plugin based IoT (Internet of Things) server. The Description: nymea automated tests and mock plugin - tests
server works like a translator for devices, things and services and Automated tests and mock plugin for the nymea daemon.
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install the mock-plugin and the corresponding tests.
Package: libnymea1 Package: libnymea1
@ -147,14 +140,8 @@ Depends: ${shlibs:Depends},
Provides: nymea-update-plugin-api-1, Provides: nymea-update-plugin-api-1,
nymea-zeroconf-plugin-api-1, nymea-zeroconf-plugin-api-1,
nymea-system-plugin-api-3 nymea-system-plugin-api-3
Description: An open source IoT server - library Description: nymea shared resources - library
The nymea daemon is a plugin based IoT (Internet of Things) server. The Shared resources for nymea plugins.
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install shared libraries for nymea.
Package: libnymea-dev Package: libnymea-dev
@ -169,14 +156,8 @@ Depends: ${shlibs:Depends},
Replaces: libnymea1-dev Replaces: libnymea1-dev
Breaks: libnymea1-dev Breaks: libnymea1-dev
Provides: libnymea1-dev Provides: libnymea1-dev
Description: The main libraries and header files for developing with nymea. Description: nymea plugin development API library - development files
The nymea daemon is a plugin based IoT (Internet of Things) server. The Shared resources for developing nymea plugins.
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install the development files for nymea.
Package: libnymea-core Package: libnymea-core
@ -201,14 +182,8 @@ Depends: ${shlibs:Depends},
iputils-ping, iputils-ping,
qml-module-qtquick2, qml-module-qtquick2,
dnsutils, dnsutils,
Description: An open source IoT server - core library Description: nymea:core internal - library
The nymea daemon is a plugin based IoT (Internet of Things) server. The Internal library for nymea:core.
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install shared libraries for nymea core.
Package: libnymea-core-dev Package: libnymea-core-dev
@ -219,14 +194,8 @@ Depends: ${shlibs:Depends},
${misc:Depends}, ${misc:Depends},
libnymea-core (= ${binary:Version}), libnymea-core (= ${binary:Version}),
libnymea-dev (= ${binary:Version}) libnymea-dev (= ${binary:Version})
Description: The main libraries and header files for developing with nymea core. Description: nymea:core internal library - development files
The nymea daemon is a plugin based IoT (Internet of Things) server. The Development files for the internal nymea:core library.
server works like a translator for devices, things and services and
allows them to interact.
With the powerful rule engine you are able to connect any device available
in the system and create individual scenes and behaviors for your environment.
.
This package will install the development files for nymea core.
Package: nymea-dev-tools Package: nymea-dev-tools
@ -238,9 +207,9 @@ Depends: ${shlibs:Depends},
qttools5-dev-tools, qttools5-dev-tools,
rsync, rsync,
Description: Tools for developing nymea plugins. Description: Tools for developing nymea plugins.
.
This package will install the nymea-plugininfocompiler. This package will install the nymea-plugininfocompiler.
Package: nymea-sdk Package: nymea-sdk
Section: devel Section: devel
Architecture: all Architecture: all
@ -251,5 +220,4 @@ Recommends: nymea-qtcreator-wizards,
crossbuilder, crossbuilder,
Suggests: libnymea-core-dev (= ${binary:Version}) Suggests: libnymea-core-dev (= ${binary:Version})
Description: The nymea SDK. Description: The nymea SDK.
.
Meta-Package for everything required to develop on nymea. Meta-Package for everything required to develop on nymea.

3
debian/libnymea-tests-dev.install.in vendored Normal file
View File

@ -0,0 +1,3 @@
usr/lib/@DEB_HOST_MULTIARCH@/libnymea-tests.so
usr/include/nymea-tests
usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/nymea-tests.pc

3
debian/libnymea-tests.install.in vendored Normal file
View File

@ -0,0 +1,3 @@
usr/lib/@DEB_HOST_MULTIARCH@/libnymea-tests.so.1
usr/lib/@DEB_HOST_MULTIARCH@/libnymea-tests.so.1.0
usr/lib/@DEB_HOST_MULTIARCH@/libnymea-tests.so.1.0.0

View File

@ -1,3 +1,2 @@
usr/tests/* usr/bin/nymeatest*
usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_integrationpluginmock.so usr/lib/@DEB_HOST_MULTIARCH@/nymea/plugins/libnymea_integrationpluginmock.so
usr/lib/@DEB_HOST_MULTIARCH@/libnymea-testlib.so*

View File

@ -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);
}
} }

View File

@ -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;
}; };
} }

View File

@ -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);

View File

@ -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();

View File

@ -16,11 +16,11 @@ INCLUDEPATH += $$top_srcdir/libnymea \
LIBS += -L$$top_builddir/libnymea/ -lnymea \ LIBS += -L$$top_builddir/libnymea/ -lnymea \
-L$$top_builddir/libnymea-core/ -lnymea-core \ -L$$top_builddir/libnymea-core/ -lnymea-core \
-L$$top_builddir/tests/testlib/ -lnymea-testlib \ -L$$top_builddir/tests/testlib/ -lnymea-tests \
-L$$top_builddir/plugins/mock/ \ -L$$top_builddir/plugins/mock/ \
-lssl -lcrypto -lnymea-remoteproxyclient -lssl -lcrypto -lnymea-remoteproxyclient
target.path = /usr/tests target.path = $$[QT_INSTALL_PREFIX]/bin
INSTALLS += target INSTALLS += target
test.commands = LD_LIBRARY_PATH=../../../libnymea:../../../libnymea-core/:../../testlib/ make check TESTRUNNER=\"dbus-test-runner --bus-type=both --task\" test.commands = LD_LIBRARY_PATH=../../../libnymea:../../../libnymea-core/:../../testlib/ make check TESTRUNNER=\"dbus-test-runner --bus-type=both --task\"

View File

@ -1,4 +1,4 @@
TARGET = testconfigurations TARGET = nymeatestconfigurations
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)

View File

@ -1,5 +1,5 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = testintegrations TARGET = nymeatestintegrations
SOURCES += testintegrations.cpp SOURCES += testintegrations.cpp

View File

@ -1,5 +1,5 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = testioconnections TARGET = nymeatestioconnections
SOURCES += testioconnections.cpp SOURCES += testioconnections.cpp

View File

@ -1,7 +1,7 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = testjsonrpc TARGET = nymeatestjsonrpc
SOURCES += testjsonrpc.cpp \ SOURCES += testjsonrpc.cpp \
../../utils/pushbuttonagent.cpp ../../utils/pushbuttonagent.cpp

View File

@ -1,5 +1,5 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = testlogging TARGET = nymeatestlogging
SOURCES += testlogging.cpp SOURCES += testlogging.cpp

View File

@ -1,5 +1,5 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = testloggingdirect TARGET = nymeatestloggingdirect
SOURCES += testloggingdirect.cpp SOURCES += testloggingdirect.cpp

View File

@ -2,5 +2,5 @@ include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
RESOURCES += loggingloading.qrc RESOURCES += loggingloading.qrc
TARGET = loggingloading TARGET = nymeatestloggingloading
SOURCES += testloggingloading.cpp SOURCES += testloggingloading.cpp

View File

@ -1,4 +1,4 @@
TARGET = testmacaddress TARGET = nymeatestmacaddress
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)

View File

@ -4,6 +4,6 @@ include(../autotests.pri)
QT += xml QT += xml
PKGCONFIG += nymea-mqtt PKGCONFIG += nymea-mqtt
TARGET = mqttbroker TARGET = nymeatestmqttbroker
SOURCES += testmqttbroker.cpp SOURCES += testmqttbroker.cpp

View File

@ -1,4 +1,4 @@
TARGET = testactions TARGET = nymeatestplugins
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)

View File

@ -1,4 +1,4 @@
TARGET = testpythonplugins TARGET = nymeatestpythonplugins
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)

View File

@ -1,5 +1,5 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = rules TARGET = nymeatestrules
SOURCES += testrules.cpp SOURCES += testrules.cpp

View File

@ -1,7 +1,7 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = scripts TARGET = nymeatestscripts
SOURCES += testscripts.cpp \ SOURCES += testscripts.cpp \
testhelper.cpp testhelper.cpp

View File

@ -1,5 +1,5 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = testtags TARGET = nymeatesttags
SOURCES += testtags.cpp SOURCES += testtags.cpp

View File

@ -1,4 +1,4 @@
TARGET = testtimemanager TARGET = nymeatesttimemanager
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)

View File

@ -2,5 +2,5 @@ include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
RESOURCES += userloading.qrc RESOURCES += userloading.qrc
TARGET = userloading TARGET = nymeatestuserloading
SOURCES += testuserloading.cpp SOURCES += testuserloading.cpp

View File

@ -1,7 +1,7 @@
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)
TARGET = testusermanager TARGET = nymeatestusermanager
HEADERS += ../../utils/pushbuttonagent.h HEADERS += ../../utils/pushbuttonagent.h

View File

@ -1,4 +1,4 @@
TARGET = testversioning TARGET = nymeatestversioning
include(../../../nymea.pri) include(../../../nymea.pri)
include(../autotests.pri) include(../autotests.pri)

View File

@ -3,5 +3,5 @@ include(../autotests.pri)
QT += xml QT += xml
TARGET = webserver TARGET = nymeatestwebserver
SOURCES += testwebserver.cpp SOURCES += testwebserver.cpp

View File

@ -3,6 +3,6 @@ include(../autotests.pri)
QT += websockets QT += websockets
TARGET = websocketserver TARGET = nymeatestwebsocketserver
SOURCES += testwebsocketserver.cpp SOURCES += testwebsocketserver.cpp

View File

@ -1,5 +1,5 @@
TEMPLATE = lib TEMPLATE = lib
TARGET = nymea-testlib TARGET = nymea-tests
include(../../nymea.pri) include(../../nymea.pri)
@ -28,3 +28,22 @@ SOURCES += nymeatestbase.cpp
target.path = $$[QT_INSTALL_LIBS] target.path = $$[QT_INSTALL_LIBS]
INSTALLS += target INSTALLS += target
# install header file with relative subdirectory
for(header, HEADERS) {
path = $$[QT_INSTALL_PREFIX]/include/nymea-tests/$${dirname(header)}
eval(headers_$${path}.files += $${header})
eval(headers_$${path}.path = $${path})
eval(INSTALLS *= headers_$${path})
}
# Create pkgconfig file
CONFIG += create_pc create_prl no_install_prl
QMAKE_PKGCONFIG_NAME = libnymea-tests
QMAKE_PKGCONFIG_DESCRIPTION = nymea-tests development library
QMAKE_PKGCONFIG_PREFIX = $$[QT_INSTALL_PREFIX]
QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_PREFIX]/include/nymea-tests/
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_VERSION = $$NYMEA_VERSION_STRING
QMAKE_PKGCONFIG_FILE = nymea-tests
QMAKE_PKGCONFIG_DESTDIR = pkgconfig