diff --git a/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp b/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp index 45772f9..b162636 100644 --- a/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp +++ b/libnymea-zigbee/backends/deconz/zigbeebridgecontrollerdeconz.cpp @@ -1045,19 +1045,19 @@ QDebug operator<<(QDebug debug, const DeconzDeviceState &deviceState) QDebug operator<<(QDebug debug, const DeconzNetworkConfiguration &configuration) { - debug.nospace() << "Network configuration:" << endl; - debug.nospace() << " - Node type:" << configuration.nodeType << endl; - debug.nospace() << " - IEEE address:" << configuration.ieeeAddress.toString() << endl; - debug.nospace() << " - NWK address:" << ZigbeeUtils::convertUint16ToHexString(configuration.shortAddress) << endl; - debug.nospace() << " - PAN ID:" << ZigbeeUtils::convertUint16ToHexString(configuration.panId) << endl; - debug.nospace() << " - Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.extendedPanId) << endl; - debug.nospace() << " - APS Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.apsExtendedPanId) << endl; - debug.nospace() << " - Trust center IEEE address:" << configuration.trustCenterAddress.toString() << endl; - debug.nospace() << " - Channel mask:" << ZigbeeChannelMask(configuration.channelMask) << endl; - debug.nospace() << " - Channel:" << configuration.currentChannel << endl; - debug.nospace() << " - Security mode:" << configuration.securityMode << endl; - debug.nospace() << " - Protocol version:" << ZigbeeUtils::convertUint16ToHexString(configuration.protocolVersion) << endl; - debug.nospace() << " - Network update ID:" << ZigbeeUtils::convertByteToHexString(configuration.networkUpdateId) << endl; - debug.nospace() << " - Watchdog TTL:" << configuration.watchdogTimeout << endl; + debug.nospace() << "Network configuration:" << Qt::endl; + debug.nospace() << " - Node type:" << configuration.nodeType << Qt::endl; + debug.nospace() << " - IEEE address:" << configuration.ieeeAddress.toString() << Qt::endl; + debug.nospace() << " - NWK address:" << ZigbeeUtils::convertUint16ToHexString(configuration.shortAddress) << Qt::endl; + debug.nospace() << " - PAN ID:" << ZigbeeUtils::convertUint16ToHexString(configuration.panId) << Qt::endl; + debug.nospace() << " - Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.extendedPanId) << Qt::endl; + debug.nospace() << " - APS Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.apsExtendedPanId) << Qt::endl; + debug.nospace() << " - Trust center IEEE address:" << configuration.trustCenterAddress.toString() << Qt::endl; + debug.nospace() << " - Channel mask:" << ZigbeeChannelMask(configuration.channelMask) << Qt::endl; + debug.nospace() << " - Channel:" << configuration.currentChannel << Qt::endl; + debug.nospace() << " - Security mode:" << configuration.securityMode << Qt::endl; + debug.nospace() << " - Protocol version:" << ZigbeeUtils::convertUint16ToHexString(configuration.protocolVersion) << Qt::endl; + debug.nospace() << " - Network update ID:" << ZigbeeUtils::convertByteToHexString(configuration.networkUpdateId) << Qt::endl; + debug.nospace() << " - Watchdog TTL:" << configuration.watchdogTimeout << Qt::endl; return debug.space(); } diff --git a/libnymea-zigbee/backends/deconz/zigbeenetworkdeconz.cpp b/libnymea-zigbee/backends/deconz/zigbeenetworkdeconz.cpp index 13e2a01..d7279b1 100644 --- a/libnymea-zigbee/backends/deconz/zigbeenetworkdeconz.cpp +++ b/libnymea-zigbee/backends/deconz/zigbeenetworkdeconz.cpp @@ -108,7 +108,7 @@ ZigbeeNetworkReply *ZigbeeNetworkDeconz::setPermitJoin(quint16 shortAddress, qui stream << request.requestId(); stream << duration; stream << static_cast(0x01); // TrustCenter significance, always force to 1 according to Spec. - request.setTxOptions(Zigbee::ZigbeeTxOptions(nullptr)); // no ACK for broadcasts + request.setTxOptions(Zigbee::ZigbeeTxOptions()); // no ACK for broadcasts request.setAsdu(asdu); qCDebug(dcZigbeeNetwork()) << "Send permit join request" << ZigbeeUtils::convertUint16ToHexString(request.destinationShortAddress()) << duration << "s"; @@ -372,7 +372,7 @@ void ZigbeeNetworkDeconz::setPermitJoiningInternal(bool permitJoining) duration = 254; } - // Note: since compliance version >= 21 the value 255 is not any more endless. + // Note: since compliance version >= 21 the value 255 is not any more Qt::endless. // we need to refresh the command on timeout ZigbeeNetworkReply *reply = setPermitJoin(Zigbee::BroadcastAddressAllRouters, duration); diff --git a/libnymea-zigbee/backends/nxp/interface/nxp.h b/libnymea-zigbee/backends/nxp/interface/nxp.h index 624a7c6..6fededa 100644 --- a/libnymea-zigbee/backends/nxp/interface/nxp.h +++ b/libnymea-zigbee/backends/nxp/interface/nxp.h @@ -9,7 +9,7 @@ class Nxp public: enum Command { CommandGetVersion = 0x00, - CommandGetDeviceState = 0x01, + CommandGetControllerState = 0x01, CommandSoftReset = 0x02 }; Q_ENUM(Command) diff --git a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxp.cpp b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxp.cpp index 9bc115c..a19d83c 100644 --- a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxp.cpp +++ b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxp.cpp @@ -163,7 +163,7 @@ void ZigbeeInterfaceNxp::onReadyRead() // Read each byte until we get END byte, then unescape the package for (int i = 0; i < data.length(); i++) { quint8 byte = static_cast(data.at(i)); - qCDebug(dcZigbeeInterfaceTraffic()) << ZigbeeUtils::convertByteToHexString(byte); + qCDebug(dcZigbeeInterfaceTraffic()) << "[in] " << ZigbeeUtils::convertByteToHexString(byte); if (byte == ProtocolByteEnd) { // If there is no data...continue since it might be a starting END byte if (m_dataBuffer.isEmpty()) @@ -235,6 +235,10 @@ void ZigbeeInterfaceNxp::sendPackage(const QByteArray &package) // Send the data qCDebug(dcZigbeeInterfaceTraffic()) << "-->" << ZigbeeUtils::convertByteArrayToHexString(data); + for (int i = 0; i < data.length(); i++) { + qCDebug(dcZigbeeInterfaceTraffic()) << "[out]" << ZigbeeUtils::convertByteToHexString(data.at(i)); + } + if (m_serialPort->write(data) < 0) { qCWarning(dcZigbeeInterface()) << "Could not stream byte" << ZigbeeUtils::convertByteArrayToHexString(data); } diff --git a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp index dcd443e..a865511 100644 --- a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp +++ b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.cpp @@ -62,6 +62,12 @@ ZigbeeInterfaceNxpReply::ZigbeeInterfaceNxpReply(Nxp::Command command, QObject * connect(m_timer, &QTimer::timeout, this, &ZigbeeInterfaceNxpReply::onTimeout); } +void ZigbeeInterfaceNxpReply::setFinished() +{ + m_timer->stop(); + emit finished(); +} + void ZigbeeInterfaceNxpReply::onTimeout() { m_timeout = true; diff --git a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.h b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.h index 2140d4b..42f829a 100644 --- a/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.h +++ b/libnymea-zigbee/backends/nxp/interface/zigbeeinterfacenxpreply.h @@ -47,6 +47,8 @@ private: Nxp::Status m_status = Nxp::StatusUnknownCommand; // FIXME QByteArray m_responseData; + void setFinished(); + private slots: void onTimeout(); diff --git a/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.cpp b/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.cpp index f2d9bc7..13dd541 100644 --- a/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.cpp +++ b/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.cpp @@ -17,6 +17,11 @@ ZigbeeBridgeControllerNxp::~ZigbeeBridgeControllerNxp() qCDebug(dcZigbeeController()) << "Destroy controller"; } +ZigbeeBridgeControllerNxp::ControllerState ZigbeeBridgeControllerNxp::controllerState() const +{ + return m_controllerState; +} + ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestVersion() { QByteArray message; @@ -29,6 +34,18 @@ ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestVersion() return createReply(Nxp::CommandGetVersion, m_sequenceNumber, "Request controller version", message, this); } +ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestControllerState() +{ + QByteArray message; + QDataStream stream(&message, QIODevice::WriteOnly); + stream.setByteOrder(QDataStream::LittleEndian); + stream << static_cast(Nxp::CommandGetControllerState); + stream << static_cast(m_sequenceNumber++); + stream << static_cast(0); // Frame length + + return createReply(Nxp::CommandGetControllerState, m_sequenceNumber, "Request controller state", message, this); +} + ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestSoftResetController() { QByteArray message; @@ -56,6 +73,7 @@ ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::createReply(Nxp::Command com // Auto delete the object on finished connect(reply, &ZigbeeInterfaceNxpReply::finished, reply, [reply](){ + qCDebug(dcZigbeeController()) << "Interface reply finished" << reply->command() << reply->sequenceNumber() << reply->status(); reply->deleteLater(); }); @@ -82,26 +100,34 @@ void ZigbeeBridgeControllerNxp::onInterfacePackageReceived(const QByteArray &pac quint16 payloadLength = 0; stream >> payloadLength; QByteArray data = package.mid(4, payloadLength); - if (package.length() < payloadLength + 4) { + if (package.length() != payloadLength + 4) { qCWarning(dcZigbeeController()) << "Invalid package length received" << ZigbeeUtils::convertByteArrayToHexString(package) << payloadLength; return; } + Nxp::Notification notification = static_cast(commandInt); //qCDebug(dcZigbeeController()) << "Interface notification received" << notification << "SQN:" << sequenceNumber << ZigbeeUtils::convertByteArrayToHexString(data); - if (notification == Nxp::NotificationDebugMessage) { + switch (notification) { + case Nxp::NotificationDebugMessage: if (data.isEmpty()) { qCWarning(dcZigbeeController()) << "Received empty debug log notification"; return; } - Nxp::LogLevel logLevel = static_cast(data.at(0)); - qCDebug(dcZigbeeController()) << "DEBUG" << logLevel << qUtf8Printable(data.right(data.length() - 1)); + qCDebug(dcZigbeeController()) << "DEBUG" << static_cast(data.at(0)) << qUtf8Printable(data.right(data.length() - 1)); + break; + case Nxp::NotificationDeviceStatusChanged: + m_controllerState = static_cast(data.at(0)); + qCDebug(dcZigbeeController()) << "Controller state changed" << m_controllerState; + emit controllerStateChanged(m_controllerState); + break; + default: + emit interfaceNotificationReceived(notification, data); + break; } - - emit interfaceNotificationReceived(notification, data); } else { quint8 statusInt = 0; quint16 payloadLength = 0; stream >> statusInt >> payloadLength; - if (package.length() < payloadLength + 5) { + if (package.length() != payloadLength + 5) { qCWarning(dcZigbeeController()) << "Invalid package length received" << ZigbeeUtils::convertByteArrayToHexString(package) << payloadLength; return; } @@ -117,7 +143,9 @@ void ZigbeeBridgeControllerNxp::onInterfacePackageReceived(const QByteArray &pac } else { qCWarning(dcZigbeeController()) << "Received interface response for a pending sequence number but the command does not match the request." << command << reply->command(); } - reply->finished(); + reply->setFinished(); + } else { + qCWarning(dcZigbeeController()) << "Received a response for a non pending reply. There is no pending reply for command" << command << "SQN:" << sequenceNumber; } } } diff --git a/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.h b/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.h index 7640470..d5ab5de 100644 --- a/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.h +++ b/libnymea-zigbee/backends/nxp/zigbeebridgecontrollernxp.h @@ -21,21 +21,34 @@ public: explicit ZigbeeBridgeControllerNxp(QObject *parent = nullptr); ~ZigbeeBridgeControllerNxp() override; + enum ControllerState { + ControllerStateRunning = 0x00, + ControllerStateBooting = 0x01, + ControllerStateStarting = 0x02, + ControllerStateRunningUninitialized = 0x03, + ControllerStateNotRunning = 0x04 + }; + Q_ENUM(ControllerState) + + ControllerState controllerState() const; + // Controllere requests ZigbeeInterfaceNxpReply *requestVersion(); + ZigbeeInterfaceNxpReply *requestControllerState(); ZigbeeInterfaceNxpReply *requestSoftResetController(); signals: + void controllerStateChanged(ControllerState controllerState); void interfaceNotificationReceived(Nxp::Notification notification, const QByteArray &data); private: ZigbeeInterfaceNxp *m_interface = nullptr; + ControllerState m_controllerState = ControllerStateNotRunning; quint8 m_sequenceNumber = 0; QHash m_pendingReplies; ZigbeeInterfaceNxpReply *createReply(Nxp::Command command, quint8 sequenceNumber, const QString &requestName, const QByteArray &requestData, QObject *parent); - private slots: void onInterfaceAvailableChanged(bool available); void onInterfacePackageReceived(const QByteArray &package); diff --git a/libnymea-zigbee/backends/nxp/zigbeenetworknxp.cpp b/libnymea-zigbee/backends/nxp/zigbeenetworknxp.cpp index eaec43a..476c10f 100644 --- a/libnymea-zigbee/backends/nxp/zigbeenetworknxp.cpp +++ b/libnymea-zigbee/backends/nxp/zigbeenetworknxp.cpp @@ -7,6 +7,7 @@ ZigbeeNetworkNxp::ZigbeeNetworkNxp(QObject *parent) : { m_controller = new ZigbeeBridgeControllerNxp(this); connect(m_controller, &ZigbeeBridgeControllerNxp::availableChanged, this, &ZigbeeNetworkNxp::onControllerAvailableChanged); + connect(m_controller, &ZigbeeBridgeControllerNxp::controllerStateChanged, this, &ZigbeeNetworkNxp::onControllerStateChanged); //connect(m_controller, &ZigbeeBridgeControllerNxp::apsDataConfirmReceived, this, &ZigbeeNetworkNxp::onApsDataConfirmReceived); //connect(m_controller, &ZigbeeBridgeControllerNxp::apsDataIndicationReceived, this, &ZigbeeNetworkNxp::onApsDataIndicationReceived); @@ -38,12 +39,36 @@ void ZigbeeNetworkNxp::onControllerAvailableChanged(bool available) qCDebug(dcZigbeeNetwork()) << "Controller is" << (available ? "now available" : "not available any more"); if (available) { - reset(); + reset(); + } +} -// ZigbeeInterfaceNxpReply *reply = m_controller->requestVersion(); -// connect(reply, &ZigbeeInterfaceNxpReply::finished, this, [](){ -// qCDebug(dcZigbeeNetwork()) << "Version reply finished"; -// }); +void ZigbeeNetworkNxp::onControllerStateChanged(ZigbeeBridgeControllerNxp::ControllerState controllerState) +{ + switch (controllerState) { + case ZigbeeBridgeControllerNxp::ControllerStateRunning: { + qCDebug(dcZigbeeNetwork()) << "Request controller version"; + ZigbeeInterfaceNxpReply *reply = m_controller->requestVersion(); + connect(reply, &ZigbeeInterfaceNxpReply::finished, this, [reply](){ + qCDebug(dcZigbeeNetwork()) << "Version reply finished" << reply->status(); + + }); + break; + } + case ZigbeeBridgeControllerNxp::ControllerStateStarting: + break; + case ZigbeeBridgeControllerNxp::ControllerStateBooting: + break; + case ZigbeeBridgeControllerNxp::ControllerStateRunningUninitialized: { + qCDebug(dcZigbeeNetwork()) << "Request controller version"; + ZigbeeInterfaceNxpReply *reply = m_controller->requestVersion(); + connect(reply, &ZigbeeInterfaceNxpReply::finished, this, [reply](){ + qCDebug(dcZigbeeNetwork()) << "Version reply finished" << reply->status(); + }); + break; + } + case ZigbeeBridgeControllerNxp::ControllerStateNotRunning: + break; } } diff --git a/libnymea-zigbee/backends/nxp/zigbeenetworknxp.h b/libnymea-zigbee/backends/nxp/zigbeenetworknxp.h index 6dbcfa9..4a5f138 100644 --- a/libnymea-zigbee/backends/nxp/zigbeenetworknxp.h +++ b/libnymea-zigbee/backends/nxp/zigbeenetworknxp.h @@ -26,6 +26,7 @@ private: private slots: void onControllerAvailableChanged(bool available); + void onControllerStateChanged(ZigbeeBridgeControllerNxp::ControllerState controllerState); protected: void setPermitJoiningInternal(bool permitJoining) override; diff --git a/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp b/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp index dedd7b2..d2e9483 100644 --- a/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp +++ b/libnymea-zigbee/zdo/zigbeedeviceprofile.cpp @@ -206,15 +206,15 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::Adpu &deviceAdpu) QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NodeDescriptor &nodeDescriptor) { - debug.nospace() << "NodeDescriptor(" << nodeDescriptor.nodeType << ")" << endl; - debug.nospace() << " Complex descriptor available: " << nodeDescriptor.complexDescriptorAvailable << endl; - debug.nospace() << " User descriptor available: " << nodeDescriptor.userDescriptorAvailable << endl; - debug.nospace() << " " << nodeDescriptor.frequencyBand << endl; + debug.nospace() << "NodeDescriptor(" << nodeDescriptor.nodeType << ")" << Qt::endl; + debug.nospace() << " Complex descriptor available: " << nodeDescriptor.complexDescriptorAvailable << Qt::endl; + debug.nospace() << " User descriptor available: " << nodeDescriptor.userDescriptorAvailable << Qt::endl; + debug.nospace() << " " << nodeDescriptor.frequencyBand << Qt::endl; debug.nospace() << " " << nodeDescriptor.macCapabilities; - debug.nospace() << " Manufacturer code: " << ZigbeeUtils::convertUint16ToHexString(nodeDescriptor.manufacturerCode) << "(" << nodeDescriptor.manufacturerCode << ")" << endl; - debug.nospace() << " Maximum buffer size: " << nodeDescriptor.maximumBufferSize << endl; - debug.nospace() << " Maximum RX size: " << nodeDescriptor.maximumRxSize << endl; - debug.nospace() << " Maximum TX size: " << nodeDescriptor.maximumTxSize << endl; + debug.nospace() << " Manufacturer code: " << ZigbeeUtils::convertUint16ToHexString(nodeDescriptor.manufacturerCode) << "(" << nodeDescriptor.manufacturerCode << ")" << Qt::endl; + debug.nospace() << " Maximum buffer size: " << nodeDescriptor.maximumBufferSize << Qt::endl; + debug.nospace() << " Maximum RX size: " << nodeDescriptor.maximumRxSize << Qt::endl; + debug.nospace() << " Maximum TX size: " << nodeDescriptor.maximumTxSize << Qt::endl; debug.nospace() << " " << nodeDescriptor.serverMask; debug.nospace() << " " << nodeDescriptor.descriptorCapabilities; return debug; @@ -222,43 +222,43 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NodeDescriptor &nodeD QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::MacCapabilities &macCapabilities) { - debug.nospace() << "MacCapabilities(" << ZigbeeUtils::convertByteToHexString(macCapabilities.flag) << ")" << endl; - debug.nospace() << " Alternate PAN Coordinator: " << macCapabilities.alternatePanCoordinator << endl; - debug.nospace() << " " << macCapabilities.deviceType << endl; - debug.nospace() << " Power source main power: " << macCapabilities.powerSourceFlagMainPower << endl; - debug.nospace() << " Receiver on when idle: " << macCapabilities.receiverOnWhenIdle << endl; - debug.nospace() << " Security capability: " << macCapabilities.securityCapability << endl; - debug.nospace() << " Allocate address: " << macCapabilities.allocateAddress << endl; + debug.nospace() << "MacCapabilities(" << ZigbeeUtils::convertByteToHexString(macCapabilities.flag) << ")" << Qt::endl; + debug.nospace() << " Alternate PAN Coordinator: " << macCapabilities.alternatePanCoordinator << Qt::endl; + debug.nospace() << " " << macCapabilities.deviceType << Qt::endl; + debug.nospace() << " Power source main power: " << macCapabilities.powerSourceFlagMainPower << Qt::endl; + debug.nospace() << " Receiver on when idle: " << macCapabilities.receiverOnWhenIdle << Qt::endl; + debug.nospace() << " Security capability: " << macCapabilities.securityCapability << Qt::endl; + debug.nospace() << " Allocate address: " << macCapabilities.allocateAddress << Qt::endl; return debug; } QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::ServerMask &serverMask) { - debug.nospace() << "ServerMask(" << ZigbeeUtils::convertUint16ToHexString(serverMask.serverMaskFlag) << ")" << endl; - debug.nospace() << " Primary trust center: " << serverMask.primaryTrustCenter << endl; - debug.nospace() << " Backup trust center: " << serverMask.backupTrustCenter << endl; - debug.nospace() << " Primary binding cache: " << serverMask.primaryBindingCache << endl; - debug.nospace() << " Backup binding cache: " << serverMask.backupBindingCache << endl; - debug.nospace() << " Primary discovery cache: " << serverMask.primaryDiscoveryCache << endl; - debug.nospace() << " Backup discovery cache: " << serverMask.backupDiscoveryCache << endl; - debug.nospace() << " Network manager: " << serverMask.networkManager << endl; + debug.nospace() << "ServerMask(" << ZigbeeUtils::convertUint16ToHexString(serverMask.serverMaskFlag) << ")" << Qt::endl; + debug.nospace() << " Primary trust center: " << serverMask.primaryTrustCenter << Qt::endl; + debug.nospace() << " Backup trust center: " << serverMask.backupTrustCenter << Qt::endl; + debug.nospace() << " Primary binding cache: " << serverMask.primaryBindingCache << Qt::endl; + debug.nospace() << " Backup binding cache: " << serverMask.backupBindingCache << Qt::endl; + debug.nospace() << " Primary discovery cache: " << serverMask.primaryDiscoveryCache << Qt::endl; + debug.nospace() << " Backup discovery cache: " << serverMask.backupDiscoveryCache << Qt::endl; + debug.nospace() << " Network manager: " << serverMask.networkManager << Qt::endl; return debug; } QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::DescriptorCapabilities &descriptorCapabilities) { - debug.nospace() << "DescriptorCapabilities(" << ZigbeeUtils::convertByteToHexString(descriptorCapabilities.descriptorCapabilitiesFlag) << ")" << endl; - debug.nospace() << " Extended active endpoint list available: " << descriptorCapabilities.extendedActiveEndpointListAvailable << endl; - debug.nospace() << " Extended simple descriptor list available: " << descriptorCapabilities.extendedSimpleDescriptorListAvailable << endl; + debug.nospace() << "DescriptorCapabilities(" << ZigbeeUtils::convertByteToHexString(descriptorCapabilities.descriptorCapabilitiesFlag) << ")" << Qt::endl; + debug.nospace() << " Extended active endpoint list available: " << descriptorCapabilities.extendedActiveEndpointListAvailable << Qt::endl; + debug.nospace() << " Extended simple descriptor list available: " << descriptorCapabilities.extendedSimpleDescriptorListAvailable << Qt::endl; return debug; } QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::PowerDescriptor &powerDescriptor) { - debug.nospace() << "PowerDescriptor(" << ZigbeeUtils::convertByteToHexString(powerDescriptor.powerDescriptoFlag) << ")" << endl; - debug.nospace() << " Power mode: " << powerDescriptor.powerMode << endl; - debug.nospace() << " Available power sources: " << powerDescriptor.availablePowerSources << endl; - debug.nospace() << " Power source: " << powerDescriptor.powerSource << endl; - debug.nospace() << " Power level: " << powerDescriptor.powerLevel << endl; + debug.nospace() << "PowerDescriptor(" << ZigbeeUtils::convertByteToHexString(powerDescriptor.powerDescriptoFlag) << ")" << Qt::endl; + debug.nospace() << " Power mode: " << powerDescriptor.powerMode << Qt::endl; + debug.nospace() << " Available power sources: " << powerDescriptor.availablePowerSources << Qt::endl; + debug.nospace() << " Power source: " << powerDescriptor.powerSource << Qt::endl; + debug.nospace() << " Power level: " << powerDescriptor.powerLevel << Qt::endl; return debug; } diff --git a/libnymea-zigbee/zigbeenetwork.cpp b/libnymea-zigbee/zigbeenetwork.cpp index 3f2d162..cb45ad4 100644 --- a/libnymea-zigbee/zigbeenetwork.cpp +++ b/libnymea-zigbee/zigbeenetwork.cpp @@ -542,26 +542,26 @@ QDebug operator<<(QDebug debug, ZigbeeNetwork *network) { debug.nospace().noquote() << "ZigbeeNetwork (" << ZigbeeUtils::convertUint16ToHexString(network->panId()) << ", Channel " << network->channel() - << ")" << endl; + << ")" << Qt::endl; foreach (ZigbeeNode *node, network->nodes()) { - debug.nospace().noquote() << " ---> " << node << endl; + debug.nospace().noquote() << " ---> " << node << Qt::endl; debug.nospace().noquote() << " " << node->nodeDescriptor(); debug.nospace().noquote() << " " << node->powerDescriptor(); - debug.nospace().noquote() << " Endpoints: " << node->endpoints().count() << endl; + debug.nospace().noquote() << " Endpoints: " << node->endpoints().count() << Qt::endl; foreach (ZigbeeNodeEndpoint *endpoint, node->endpoints()) { - debug.nospace().noquote() << " - " << endpoint << endl; - debug.nospace().noquote() << " Input clusters:" << endl; + debug.nospace().noquote() << " - " << endpoint << Qt::endl; + debug.nospace().noquote() << " Input clusters:" << Qt::endl; foreach (ZigbeeCluster *cluster, endpoint->inputClusters()) { - debug.nospace().noquote() << " - " << cluster << endl; + debug.nospace().noquote() << " - " << cluster << Qt::endl; foreach (const ZigbeeClusterAttribute &attribute, cluster->attributes()) { - debug.nospace().noquote() << " - " << attribute << endl; + debug.nospace().noquote() << " - " << attribute << Qt::endl; } } - debug.nospace().noquote() << " Output clusters:" << endl; + debug.nospace().noquote() << " Output clusters:" << Qt::endl; foreach (ZigbeeCluster *cluster, endpoint->outputClusters()) { - debug.nospace().noquote() << " - " << cluster << endl; + debug.nospace().noquote() << " - " << cluster << Qt::endl; foreach (const ZigbeeClusterAttribute &attribute, cluster->attributes()) { - debug.nospace().noquote() << " - " << attribute << endl; + debug.nospace().noquote() << " - " << attribute << Qt::endl; } } } diff --git a/zigbee-cli/zigbee-cli.pro b/zigbee-cli/zigbee-cli.pro index b2f4237..858e29e 100644 --- a/zigbee-cli/zigbee-cli.pro +++ b/zigbee-cli/zigbee-cli.pro @@ -7,6 +7,9 @@ TARGET = zigbee-cli LIBS += -L$$buildDir/libnymea-zigbee -lnymea-zigbee1 +win32:LIBS += -L$$buildDir/libnymea-zigbee/debug -lnymea-zigbee1 + + INCLUDEPATH += ../libnymea-zigbee/ target.path = /usr/bin