From fb74df8f817dfa4377d74218d60d3bdfef9f074f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Sat, 20 Jun 2020 11:57:55 +0200 Subject: [PATCH] Start integrating zigbee into nymea --- .../zigbeehardwareresourceimplementation.cpp | 123 ++++++++++++++++++ .../zigbeehardwareresourceimplementation.h | 73 +++++++++++ .../hardwaremanagerimplementation.cpp | 8 ++ libnymea-core/hardwaremanagerimplementation.h | 4 +- libnymea-core/jsonrpc/zigbeehandler.cpp | 74 +++++++++++ libnymea-core/jsonrpc/zigbeehandler.h | 56 ++++++++ libnymea-core/libnymea-core.pro | 12 +- libnymea-core/nymeacore.cpp | 8 ++ libnymea-core/nymeacore.h | 5 + libnymea-core/zigbee/zigbeemanager.cpp | 50 +++++++ libnymea-core/zigbee/zigbeemanager.h | 60 +++++++++ .../hardware/zigbee/zigbeehardwarereource.cpp | 37 ++++++ .../hardware/zigbee/zigbeehardwarereource.h | 49 +++++++ libnymea/hardwaremanager.h | 2 + libnymea/libnymea.pro | 2 + libnymea/loggingcategories.h | 2 + 16 files changed, 561 insertions(+), 4 deletions(-) create mode 100644 libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp create mode 100644 libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.h create mode 100644 libnymea-core/jsonrpc/zigbeehandler.cpp create mode 100644 libnymea-core/jsonrpc/zigbeehandler.h create mode 100644 libnymea-core/zigbee/zigbeemanager.cpp create mode 100644 libnymea-core/zigbee/zigbeemanager.h create mode 100644 libnymea/hardware/zigbee/zigbeehardwarereource.cpp create mode 100644 libnymea/hardware/zigbee/zigbeehardwarereource.h diff --git a/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp b/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp new file mode 100644 index 00000000..3a3974c5 --- /dev/null +++ b/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.cpp @@ -0,0 +1,123 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU General Public License as published by the Free Software +* Foundation, GNU version 3. This project is distributed in the hope that it +* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +* Public License for more details. +* +* You should have received a copy of the GNU General Public License along with +* this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "zigbeemanagerimplementation.h" +#include "loggingcategories.h" +#include "nymeasettings.h" + +#include +#include + +#include "nymea-zigbee/zigbeenetworkmanager.h" + +namespace nymeaserver { + +ZigbeeHardwareResourceImplementation::ZigbeeHardwareResourceImplementation(QObject *parent) : + ZigbeeHardwareResource(parent) +{ + +} + +bool ZigbeeHardwareResourceImplementation::available() const +{ + return m_available; +} + +bool ZigbeeHardwareResourceImplementation::enabled() const +{ + return m_enabled; +} + +void ZigbeeHardwareResourceImplementation::setZigbeeNetwork(ZigbeeNetwork *network) +{ + // Clean up + if (m_zigbeeNetwork) { + disconnect(m_zigbeeNetwork, &ZigbeeNetwork::stateChanged, this, &ZigbeeHardwareResourceImplementation::onZigbeeNetworkStateChanged); + } + + // Set new network + m_zigbeeNetwork = network; + connect(m_zigbeeNetwork, &ZigbeeNetwork::stateChanged, this, &ZigbeeHardwareResourceImplementation::onZigbeeNetworkStateChanged); +} + +void ZigbeeHardwareResourceImplementation::setEnabled(bool enabled) +{ + qCDebug(dcZigbeeHardwareResource()) << "Set" << (enabled ? "enabled" : "disabled"); + if (m_enabled && enabled) { + qCDebug(dcZigbeeHardwareResource()) << "Already enabled."; + return; + } else if (!m_enabled && !enabled) { + qCDebug(dcZigbeeHardwareResource()) << "Already disabled."; + return; + } + + bool success = false; + if (enabled) { + success = enable(); + } else { + success = disable(); + } + + if (success) { + m_enabled = enabled; + emit enabledChanged(m_enabled); + } +} + +void ZigbeeHardwareResourceImplementation::onZigbeeNetworkStateChanged(ZigbeeNetwork::State state) +{ + qCDebug(dcZigbeeHardwareResource()) << "Network state changed" << state; +} + +bool ZigbeeHardwareResourceImplementation::enable() +{ + qCDebug(dcZigbeeHardwareResource()) << "Enable hardware resource"; + + if (!m_zigbeeNetwork) { + qCDebug(dcZigbeeHardwareResource()) << "There is no zigbee network configured as hardware resource"; + } else { + // TODO: start network + } + + return true; +} + +bool ZigbeeHardwareResourceImplementation::disable() +{ + qCDebug(dcZigbeeHardwareResource()) << "Disable hardware resource"; + if (!m_zigbeeNetwork) { + qCDebug(dcZigbeeHardwareResource()) << "There is no zigbee network configured as hardware resource"; + } + + // TODO: stop network + return true; +} + +} diff --git a/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.h b/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.h new file mode 100644 index 00000000..ab29f96b --- /dev/null +++ b/libnymea-core/hardware/zigbee/zigbeehardwareresourceimplementation.h @@ -0,0 +1,73 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU General Public License as published by the Free Software +* Foundation, GNU version 3. This project is distributed in the hope that it +* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +* Public License for more details. +* +* You should have received a copy of the GNU General Public License along with +* this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef ZIGBEEHARDWARERESOURCEIMPLEMENTATION_H +#define ZIGBEEHARDWARERESOURCEIMPLEMENTATION_H + +#include + +#include "zigbeenetwork.h" +#include "hardware/zigbee/zigbeehardwarereource.h" + +namespace nymeaserver { + +class ZigbeeHardwareResourceImplementation : public ZigbeeHardwareResource +{ + Q_OBJECT + +public: + explicit ZigbeeHardwareResourceImplementation(QObject *parent = nullptr); + + bool available() const override; + bool enabled() const override; + + void setZigbeeNetwork(ZigbeeNetwork *network); + +private: + bool m_available = false; + bool m_enabled = false; + + ZigbeeNetwork *m_zigbeeNetwork = nullptr; + +protected: + void setEnabled(bool enabled) override; + +private slots: + void onZigbeeNetworkStateChanged(ZigbeeNetwork::State state); + +public slots: + bool enable(); + bool disable(); + +}; + +} + +#endif // ZIGBEEHARDWARERESOURCEIMPLEMENTATION_H diff --git a/libnymea-core/hardwaremanagerimplementation.cpp b/libnymea-core/hardwaremanagerimplementation.cpp index 7e057cf0..6a804dcb 100644 --- a/libnymea-core/hardwaremanagerimplementation.cpp +++ b/libnymea-core/hardwaremanagerimplementation.cpp @@ -42,6 +42,7 @@ #include "hardware/bluetoothlowenergy/bluetoothlowenergymanagerimplementation.h" #include "hardware/network/mqtt/mqttproviderimplementation.h" #include "hardware/i2c/i2cmanagerimplementation.h" +#include "hardware/zigbee/zigbeehardwareresourceimplementation.h" namespace nymeaserver { @@ -70,6 +71,8 @@ HardwareManagerImplementation::HardwareManagerImplementation(Platform *platform, m_i2cManager = new I2CManagerImplementation(this); + m_zigbeeManager = new ZigbeeHardwareResourceImplementation(this); + qCDebug(dcHardware()) << "Hardware manager initialized successfully"; @@ -136,4 +139,9 @@ I2CManager *HardwareManagerImplementation::i2cManager() return m_i2cManager; } +ZigbeeHardwareResource *HardwareManagerImplementation::zigbeeManager() +{ + return m_zigbeeManager; +} + } diff --git a/libnymea-core/hardwaremanagerimplementation.h b/libnymea-core/hardwaremanagerimplementation.h index 0c5899eb..3094d3d0 100644 --- a/libnymea-core/hardwaremanagerimplementation.h +++ b/libnymea-core/hardwaremanagerimplementation.h @@ -57,7 +57,8 @@ public: PlatformZeroConfController *zeroConfController() override; BluetoothLowEnergyManager *bluetoothLowEnergyManager() override; MqttProvider *mqttProvider() override; - I2CManager * i2cManager() override; + I2CManager *i2cManager() override; + ZigbeeHardwareResource *zigbeeManager() override; private: QNetworkAccessManager *m_networkAccessManager = nullptr; @@ -72,6 +73,7 @@ private: BluetoothLowEnergyManager *m_bluetoothLowEnergyManager = nullptr; MqttProvider *m_mqttProvider = nullptr; I2CManager *m_i2cManager = nullptr; + ZigbeeHardwareResource *m_zigbeeManager = nullptr; }; } diff --git a/libnymea-core/jsonrpc/zigbeehandler.cpp b/libnymea-core/jsonrpc/zigbeehandler.cpp new file mode 100644 index 00000000..46387a8f --- /dev/null +++ b/libnymea-core/jsonrpc/zigbeehandler.cpp @@ -0,0 +1,74 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "zigbeehandler.h" + +namespace nymeaserver { + +ZigbeeHandler::ZigbeeHandler(QObject *parent) : + JsonHandler(parent) +{ + registerEnum(); + registerEnum(); + + QVariantMap params, returns; + QString description; + + params.clear(); returns.clear(); + description = "Get the status of the current network."; + returns.insert("available", enumValueName(Bool)); + returns.insert("enabled", enumValueName(Bool)); + returns.insert("configured", enumValueName(Bool)); + returns.insert("state", enumRef()); + registerMethod("GetNetworkStatus", description, params, returns); + + + // GetUartInterfaces + params.clear(); returns.clear(); + description = "Get the available UART interfaces in order to set up the zigbee network on the approriate serial interface."; + returns.insert("available", enumValueName(Bool)); + returns.insert("enabled", enumValueName(Bool)); + returns.insert("configured", enumValueName(Bool)); + returns.insert("state", enumRef()); + registerMethod("GetUartInterfaces", description, params, returns); + + + // Setup network, uart, baudrate, backendtype + + + +} + +QString ZigbeeHandler::name() const +{ + return "Zigbee"; +} + +} diff --git a/libnymea-core/jsonrpc/zigbeehandler.h b/libnymea-core/jsonrpc/zigbeehandler.h new file mode 100644 index 00000000..d0ce3786 --- /dev/null +++ b/libnymea-core/jsonrpc/zigbeehandler.h @@ -0,0 +1,56 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef ZIGBEEHANDLER_H +#define ZIGBEEHANDLER_H + +#include + +#include "jsonrpc/jsonhandler.h" + +#include + +namespace nymeaserver { + +class ZigbeeHandler : public JsonHandler +{ + Q_OBJECT +public: + explicit ZigbeeHandler(QObject *parent = nullptr); + + QString name() const override; + +signals: + +}; + +} + +#endif // ZIGBEEHANDLER_H diff --git a/libnymea-core/libnymea-core.pro b/libnymea-core/libnymea-core.pro index 0b00372f..f27cf711 100644 --- a/libnymea-core/libnymea-core.pro +++ b/libnymea-core/libnymea-core.pro @@ -8,7 +8,7 @@ INCLUDEPATH += $$top_srcdir/libnymea $$top_builddir LIBS += -L$$top_builddir/libnymea/ -lnymea -lssl -lcrypto CONFIG += link_pkgconfig -PKGCONFIG += nymea-mqtt nymea-networkmanager +PKGCONFIG += nymea-mqtt nymea-networkmanager nymea-zigbee # As of Ubuntu focal, there's a commonly named python3-embed pointing to the distro version of python # For everything below python 3.8 we need to manually select one @@ -37,6 +37,7 @@ RESOURCES += $$top_srcdir/icons.qrc \ HEADERS += nymeacore.h \ integrations/apikeysprovidersloader.h \ + hardware/zigbee/zigbeehardwareresourceimplementation.h \ integrations/plugininfocache.h \ integrations/python/pynymealogginghandler.h \ integrations/python/pynymeamodule.h \ @@ -53,6 +54,7 @@ HEADERS += nymeacore.h \ integrations/translator.h \ integrations/pythonintegrationplugin.h \ experiences/experiencemanager.h \ + jsonrpc/zigbeehandler.h \ ruleengine/ruleengine.h \ ruleengine/rule.h \ ruleengine/stateevaluator.h \ @@ -126,16 +128,19 @@ HEADERS += nymeacore.h \ tagging/tag.h \ cloud/cloudtransport.h \ debugreportgenerator.h \ - platform/platform.h \ + platform/platform.h \ \ + zigbee/zigbeemanager.h SOURCES += nymeacore.cpp \ integrations/apikeysprovidersloader.cpp \ + hardware/zigbee/zigbeehardwareresourceimplementation.cpp \ integrations/plugininfocache.cpp \ integrations/thingmanagerimplementation.cpp \ integrations/translator.cpp \ integrations/pythonintegrationplugin.cpp \ experiences/experiencemanager.cpp \ + jsonrpc/zigbeehandler.cpp \ ruleengine/ruleengine.cpp \ ruleengine/rule.cpp \ ruleengine/stateevaluator.cpp \ @@ -208,7 +213,8 @@ SOURCES += nymeacore.cpp \ tagging/tag.cpp \ cloud/cloudtransport.cpp \ debugreportgenerator.cpp \ - platform/platform.cpp \ + platform/platform.cpp \ \ + zigbee/zigbeemanager.cpp versionAtLeast(QT_VERSION, 5.12.0) { diff --git a/libnymea-core/nymeacore.cpp b/libnymea-core/nymeacore.cpp index 48c144c1..33f94b9b 100644 --- a/libnymea-core/nymeacore.cpp +++ b/libnymea-core/nymeacore.cpp @@ -106,6 +106,9 @@ void NymeaCore::init() { qCDebug(dcCore) << "Creating Server Manager"; m_serverManager = new ServerManager(m_platform, m_configuration, this); + qCDebug(dcCore()) << "Create Zigbee Manager"; + m_zigbeeManager = new ZigbeeManager(this); + qCDebug(dcCore) << "Creating Hardware Manager"; m_hardwareManager = new HardwareManagerImplementation(m_platform, m_serverManager->mqttBroker(), this); @@ -649,6 +652,11 @@ Platform *NymeaCore::platform() const return m_platform; } +ZigbeeManager *NymeaCore::zigbeeManager() const +{ + return m_zigbeeManager; +} + void NymeaCore::gotEvent(const Event &event) { m_logger->logEvent(event); diff --git a/libnymea-core/nymeacore.h b/libnymea-core/nymeacore.h index c49e4956..364de311 100644 --- a/libnymea-core/nymeacore.h +++ b/libnymea-core/nymeacore.h @@ -46,6 +46,8 @@ #include "time/timemanager.h" #include "hardwaremanagerimplementation.h" +#include "zigbee/zigbeemanager.h" + #include "debugserverhandler.h" #include @@ -66,6 +68,7 @@ class System; class ExperienceManager; class ScriptEngine; class CloudManager; +class ZigbeeManager; class NymeaCore : public QObject { @@ -106,6 +109,7 @@ public: DebugServerHandler *debugServerHandler() const; TagsStorage *tagsStorage() const; Platform *platform() const; + ZigbeeManager *zigbeeManager() const; static QStringList getAvailableLanguages(); static QStringList loggingFilters(); @@ -149,6 +153,7 @@ private: UserManager *m_userManager; System *m_system; ExperienceManager *m_experienceManager; + ZigbeeManager *m_zigbeeManager; QList m_executingRules; diff --git a/libnymea-core/zigbee/zigbeemanager.cpp b/libnymea-core/zigbee/zigbeemanager.cpp new file mode 100644 index 00000000..562a8bc7 --- /dev/null +++ b/libnymea-core/zigbee/zigbeemanager.cpp @@ -0,0 +1,50 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU General Public License as published by the Free Software +* Foundation, GNU version 3. This project is distributed in the hope that it +* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +* Public License for more details. +* +* You should have received a copy of the GNU General Public License along with +* this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "zigbeemanager.h" + +namespace nymeaserver { + +ZigbeeManager::ZigbeeManager(QObject *parent) : QObject(parent) +{ + +} + +bool ZigbeeManager::available() const +{ + return m_zigbeeNetwork != nullptr; +} + +void ZigbeeManager::setupNetwork(const QString serialPort, qint32 baudrate, ZigbeeNetworkManager::BackendType) +{ + +} + +} diff --git a/libnymea-core/zigbee/zigbeemanager.h b/libnymea-core/zigbee/zigbeemanager.h new file mode 100644 index 00000000..ed871fbc --- /dev/null +++ b/libnymea-core/zigbee/zigbeemanager.h @@ -0,0 +1,60 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU General Public License as published by the Free Software +* Foundation, GNU version 3. This project is distributed in the hope that it +* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty +* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +* Public License for more details. +* +* You should have received a copy of the GNU General Public License along with +* this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef ZIGBEEMANAGER_H +#define ZIGBEEMANAGER_H + +#include + +#include + +namespace nymeaserver { + +class ZigbeeManager : public QObject +{ + Q_OBJECT +public: + explicit ZigbeeManager(QObject *parent = nullptr); + + bool available() const; + + void setupNetwork(const QString serialPort, qint32 baudrate, ZigbeeNetworkManager::BackendType); + +private: + ZigbeeNetwork *m_zigbeeNetwork = nullptr; + +signals: + void zigbeeNetworkChanged(ZigbeeNetwork *zigbeeNetwork); + +}; + +} + +#endif // ZIGBEEMANAGER_H diff --git a/libnymea/hardware/zigbee/zigbeehardwarereource.cpp b/libnymea/hardware/zigbee/zigbeehardwarereource.cpp new file mode 100644 index 00000000..c1e5bfd4 --- /dev/null +++ b/libnymea/hardware/zigbee/zigbeehardwarereource.cpp @@ -0,0 +1,37 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "zigbeehardwarereource.h" + +ZigbeeHardwareResource::ZigbeeHardwareResource(QObject *parent) : + HardwareResource("Zigbee hardware resource", parent) +{ + +} diff --git a/libnymea/hardware/zigbee/zigbeehardwarereource.h b/libnymea/hardware/zigbee/zigbeehardwarereource.h new file mode 100644 index 00000000..f97fcb56 --- /dev/null +++ b/libnymea/hardware/zigbee/zigbeehardwarereource.h @@ -0,0 +1,49 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* +* Copyright 2013 - 2020, nymea GmbH +* Contact: contact@nymea.io +* +* This file is part of nymea. +* This project including source code and documentation is protected by +* copyright law, and remains the property of nymea GmbH. All rights, including +* reproduction, publication, editing and translation, are reserved. The use of +* this project is subject to the terms of a license agreement to be concluded +* with nymea GmbH in accordance with the terms of use of nymea GmbH, available +* under https://nymea.io/license +* +* GNU Lesser General Public License Usage +* Alternatively, this project may be redistributed and/or modified under the +* terms of the GNU Lesser General Public License as published by the Free +* Software Foundation; version 3. This project is distributed in the hope that +* it will be useful, but WITHOUT ANY WARRANTY; without even the implied +* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this project. If not, see . +* +* For any further details and any questions please contact us under +* contact@nymea.io or see our FAQ/Licensing Information on +* https://nymea.io/license/faq +* +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef ZIGBEEHARDWARERESOURCE_H +#define ZIGBEEHARDWARERESOURCE_H + +#include + +#include "hardwareresource.h" + +class ZigbeeHardwareResource : public HardwareResource +{ + Q_OBJECT +public: + explicit ZigbeeHardwareResource(QObject *parent = nullptr); + virtual ~ZigbeeHardwareResource() = default; + + + +}; + +#endif // ZIGBEEHARDWARERESOURCE_H diff --git a/libnymea/hardwaremanager.h b/libnymea/hardwaremanager.h index d5ed2c45..2e384d90 100644 --- a/libnymea/hardwaremanager.h +++ b/libnymea/hardwaremanager.h @@ -42,6 +42,7 @@ class PlatformZeroConfController; class BluetoothLowEnergyManager; class MqttProvider; class I2CManager; +class ZigbeeHardwareResource; class HardwareResource; class HardwareManager : public QObject @@ -61,6 +62,7 @@ public: virtual BluetoothLowEnergyManager *bluetoothLowEnergyManager() = 0; virtual MqttProvider *mqttProvider() = 0; virtual I2CManager *i2cManager() = 0; + virtual ZigbeeHardwareResource *zigbeeManager() = 0; protected: void setResourceEnabled(HardwareResource* resource, bool enabled); diff --git a/libnymea/libnymea.pro b/libnymea/libnymea.pro index b86c15e8..a5fb1ba4 100644 --- a/libnymea/libnymea.pro +++ b/libnymea/libnymea.pro @@ -10,6 +10,7 @@ DEFINES += LIBNYMEA_LIBRARY QMAKE_LFLAGS += -fPIC HEADERS += \ + hardware/zigbee/zigbeehardwarereource.h \ integrations/browseractioninfo.h \ integrations/browseritemactioninfo.h \ integrations/browseritemresult.h \ @@ -102,6 +103,7 @@ HEADERS += \ experiences/experienceplugin.h \ SOURCES += \ + hardware/zigbee/zigbeehardwarereource.cpp \ integrations/browseractioninfo.cpp \ integrations/browseritemactioninfo.cpp \ integrations/browseritemresult.cpp \ diff --git a/libnymea/loggingcategories.h b/libnymea/loggingcategories.h index dfb88212..979173fb 100644 --- a/libnymea/loggingcategories.h +++ b/libnymea/loggingcategories.h @@ -91,6 +91,8 @@ Q_DECLARE_LOGGING_CATEGORY(dcCoap) Q_DECLARE_LOGGING_CATEGORY(dcI2C) Q_DECLARE_LOGGING_CATEGORY(dcIntegrations) Q_DECLARE_LOGGING_CATEGORY(dcJsIntegrations) +Q_DECLARE_LOGGING_CATEGORY(dcZigbee) +Q_DECLARE_LOGGING_CATEGORY(dcZigbeeHardwareResource) /*