Fixes in permit joining timer handling

Emit ZigbeeNetworkChanged when it actually changes in the stack,
not directly after we request the stack to change something as
it may fail, or the effective parameters may be not what we think.
pull/520/head
Michael Zanetti 2022-04-23 23:34:39 +02:00
parent 54c7cdcabf
commit af3c928092
1 changed files with 10 additions and 4 deletions

View File

@ -232,10 +232,6 @@ ZigbeeManager::ZigbeeError ZigbeeManager::setZigbeeNetworkPermitJoin(const QUuid
qCDebug(dcZigbee()) << "Set permit joining in network" << network << "to" << duration << "seconds" << ZigbeeUtils::convertUint16ToHexString(shortAddress);
network->setPermitJoining(duration, shortAddress);
// Notify all clients about the new configuration
emit zigbeeNetworkChanged(network);
return ZigbeeManager::ZigbeeErrorNoError;
}
@ -505,6 +501,16 @@ void ZigbeeManager::addNetwork(ZigbeeNetwork *network)
emit zigbeeNetworkChanged(network);
});
connect(network, &ZigbeeNetwork::permitJoinDurationChanged, this, [this, network](bool permitJoinDuration){
qCDebug(dcZigbee()) << "Network permit join duration changed" << network->networkUuid().toString() << permitJoinDuration;
emit zigbeeNetworkChanged(network);
});
connect(network, &ZigbeeNetwork::permitJoinRemainingChanged, this, [this, network](bool permitJoinRemaining){
qCDebug(dcZigbee()) << "Network permit join remaining changed" << network->networkUuid().toString() << permitJoinRemaining;
emit zigbeeNetworkChanged(network);
});
connect(network, &ZigbeeNetwork::nodeAdded, this, [this, network](ZigbeeNode *node){
qCDebug(dcZigbee()) << "Node added to" << network << node;
// The plugin don't need to see the coordinator node