diff --git a/libnymea-core/jsonrpc/zigbeehandler.cpp b/libnymea-core/jsonrpc/zigbeehandler.cpp index c9481ac1..8a6ab354 100644 --- a/libnymea-core/jsonrpc/zigbeehandler.cpp +++ b/libnymea-core/jsonrpc/zigbeehandler.cpp @@ -38,10 +38,10 @@ ZigbeeHandler::ZigbeeHandler(ZigbeeManager *zigbeeManager, QObject *parent) : m_zigbeeManager(zigbeeManager) { registerEnum(); - registerEnum(); + registerEnum(); - registerObject(); - registerObject(); +// registerObject(); +// registerObject(); QVariantMap params, returns; QString description; @@ -60,7 +60,7 @@ ZigbeeHandler::ZigbeeHandler(ZigbeeManager *zigbeeManager, QObject *parent) : returns.insert("configured", enumValueName(Bool)); returns.insert("serialPort", enumValueName(String)); returns.insert("baudRate", enumValueName(Uint)); - returns.insert("backend", enumRef()); + returns.insert("backend", enumRef()); returns.insert("firmwareVersion", enumValueName(String)); returns.insert("networkIeeeeAddress", enumValueName(String)); returns.insert("networkPanId", enumValueName(Uint)); @@ -70,10 +70,10 @@ ZigbeeHandler::ZigbeeHandler(ZigbeeManager *zigbeeManager, QObject *parent) : 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("uartInterfaces", objectRef()); - registerMethod("GetUartInterfaces", description, params, returns); +// 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("uartInterfaces", objectRef()); +// registerMethod("GetUartInterfaces", description, params, returns); // GetNetworkStatus // NetworkStatusChanged @@ -125,11 +125,11 @@ JsonReply *ZigbeeHandler::GetUartInterfaces(const QVariantMap ¶ms) { Q_UNUSED(params) QVariantMap ret; - QVariantList portList; - foreach (const ZigbeeSerialPort &serialPort, m_zigbeeManager->availablePorts()) { - portList << pack(serialPort); - } - ret.insert("uartInterfaces", portList); +// QVariantList portList; +// foreach (const ZigbeeSerialPort &serialPort, m_zigbeeManager->availablePorts()) { +// portList << pack(serialPort); +// } +// ret.insert("uartInterfaces", portList); return createReply(ret); } diff --git a/libnymea-core/libnymea-core.pro b/libnymea-core/libnymea-core.pro index b940c5dc..430a50fe 100644 --- a/libnymea-core/libnymea-core.pro +++ b/libnymea-core/libnymea-core.pro @@ -130,8 +130,7 @@ HEADERS += nymeacore.h \ cloud/cloudtransport.h \ debugreportgenerator.h \ platform/platform.h \ \ - zigbee/zigbeemanager.h \ - zigbee/zigbeeserialport.h + zigbee/zigbeemanager.h SOURCES += nymeacore.cpp \ @@ -217,8 +216,7 @@ SOURCES += nymeacore.cpp \ cloud/cloudtransport.cpp \ debugreportgenerator.cpp \ platform/platform.cpp \ - zigbee/zigbeemanager.cpp \ - zigbee/zigbeeserialport.cpp + zigbee/zigbeemanager.cpp versionAtLeast(QT_VERSION, 5.12.0) { diff --git a/libnymea-core/zigbee/zigbeemanager.cpp b/libnymea-core/zigbee/zigbeemanager.cpp index 701b8a7e..ce5d98f5 100644 --- a/libnymea-core/zigbee/zigbeemanager.cpp +++ b/libnymea-core/zigbee/zigbeemanager.cpp @@ -56,34 +56,7 @@ ZigbeeNetwork *ZigbeeManager::zigbeeNetwork() const return m_zigbeeNetwork; } -ZigbeeSerialPortList ZigbeeManager::availablePorts() -{ - ZigbeeSerialPortList ports; - foreach (const QSerialPortInfo &serialPortInfo, QSerialPortInfo::availablePorts()) { - qCDebug(dcZigbee()) << "Found serial port" << serialPortInfo.portName(); - qCDebug(dcZigbee()) << " Description:" << serialPortInfo.description(); - qCDebug(dcZigbee()) << " System location:" << serialPortInfo.systemLocation(); - qCDebug(dcZigbee()) << " Manufacturer:" << serialPortInfo.manufacturer(); - qCDebug(dcZigbee()) << " Serialnumber:" << serialPortInfo.serialNumber(); - - if (serialPortInfo.hasProductIdentifier()) { - qCDebug(dcZigbee()) << " Product identifier:" << serialPortInfo.productIdentifier(); - } - if (serialPortInfo.hasVendorIdentifier()) { - qCDebug(dcZigbee()) << " Vendor identifier:" << serialPortInfo.vendorIdentifier(); - } - - ZigbeeSerialPort port; - port.setName(serialPortInfo.portName()); - port.setDescription(serialPortInfo.description()); - port.setSystemLocation(serialPortInfo.systemLocation()); - ports.append(port); - } - - return ports; -} - -void ZigbeeManager::createZigbeeNetwork(const QString &serialPort, qint32 baudrate, ZigbeeNetworkManager::BackendType backend) +void ZigbeeManager::createZigbeeNetwork(const QString &serialPort, qint32 baudrate, Zigbee::BackendType backend) { if (m_zigbeeNetwork) { delete m_zigbeeNetwork; diff --git a/libnymea-core/zigbee/zigbeemanager.h b/libnymea-core/zigbee/zigbeemanager.h index 54a4a652..dced5f3f 100644 --- a/libnymea-core/zigbee/zigbeemanager.h +++ b/libnymea-core/zigbee/zigbeemanager.h @@ -35,8 +35,6 @@ #include -#include "zigbeeserialport.h" - namespace nymeaserver { class ZigbeeManager : public QObject @@ -50,9 +48,7 @@ public: ZigbeeNetwork *zigbeeNetwork() const; - ZigbeeSerialPortList availablePorts(); - - void createZigbeeNetwork(const QString &serialPort, qint32 baudrate, ZigbeeNetworkManager::BackendType backend); + void createZigbeeNetwork(const QString &serialPort, qint32 baudrate, Zigbee::BackendType backend); private: ZigbeeNetwork *m_zigbeeNetwork = nullptr; diff --git a/libnymea-core/zigbee/zigbeeserialport.cpp b/libnymea-core/zigbee/zigbeeserialport.cpp deleted file mode 100644 index 6b2b12d7..00000000 --- a/libnymea-core/zigbee/zigbeeserialport.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* -* 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 "zigbeeserialport.h" - -namespace nymeaserver { - -ZigbeeSerialPort::ZigbeeSerialPort() -{ - -} - -QString ZigbeeSerialPort::name() const -{ - return m_name; -} - -void ZigbeeSerialPort::setName(const QString &name) -{ - m_name = name; -} - -QString ZigbeeSerialPort::description() const -{ - return m_description; -} - -void ZigbeeSerialPort::setDescription(const QString &description) -{ - m_description = description; -} - -QString ZigbeeSerialPort::systemLocation() const -{ - return m_systemLocation; -} - -void ZigbeeSerialPort::setSystemLocation(const QString &systemLocation) -{ - m_systemLocation = systemLocation; -} - -QVariant ZigbeeSerialPortList::get(int index) const -{ - return QVariant::fromValue(at(index)); -} - -void ZigbeeSerialPortList::put(const QVariant &variant) -{ - append(variant.value()); -} - -} diff --git a/libnymea-core/zigbee/zigbeeserialport.h b/libnymea-core/zigbee/zigbeeserialport.h deleted file mode 100644 index 34397bec..00000000 --- a/libnymea-core/zigbee/zigbeeserialport.h +++ /dev/null @@ -1,77 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* -* 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 ZIGBEESERIALPORT_H -#define ZIGBEESERIALPORT_H - -#include -#include -namespace nymeaserver { - -class ZigbeeSerialPort -{ - Q_GADGET - Q_PROPERTY(QString name READ name) - Q_PROPERTY(QString description READ description) - Q_PROPERTY(QString systemLocation READ systemLocation) - -public: - ZigbeeSerialPort(); - - QString name() const; - void setName(const QString &name); - - QString description() const; - void setDescription(const QString &description); - - QString systemLocation() const; - void setSystemLocation(const QString &systemLocation); - -private: - QString m_name; - QString m_description; - QString m_systemLocation; -}; - -class ZigbeeSerialPortList: public QList -{ - Q_GADGET - Q_PROPERTY(int count READ count) -public: - Q_INVOKABLE QVariant get(int index) const; - Q_INVOKABLE void put(const QVariant &variant); -}; - -} - -Q_DECLARE_METATYPE(nymeaserver::ZigbeeSerialPort) -Q_DECLARE_METATYPE(nymeaserver::ZigbeeSerialPortList) - -#endif // ZIGBEESERIALPORT_H diff --git a/libnymea/loggingcategories.cpp b/libnymea/loggingcategories.cpp index 45906af3..303e60a2 100644 --- a/libnymea/loggingcategories.cpp +++ b/libnymea/loggingcategories.cpp @@ -76,6 +76,7 @@ NYMEA_LOGGING_CATEGORY(dcBluetoothServerTraffic, "BluetoothServerTraffic") NYMEA_LOGGING_CATEGORY(dcMqtt, "Mqtt") NYMEA_LOGGING_CATEGORY(dcTranslations, "Translations") NYMEA_LOGGING_CATEGORY(dcI2C, "I2C") +NYMEA_LOGGING_CATEGORY(dcZigbeeHardwareResource, "ZigbeeHardwareResource") static QFile s_logFile;