Update discovery to renamed network device
This commit is contained in:
parent
2945c474da
commit
0944fe422a
@ -55,31 +55,31 @@ void IntegrationPluginWakeOnLan::discoverThings(ThingDiscoveryInfo *info)
|
|||||||
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
NetworkDeviceDiscoveryReply *discoveryReply = hardwareManager()->networkDeviceDiscovery()->discover();
|
||||||
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
connect(discoveryReply, &NetworkDeviceDiscoveryReply::finished, this, [=](){
|
||||||
ThingDescriptors descriptors;
|
ThingDescriptors descriptors;
|
||||||
qCDebug(dcWakeOnLan()) << "Discovery finished. Found" << discoveryReply->networkDevices().count() << "devices";
|
qCDebug(dcWakeOnLan()) << "Discovery finished. Found" << discoveryReply->networkDeviceInfos().count() << "devices";
|
||||||
foreach (const NetworkDevice &networkDevice, discoveryReply->networkDevices()) {
|
foreach (const NetworkDeviceInfo &networkDeviceInfo, discoveryReply->networkDeviceInfos()) {
|
||||||
// We need the mac address...
|
// We need the mac address...
|
||||||
if (networkDevice.macAddress().isEmpty())
|
if (networkDeviceInfo.macAddress().isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Filter out already added network devices, rediscovery is in this case no option
|
// Filter out already added network devices, rediscovery is in this case no option
|
||||||
if (myThings().filterByParam(wolThingMacParamTypeId, networkDevice.macAddress()).count() != 0)
|
if (myThings().filterByParam(wolThingMacParamTypeId, networkDeviceInfo.macAddress()).count() != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
if (networkDevice.hostName().isEmpty()) {
|
if (networkDeviceInfo.hostName().isEmpty()) {
|
||||||
title = networkDevice.address().toString();
|
title = networkDeviceInfo.address().toString();
|
||||||
} else {
|
} else {
|
||||||
title = networkDevice.hostName() + " (" + networkDevice.address().toString() + ")";
|
title = networkDeviceInfo.hostName() + " (" + networkDeviceInfo.address().toString() + ")";
|
||||||
}
|
}
|
||||||
QString description;
|
QString description;
|
||||||
if (networkDevice.macAddressManufacturer().isEmpty()) {
|
if (networkDeviceInfo.macAddressManufacturer().isEmpty()) {
|
||||||
description = networkDevice.macAddress();
|
description = networkDeviceInfo.macAddress();
|
||||||
} else {
|
} else {
|
||||||
description = networkDevice.macAddress() + " (" + networkDevice.macAddressManufacturer() + ")";
|
description = networkDeviceInfo.macAddress() + " (" + networkDeviceInfo.macAddressManufacturer() + ")";
|
||||||
}
|
}
|
||||||
ThingDescriptor descriptor(wolThingClassId, title, description);
|
ThingDescriptor descriptor(wolThingClassId, title, description);
|
||||||
ParamList params;
|
ParamList params;
|
||||||
params.append(Param(wolThingMacParamTypeId, networkDevice.macAddress()));
|
params.append(Param(wolThingMacParamTypeId, networkDeviceInfo.macAddress()));
|
||||||
descriptor.setParams(params);
|
descriptor.setParams(params);
|
||||||
descriptors.append(descriptor);
|
descriptors.append(descriptor);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user