Update to qt 5.15 and continue device implementation

This commit is contained in:
Simon Stürz 2020-10-05 16:37:08 +02:00
parent 40ce1667c6
commit ae306b2e77
13 changed files with 155 additions and 73 deletions

View File

@ -1045,19 +1045,19 @@ QDebug operator<<(QDebug debug, const DeconzDeviceState &deviceState)
QDebug operator<<(QDebug debug, const DeconzNetworkConfiguration &configuration) QDebug operator<<(QDebug debug, const DeconzNetworkConfiguration &configuration)
{ {
debug.nospace() << "Network configuration:" << endl; debug.nospace() << "Network configuration:" << Qt::endl;
debug.nospace() << " - Node type:" << configuration.nodeType << endl; debug.nospace() << " - Node type:" << configuration.nodeType << Qt::endl;
debug.nospace() << " - IEEE address:" << configuration.ieeeAddress.toString() << endl; debug.nospace() << " - IEEE address:" << configuration.ieeeAddress.toString() << Qt::endl;
debug.nospace() << " - NWK address:" << ZigbeeUtils::convertUint16ToHexString(configuration.shortAddress) << endl; debug.nospace() << " - NWK address:" << ZigbeeUtils::convertUint16ToHexString(configuration.shortAddress) << Qt::endl;
debug.nospace() << " - PAN ID:" << ZigbeeUtils::convertUint16ToHexString(configuration.panId) << endl; debug.nospace() << " - PAN ID:" << ZigbeeUtils::convertUint16ToHexString(configuration.panId) << Qt::endl;
debug.nospace() << " - Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.extendedPanId) << endl; debug.nospace() << " - Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.extendedPanId) << Qt::endl;
debug.nospace() << " - APS Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.apsExtendedPanId) << endl; debug.nospace() << " - APS Extended PAN ID:" << ZigbeeUtils::convertUint64ToHexString(configuration.apsExtendedPanId) << Qt::endl;
debug.nospace() << " - Trust center IEEE address:" << configuration.trustCenterAddress.toString() << endl; debug.nospace() << " - Trust center IEEE address:" << configuration.trustCenterAddress.toString() << Qt::endl;
debug.nospace() << " - Channel mask:" << ZigbeeChannelMask(configuration.channelMask) << endl; debug.nospace() << " - Channel mask:" << ZigbeeChannelMask(configuration.channelMask) << Qt::endl;
debug.nospace() << " - Channel:" << configuration.currentChannel << endl; debug.nospace() << " - Channel:" << configuration.currentChannel << Qt::endl;
debug.nospace() << " - Security mode:" << configuration.securityMode << endl; debug.nospace() << " - Security mode:" << configuration.securityMode << Qt::endl;
debug.nospace() << " - Protocol version:" << ZigbeeUtils::convertUint16ToHexString(configuration.protocolVersion) << endl; debug.nospace() << " - Protocol version:" << ZigbeeUtils::convertUint16ToHexString(configuration.protocolVersion) << Qt::endl;
debug.nospace() << " - Network update ID:" << ZigbeeUtils::convertByteToHexString(configuration.networkUpdateId) << endl; debug.nospace() << " - Network update ID:" << ZigbeeUtils::convertByteToHexString(configuration.networkUpdateId) << Qt::endl;
debug.nospace() << " - Watchdog TTL:" << configuration.watchdogTimeout << endl; debug.nospace() << " - Watchdog TTL:" << configuration.watchdogTimeout << Qt::endl;
return debug.space(); return debug.space();
} }

View File

@ -108,7 +108,7 @@ ZigbeeNetworkReply *ZigbeeNetworkDeconz::setPermitJoin(quint16 shortAddress, qui
stream << request.requestId(); stream << request.requestId();
stream << duration; stream << duration;
stream << static_cast<quint8>(0x01); // TrustCenter significance, always force to 1 according to Spec. stream << static_cast<quint8>(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); request.setAsdu(asdu);
qCDebug(dcZigbeeNetwork()) << "Send permit join request" << ZigbeeUtils::convertUint16ToHexString(request.destinationShortAddress()) << duration << "s"; qCDebug(dcZigbeeNetwork()) << "Send permit join request" << ZigbeeUtils::convertUint16ToHexString(request.destinationShortAddress()) << duration << "s";
@ -372,7 +372,7 @@ void ZigbeeNetworkDeconz::setPermitJoiningInternal(bool permitJoining)
duration = 254; 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 // we need to refresh the command on timeout
ZigbeeNetworkReply *reply = setPermitJoin(Zigbee::BroadcastAddressAllRouters, duration); ZigbeeNetworkReply *reply = setPermitJoin(Zigbee::BroadcastAddressAllRouters, duration);

View File

@ -9,7 +9,7 @@ class Nxp
public: public:
enum Command { enum Command {
CommandGetVersion = 0x00, CommandGetVersion = 0x00,
CommandGetDeviceState = 0x01, CommandGetControllerState = 0x01,
CommandSoftReset = 0x02 CommandSoftReset = 0x02
}; };
Q_ENUM(Command) Q_ENUM(Command)

View File

@ -163,7 +163,7 @@ void ZigbeeInterfaceNxp::onReadyRead()
// Read each byte until we get END byte, then unescape the package // Read each byte until we get END byte, then unescape the package
for (int i = 0; i < data.length(); i++) { for (int i = 0; i < data.length(); i++) {
quint8 byte = static_cast<quint8>(data.at(i)); quint8 byte = static_cast<quint8>(data.at(i));
qCDebug(dcZigbeeInterfaceTraffic()) << ZigbeeUtils::convertByteToHexString(byte); qCDebug(dcZigbeeInterfaceTraffic()) << "[in] " << ZigbeeUtils::convertByteToHexString(byte);
if (byte == ProtocolByteEnd) { if (byte == ProtocolByteEnd) {
// If there is no data...continue since it might be a starting END byte // If there is no data...continue since it might be a starting END byte
if (m_dataBuffer.isEmpty()) if (m_dataBuffer.isEmpty())
@ -235,6 +235,10 @@ void ZigbeeInterfaceNxp::sendPackage(const QByteArray &package)
// Send the data // Send the data
qCDebug(dcZigbeeInterfaceTraffic()) << "-->" << ZigbeeUtils::convertByteArrayToHexString(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) { if (m_serialPort->write(data) < 0) {
qCWarning(dcZigbeeInterface()) << "Could not stream byte" << ZigbeeUtils::convertByteArrayToHexString(data); qCWarning(dcZigbeeInterface()) << "Could not stream byte" << ZigbeeUtils::convertByteArrayToHexString(data);
} }

View File

@ -62,6 +62,12 @@ ZigbeeInterfaceNxpReply::ZigbeeInterfaceNxpReply(Nxp::Command command, QObject *
connect(m_timer, &QTimer::timeout, this, &ZigbeeInterfaceNxpReply::onTimeout); connect(m_timer, &QTimer::timeout, this, &ZigbeeInterfaceNxpReply::onTimeout);
} }
void ZigbeeInterfaceNxpReply::setFinished()
{
m_timer->stop();
emit finished();
}
void ZigbeeInterfaceNxpReply::onTimeout() void ZigbeeInterfaceNxpReply::onTimeout()
{ {
m_timeout = true; m_timeout = true;

View File

@ -47,6 +47,8 @@ private:
Nxp::Status m_status = Nxp::StatusUnknownCommand; // FIXME Nxp::Status m_status = Nxp::StatusUnknownCommand; // FIXME
QByteArray m_responseData; QByteArray m_responseData;
void setFinished();
private slots: private slots:
void onTimeout(); void onTimeout();

View File

@ -17,6 +17,11 @@ ZigbeeBridgeControllerNxp::~ZigbeeBridgeControllerNxp()
qCDebug(dcZigbeeController()) << "Destroy controller"; qCDebug(dcZigbeeController()) << "Destroy controller";
} }
ZigbeeBridgeControllerNxp::ControllerState ZigbeeBridgeControllerNxp::controllerState() const
{
return m_controllerState;
}
ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestVersion() ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestVersion()
{ {
QByteArray message; QByteArray message;
@ -29,6 +34,18 @@ ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestVersion()
return createReply(Nxp::CommandGetVersion, m_sequenceNumber, "Request controller version", message, this); 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<quint8>(Nxp::CommandGetControllerState);
stream << static_cast<quint8>(m_sequenceNumber++);
stream << static_cast<quint16>(0); // Frame length
return createReply(Nxp::CommandGetControllerState, m_sequenceNumber, "Request controller state", message, this);
}
ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestSoftResetController() ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::requestSoftResetController()
{ {
QByteArray message; QByteArray message;
@ -56,6 +73,7 @@ ZigbeeInterfaceNxpReply *ZigbeeBridgeControllerNxp::createReply(Nxp::Command com
// Auto delete the object on finished // Auto delete the object on finished
connect(reply, &ZigbeeInterfaceNxpReply::finished, reply, [reply](){ connect(reply, &ZigbeeInterfaceNxpReply::finished, reply, [reply](){
qCDebug(dcZigbeeController()) << "Interface reply finished" << reply->command() << reply->sequenceNumber() << reply->status();
reply->deleteLater(); reply->deleteLater();
}); });
@ -82,26 +100,34 @@ void ZigbeeBridgeControllerNxp::onInterfacePackageReceived(const QByteArray &pac
quint16 payloadLength = 0; quint16 payloadLength = 0;
stream >> payloadLength; stream >> payloadLength;
QByteArray data = package.mid(4, 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; qCWarning(dcZigbeeController()) << "Invalid package length received" << ZigbeeUtils::convertByteArrayToHexString(package) << payloadLength;
return; return;
} }
Nxp::Notification notification = static_cast<Nxp::Notification>(commandInt); Nxp::Notification notification = static_cast<Nxp::Notification>(commandInt);
//qCDebug(dcZigbeeController()) << "Interface notification received" << notification << "SQN:" << sequenceNumber << ZigbeeUtils::convertByteArrayToHexString(data); //qCDebug(dcZigbeeController()) << "Interface notification received" << notification << "SQN:" << sequenceNumber << ZigbeeUtils::convertByteArrayToHexString(data);
if (notification == Nxp::NotificationDebugMessage) { switch (notification) {
case Nxp::NotificationDebugMessage:
if (data.isEmpty()) { if (data.isEmpty()) {
qCWarning(dcZigbeeController()) << "Received empty debug log notification"; qCWarning(dcZigbeeController()) << "Received empty debug log notification";
return; return;
} }
Nxp::LogLevel logLevel = static_cast<Nxp::LogLevel>(data.at(0)); qCDebug(dcZigbeeController()) << "DEBUG" << static_cast<Nxp::LogLevel>(data.at(0)) << qUtf8Printable(data.right(data.length() - 1));
qCDebug(dcZigbeeController()) << "DEBUG" << logLevel << qUtf8Printable(data.right(data.length() - 1)); break;
case Nxp::NotificationDeviceStatusChanged:
m_controllerState = static_cast<ControllerState>(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 { } else {
quint8 statusInt = 0; quint16 payloadLength = 0; quint8 statusInt = 0; quint16 payloadLength = 0;
stream >> statusInt >> payloadLength; stream >> statusInt >> payloadLength;
if (package.length() < payloadLength + 5) { if (package.length() != payloadLength + 5) {
qCWarning(dcZigbeeController()) << "Invalid package length received" << ZigbeeUtils::convertByteArrayToHexString(package) << payloadLength; qCWarning(dcZigbeeController()) << "Invalid package length received" << ZigbeeUtils::convertByteArrayToHexString(package) << payloadLength;
return; return;
} }
@ -117,7 +143,9 @@ void ZigbeeBridgeControllerNxp::onInterfacePackageReceived(const QByteArray &pac
} else { } else {
qCWarning(dcZigbeeController()) << "Received interface response for a pending sequence number but the command does not match the request." << command << reply->command(); 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;
} }
} }
} }

View File

@ -21,21 +21,34 @@ public:
explicit ZigbeeBridgeControllerNxp(QObject *parent = nullptr); explicit ZigbeeBridgeControllerNxp(QObject *parent = nullptr);
~ZigbeeBridgeControllerNxp() override; ~ZigbeeBridgeControllerNxp() override;
enum ControllerState {
ControllerStateRunning = 0x00,
ControllerStateBooting = 0x01,
ControllerStateStarting = 0x02,
ControllerStateRunningUninitialized = 0x03,
ControllerStateNotRunning = 0x04
};
Q_ENUM(ControllerState)
ControllerState controllerState() const;
// Controllere requests // Controllere requests
ZigbeeInterfaceNxpReply *requestVersion(); ZigbeeInterfaceNxpReply *requestVersion();
ZigbeeInterfaceNxpReply *requestControllerState();
ZigbeeInterfaceNxpReply *requestSoftResetController(); ZigbeeInterfaceNxpReply *requestSoftResetController();
signals: signals:
void controllerStateChanged(ControllerState controllerState);
void interfaceNotificationReceived(Nxp::Notification notification, const QByteArray &data); void interfaceNotificationReceived(Nxp::Notification notification, const QByteArray &data);
private: private:
ZigbeeInterfaceNxp *m_interface = nullptr; ZigbeeInterfaceNxp *m_interface = nullptr;
ControllerState m_controllerState = ControllerStateNotRunning;
quint8 m_sequenceNumber = 0; quint8 m_sequenceNumber = 0;
QHash<quint8, ZigbeeInterfaceNxpReply *> m_pendingReplies; QHash<quint8, ZigbeeInterfaceNxpReply *> m_pendingReplies;
ZigbeeInterfaceNxpReply *createReply(Nxp::Command command, quint8 sequenceNumber, const QString &requestName, const QByteArray &requestData, QObject *parent); ZigbeeInterfaceNxpReply *createReply(Nxp::Command command, quint8 sequenceNumber, const QString &requestName, const QByteArray &requestData, QObject *parent);
private slots: private slots:
void onInterfaceAvailableChanged(bool available); void onInterfaceAvailableChanged(bool available);
void onInterfacePackageReceived(const QByteArray &package); void onInterfacePackageReceived(const QByteArray &package);

View File

@ -7,6 +7,7 @@ ZigbeeNetworkNxp::ZigbeeNetworkNxp(QObject *parent) :
{ {
m_controller = new ZigbeeBridgeControllerNxp(this); m_controller = new ZigbeeBridgeControllerNxp(this);
connect(m_controller, &ZigbeeBridgeControllerNxp::availableChanged, this, &ZigbeeNetworkNxp::onControllerAvailableChanged); 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::apsDataConfirmReceived, this, &ZigbeeNetworkNxp::onApsDataConfirmReceived);
//connect(m_controller, &ZigbeeBridgeControllerNxp::apsDataIndicationReceived, this, &ZigbeeNetworkNxp::onApsDataIndicationReceived); //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"); qCDebug(dcZigbeeNetwork()) << "Controller is" << (available ? "now available" : "not available any more");
if (available) { if (available) {
reset(); reset();
}
}
// ZigbeeInterfaceNxpReply *reply = m_controller->requestVersion(); void ZigbeeNetworkNxp::onControllerStateChanged(ZigbeeBridgeControllerNxp::ControllerState controllerState)
// connect(reply, &ZigbeeInterfaceNxpReply::finished, this, [](){ {
// qCDebug(dcZigbeeNetwork()) << "Version reply finished"; 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;
} }
} }

View File

@ -26,6 +26,7 @@ private:
private slots: private slots:
void onControllerAvailableChanged(bool available); void onControllerAvailableChanged(bool available);
void onControllerStateChanged(ZigbeeBridgeControllerNxp::ControllerState controllerState);
protected: protected:
void setPermitJoiningInternal(bool permitJoining) override; void setPermitJoiningInternal(bool permitJoining) override;

View File

@ -206,15 +206,15 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::Adpu &deviceAdpu)
QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NodeDescriptor &nodeDescriptor) QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NodeDescriptor &nodeDescriptor)
{ {
debug.nospace() << "NodeDescriptor(" << nodeDescriptor.nodeType << ")" << endl; debug.nospace() << "NodeDescriptor(" << nodeDescriptor.nodeType << ")" << Qt::endl;
debug.nospace() << " Complex descriptor available: " << nodeDescriptor.complexDescriptorAvailable << endl; debug.nospace() << " Complex descriptor available: " << nodeDescriptor.complexDescriptorAvailable << Qt::endl;
debug.nospace() << " User descriptor available: " << nodeDescriptor.userDescriptorAvailable << endl; debug.nospace() << " User descriptor available: " << nodeDescriptor.userDescriptorAvailable << Qt::endl;
debug.nospace() << " " << nodeDescriptor.frequencyBand << endl; debug.nospace() << " " << nodeDescriptor.frequencyBand << Qt::endl;
debug.nospace() << " " << nodeDescriptor.macCapabilities; debug.nospace() << " " << nodeDescriptor.macCapabilities;
debug.nospace() << " Manufacturer code: " << ZigbeeUtils::convertUint16ToHexString(nodeDescriptor.manufacturerCode) << "(" << nodeDescriptor.manufacturerCode << ")" << endl; debug.nospace() << " Manufacturer code: " << ZigbeeUtils::convertUint16ToHexString(nodeDescriptor.manufacturerCode) << "(" << nodeDescriptor.manufacturerCode << ")" << Qt::endl;
debug.nospace() << " Maximum buffer size: " << nodeDescriptor.maximumBufferSize << endl; debug.nospace() << " Maximum buffer size: " << nodeDescriptor.maximumBufferSize << Qt::endl;
debug.nospace() << " Maximum RX size: " << nodeDescriptor.maximumRxSize << endl; debug.nospace() << " Maximum RX size: " << nodeDescriptor.maximumRxSize << Qt::endl;
debug.nospace() << " Maximum TX size: " << nodeDescriptor.maximumTxSize << endl; debug.nospace() << " Maximum TX size: " << nodeDescriptor.maximumTxSize << Qt::endl;
debug.nospace() << " " << nodeDescriptor.serverMask; debug.nospace() << " " << nodeDescriptor.serverMask;
debug.nospace() << " " << nodeDescriptor.descriptorCapabilities; debug.nospace() << " " << nodeDescriptor.descriptorCapabilities;
return debug; return debug;
@ -222,43 +222,43 @@ QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::NodeDescriptor &nodeD
QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::MacCapabilities &macCapabilities) QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::MacCapabilities &macCapabilities)
{ {
debug.nospace() << "MacCapabilities(" << ZigbeeUtils::convertByteToHexString(macCapabilities.flag) << ")" << endl; debug.nospace() << "MacCapabilities(" << ZigbeeUtils::convertByteToHexString(macCapabilities.flag) << ")" << Qt::endl;
debug.nospace() << " Alternate PAN Coordinator: " << macCapabilities.alternatePanCoordinator << endl; debug.nospace() << " Alternate PAN Coordinator: " << macCapabilities.alternatePanCoordinator << Qt::endl;
debug.nospace() << " " << macCapabilities.deviceType << endl; debug.nospace() << " " << macCapabilities.deviceType << Qt::endl;
debug.nospace() << " Power source main power: " << macCapabilities.powerSourceFlagMainPower << endl; debug.nospace() << " Power source main power: " << macCapabilities.powerSourceFlagMainPower << Qt::endl;
debug.nospace() << " Receiver on when idle: " << macCapabilities.receiverOnWhenIdle << endl; debug.nospace() << " Receiver on when idle: " << macCapabilities.receiverOnWhenIdle << Qt::endl;
debug.nospace() << " Security capability: " << macCapabilities.securityCapability << endl; debug.nospace() << " Security capability: " << macCapabilities.securityCapability << Qt::endl;
debug.nospace() << " Allocate address: " << macCapabilities.allocateAddress << endl; debug.nospace() << " Allocate address: " << macCapabilities.allocateAddress << Qt::endl;
return debug; return debug;
} }
QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::ServerMask &serverMask) QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::ServerMask &serverMask)
{ {
debug.nospace() << "ServerMask(" << ZigbeeUtils::convertUint16ToHexString(serverMask.serverMaskFlag) << ")" << endl; debug.nospace() << "ServerMask(" << ZigbeeUtils::convertUint16ToHexString(serverMask.serverMaskFlag) << ")" << Qt::endl;
debug.nospace() << " Primary trust center: " << serverMask.primaryTrustCenter << endl; debug.nospace() << " Primary trust center: " << serverMask.primaryTrustCenter << Qt::endl;
debug.nospace() << " Backup trust center: " << serverMask.backupTrustCenter << endl; debug.nospace() << " Backup trust center: " << serverMask.backupTrustCenter << Qt::endl;
debug.nospace() << " Primary binding cache: " << serverMask.primaryBindingCache << endl; debug.nospace() << " Primary binding cache: " << serverMask.primaryBindingCache << Qt::endl;
debug.nospace() << " Backup binding cache: " << serverMask.backupBindingCache << endl; debug.nospace() << " Backup binding cache: " << serverMask.backupBindingCache << Qt::endl;
debug.nospace() << " Primary discovery cache: " << serverMask.primaryDiscoveryCache << endl; debug.nospace() << " Primary discovery cache: " << serverMask.primaryDiscoveryCache << Qt::endl;
debug.nospace() << " Backup discovery cache: " << serverMask.backupDiscoveryCache << endl; debug.nospace() << " Backup discovery cache: " << serverMask.backupDiscoveryCache << Qt::endl;
debug.nospace() << " Network manager: " << serverMask.networkManager << endl; debug.nospace() << " Network manager: " << serverMask.networkManager << Qt::endl;
return debug; return debug;
} }
QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::DescriptorCapabilities &descriptorCapabilities) QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::DescriptorCapabilities &descriptorCapabilities)
{ {
debug.nospace() << "DescriptorCapabilities(" << ZigbeeUtils::convertByteToHexString(descriptorCapabilities.descriptorCapabilitiesFlag) << ")" << endl; debug.nospace() << "DescriptorCapabilities(" << ZigbeeUtils::convertByteToHexString(descriptorCapabilities.descriptorCapabilitiesFlag) << ")" << Qt::endl;
debug.nospace() << " Extended active endpoint list available: " << descriptorCapabilities.extendedActiveEndpointListAvailable << endl; debug.nospace() << " Extended active endpoint list available: " << descriptorCapabilities.extendedActiveEndpointListAvailable << Qt::endl;
debug.nospace() << " Extended simple descriptor list available: " << descriptorCapabilities.extendedSimpleDescriptorListAvailable << endl; debug.nospace() << " Extended simple descriptor list available: " << descriptorCapabilities.extendedSimpleDescriptorListAvailable << Qt::endl;
return debug; return debug;
} }
QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::PowerDescriptor &powerDescriptor) QDebug operator<<(QDebug debug, const ZigbeeDeviceProfile::PowerDescriptor &powerDescriptor)
{ {
debug.nospace() << "PowerDescriptor(" << ZigbeeUtils::convertByteToHexString(powerDescriptor.powerDescriptoFlag) << ")" << endl; debug.nospace() << "PowerDescriptor(" << ZigbeeUtils::convertByteToHexString(powerDescriptor.powerDescriptoFlag) << ")" << Qt::endl;
debug.nospace() << " Power mode: " << powerDescriptor.powerMode << endl; debug.nospace() << " Power mode: " << powerDescriptor.powerMode << Qt::endl;
debug.nospace() << " Available power sources: " << powerDescriptor.availablePowerSources << endl; debug.nospace() << " Available power sources: " << powerDescriptor.availablePowerSources << Qt::endl;
debug.nospace() << " Power source: " << powerDescriptor.powerSource << endl; debug.nospace() << " Power source: " << powerDescriptor.powerSource << Qt::endl;
debug.nospace() << " Power level: " << powerDescriptor.powerLevel << endl; debug.nospace() << " Power level: " << powerDescriptor.powerLevel << Qt::endl;
return debug; return debug;
} }

View File

@ -542,26 +542,26 @@ QDebug operator<<(QDebug debug, ZigbeeNetwork *network)
{ {
debug.nospace().noquote() << "ZigbeeNetwork (" << ZigbeeUtils::convertUint16ToHexString(network->panId()) debug.nospace().noquote() << "ZigbeeNetwork (" << ZigbeeUtils::convertUint16ToHexString(network->panId())
<< ", Channel " << network->channel() << ", Channel " << network->channel()
<< ")" << endl; << ")" << Qt::endl;
foreach (ZigbeeNode *node, network->nodes()) { 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->nodeDescriptor();
debug.nospace().noquote() << " " << node->powerDescriptor(); 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()) { foreach (ZigbeeNodeEndpoint *endpoint, node->endpoints()) {
debug.nospace().noquote() << " - " << endpoint << endl; debug.nospace().noquote() << " - " << endpoint << Qt::endl;
debug.nospace().noquote() << " Input clusters:" << endl; debug.nospace().noquote() << " Input clusters:" << Qt::endl;
foreach (ZigbeeCluster *cluster, endpoint->inputClusters()) { foreach (ZigbeeCluster *cluster, endpoint->inputClusters()) {
debug.nospace().noquote() << " - " << cluster << endl; debug.nospace().noquote() << " - " << cluster << Qt::endl;
foreach (const ZigbeeClusterAttribute &attribute, cluster->attributes()) { 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()) { foreach (ZigbeeCluster *cluster, endpoint->outputClusters()) {
debug.nospace().noquote() << " - " << cluster << endl; debug.nospace().noquote() << " - " << cluster << Qt::endl;
foreach (const ZigbeeClusterAttribute &attribute, cluster->attributes()) { foreach (const ZigbeeClusterAttribute &attribute, cluster->attributes()) {
debug.nospace().noquote() << " - " << attribute << endl; debug.nospace().noquote() << " - " << attribute << Qt::endl;
} }
} }
} }

View File

@ -7,6 +7,9 @@ TARGET = zigbee-cli
LIBS += -L$$buildDir/libnymea-zigbee -lnymea-zigbee1 LIBS += -L$$buildDir/libnymea-zigbee -lnymea-zigbee1
win32:LIBS += -L$$buildDir/libnymea-zigbee/debug -lnymea-zigbee1
INCLUDEPATH += ../libnymea-zigbee/ INCLUDEPATH += ../libnymea-zigbee/
target.path = /usr/bin target.path = /usr/bin