don't show already added devices in a discovery

This commit is contained in:
Michael Zanetti 2019-01-06 21:44:26 +01:00
parent 7027b9f9d1
commit 2adbb4c8df

View File

@ -97,6 +97,16 @@ DeviceManager::DeviceError DevicePluginAnel::discoverDevices(const DeviceClassId
continue; continue;
} }
qCDebug(dcAnelElektronik()) << "Found NET-CONTROL:" << senderAddress << parts.at(2) << parts.at(3) << senderAddress.protocol(); qCDebug(dcAnelElektronik()) << "Found NET-CONTROL:" << senderAddress << parts.at(2) << parts.at(3) << senderAddress.protocol();
bool existing = false;
foreach (Device *existingDev, myDevices()) {
if (existingDev->deviceClassId() == netPwrCtlDeviceClassId && existingDev->paramValue(netPwrCtlDeviceIpAddressParamTypeId).toString() == senderAddress.toString()) {
existing = true;
}
}
if (existing) {
qCDebug(dcAnelElektronik()) << "Already have device" << senderAddress << "in configured devices. Skipping...";
continue;
}
DeviceDescriptor d(netPwrCtlDeviceClassId, parts.at(2), senderAddress.toString()); DeviceDescriptor d(netPwrCtlDeviceClassId, parts.at(2), senderAddress.toString());
ParamList params; ParamList params;
params << Param(netPwrCtlDeviceIpAddressParamTypeId, senderAddress.toString()); params << Param(netPwrCtlDeviceIpAddressParamTypeId, senderAddress.toString());