Start integrating zigbee into nymea
This commit is contained in:
parent
ae6a548d68
commit
fb74df8f81
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <QObject>
|
||||
|
||||
#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
|
||||
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
74
libnymea-core/jsonrpc/zigbeehandler.cpp
Normal file
74
libnymea-core/jsonrpc/zigbeehandler.cpp
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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<ZigbeeNetwork::State>();
|
||||
registerEnum<ZigbeeNetworkManager::BackendType>();
|
||||
|
||||
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<ZigbeeNetwork::State>());
|
||||
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<ZigbeeNetwork::State>());
|
||||
registerMethod("GetUartInterfaces", description, params, returns);
|
||||
|
||||
|
||||
// Setup network, uart, baudrate, backendtype
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
QString ZigbeeHandler::name() const
|
||||
{
|
||||
return "Zigbee";
|
||||
}
|
||||
|
||||
}
|
||||
56
libnymea-core/jsonrpc/zigbeehandler.h
Normal file
56
libnymea-core/jsonrpc/zigbeehandler.h
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <QObject>
|
||||
|
||||
#include "jsonrpc/jsonhandler.h"
|
||||
|
||||
#include <nymea-zigbee/zigbeenetworkmanager.h>
|
||||
|
||||
namespace nymeaserver {
|
||||
|
||||
class ZigbeeHandler : public JsonHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ZigbeeHandler(QObject *parent = nullptr);
|
||||
|
||||
QString name() const override;
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // ZIGBEEHANDLER_H
|
||||
@ -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) {
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -46,6 +46,8 @@
|
||||
#include "time/timemanager.h"
|
||||
#include "hardwaremanagerimplementation.h"
|
||||
|
||||
#include "zigbee/zigbeemanager.h"
|
||||
|
||||
#include "debugserverhandler.h"
|
||||
|
||||
#include <QObject>
|
||||
@ -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<RuleId> m_executingRules;
|
||||
|
||||
|
||||
50
libnymea-core/zigbee/zigbeemanager.cpp
Normal file
50
libnymea-core/zigbee/zigbeemanager.cpp
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
60
libnymea-core/zigbee/zigbeemanager.h
Normal file
60
libnymea-core/zigbee/zigbeemanager.h
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <QObject>
|
||||
|
||||
#include <nymea-zigbee/zigbeenetworkmanager.h>
|
||||
|
||||
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
|
||||
37
libnymea/hardware/zigbee/zigbeehardwarereource.cpp
Normal file
37
libnymea/hardware/zigbee/zigbeehardwarereource.cpp
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
|
||||
}
|
||||
49
libnymea/hardware/zigbee/zigbeehardwarereource.h
Normal file
49
libnymea/hardware/zigbee/zigbeehardwarereource.h
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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 <QObject>
|
||||
|
||||
#include "hardwareresource.h"
|
||||
|
||||
class ZigbeeHardwareResource : public HardwareResource
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ZigbeeHardwareResource(QObject *parent = nullptr);
|
||||
virtual ~ZigbeeHardwareResource() = default;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // ZIGBEEHARDWARERESOURCE_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);
|
||||
|
||||
@ -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 \
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user