fixed rediscovery
parent
e947c1d75c
commit
c57cfc59f0
|
|
@ -58,14 +58,19 @@ void DevicePluginDoorbird::discoverDevices(DeviceDiscoveryInfo *info)
|
||||||
DeviceDescriptor deviceDescriptor(doorBirdDeviceClassId, serviceEntry.name(), serviceEntry.hostAddress().toString());
|
DeviceDescriptor deviceDescriptor(doorBirdDeviceClassId, serviceEntry.name(), serviceEntry.hostAddress().toString());
|
||||||
ParamList params;
|
ParamList params;
|
||||||
QString macAddress;
|
QString macAddress;
|
||||||
|
if (serviceEntry.txt().length() == 0) {
|
||||||
|
qCWarning(dcDoorBird()) << "Discovery failed, service entry missing";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (serviceEntry.txt().first().split("=").length() == 2) {
|
if (serviceEntry.txt().first().split("=").length() == 2) {
|
||||||
macAddress = serviceEntry.txt().first().split("=").last();
|
macAddress = serviceEntry.txt().first().split("=").last();
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcDoorBird()) << "Could not parse MAC Address" << serviceEntry.txt().first();
|
qCWarning(dcDoorBird()) << "Could not parse MAC Address" << serviceEntry.txt().first();
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
if (!myDevices().filterByParam(doorBirdDeviceSerialnumberParamTypeId, macAddress).isEmpty()) {
|
if (!myDevices().filterByParam(doorBirdDeviceSerialnumberParamTypeId, macAddress).isEmpty()) {
|
||||||
Device *existingDevice = myDevices().filterByParam(doorBirdDeviceSerialnumberParamTypeId, serviceEntry.hostName()).first();
|
Device *existingDevice = myDevices().filterByParam(doorBirdDeviceSerialnumberParamTypeId, macAddress).first();
|
||||||
deviceDescriptor.setDeviceId(existingDevice->id());
|
deviceDescriptor.setDeviceId(existingDevice->id());
|
||||||
}
|
}
|
||||||
params.append(Param(doorBirdDeviceSerialnumberParamTypeId, macAddress));
|
params.append(Param(doorBirdDeviceSerialnumberParamTypeId, macAddress));
|
||||||
|
|
@ -86,7 +91,6 @@ void DevicePluginDoorbird::discoverDevices(DeviceDiscoveryInfo *info)
|
||||||
|
|
||||||
void DevicePluginDoorbird::startPairing(DevicePairingInfo *info)
|
void DevicePluginDoorbird::startPairing(DevicePairingInfo *info)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (info->deviceClassId() == doorBirdDeviceClassId) {
|
if (info->deviceClassId() == doorBirdDeviceClassId) {
|
||||||
qCDebug(dcDoorBird()) << "User and password. Login is \"user\" and \"password\".";
|
qCDebug(dcDoorBird()) << "User and password. Login is \"user\" and \"password\".";
|
||||||
info->finish(Device::DeviceErrorNoError, QT_TR_NOOP("Please enter the user credentials"));
|
info->finish(Device::DeviceErrorNoError, QT_TR_NOOP("Please enter the user credentials"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue