Give plugins access to the coordinator IEEE address for unicast bindings

This commit is contained in:
Simon Stürz 2020-11-25 13:05:27 +01:00
parent 527989fe7c
commit 8749789322
4 changed files with 17 additions and 0 deletions

View File

@ -118,6 +118,16 @@ ZigbeeNetwork::State ZigbeeHardwareResourceImplementation::networkState(const QU
return network->state();
}
ZigbeeAddress ZigbeeHardwareResourceImplementation::coordinatorAddress(const QUuid &networkUuid)
{
ZigbeeNetwork *network = m_zigbeeManager->zigbeeNetworks().value(networkUuid);
if (!network) {
qCWarning(dcZigbeeResource()) << "Network" << networkUuid << "not found.";
return ZigbeeAddress();
}
return network->coordinatorNode()->extendedAddress();
}
void ZigbeeHardwareResourceImplementation::setEnabled(bool enabled)
{
qCDebug(dcZigbeeResource()) << "Set" << (enabled ? "enabled" : "disabled");

View File

@ -54,6 +54,7 @@ public:
void removeNodeFromNetwork(const QUuid &networkUuid, ZigbeeNode *node) override;
ZigbeeNetwork::State networkState(const QUuid &networkUuid) override;
ZigbeeAddress coordinatorAddress(const QUuid &networkUuid) override;
public slots:
bool enable();

View File

@ -132,6 +132,10 @@ QPair<ZigbeeManager::ZigbeeError, QUuid> ZigbeeManager::createZigbeeNetwork(cons
return QPair<ZigbeeManager::ZigbeeError, QUuid>(ZigbeeManager::ZigbeeErrorAdapterNotAvailable, QUuid());
}
// ZigbeeChannelMask testChannelMask = ZigbeeChannelMask(0);
// testChannelMask.setChannel(Zigbee::ZigbeeChannel13);
// qCWarning(dcZigbee()) << "Using test channel mask" << testChannelMask;
ZigbeeNetwork *network = buildNetworkObject(QUuid::createUuid(), backendType);
network->setChannelMask(channelMask);
network->setSerialPortName(serialPort);
@ -452,6 +456,7 @@ void ZigbeeManager::addNetwork(ZigbeeNetwork *network)
qCDebug(dcZigbee()) << " Model" << endpoint->modelIdentifier();
qCDebug(dcZigbee()) << " Version" << endpoint->softwareBuildId();
}
qCDebug(dcZigbee()) << " Input clusters (" << endpoint->inputClusters().count() << ")";
foreach (ZigbeeCluster *cluster, endpoint->inputClusters()) {
qCDebug(dcZigbee()) << " -" << cluster;

View File

@ -59,6 +59,7 @@ public:
virtual void removeNodeFromNetwork(const QUuid &networkUuid, ZigbeeNode *node) = 0;
virtual ZigbeeNetwork::State networkState(const QUuid &networkUuid) = 0;
virtual ZigbeeAddress coordinatorAddress(const QUuid &networkUuid) = 0;
signals:
void networkStateChanged(const QUuid &networkUuid, ZigbeeNetwork::State state);