fix pairing for oauth
This commit is contained in:
parent
fa0057b197
commit
14bc0eb73e
@ -495,7 +495,9 @@ Device::DeviceError DeviceManagerImplementation::setDeviceSettings(const DeviceI
|
|||||||
DevicePairingInfo* DeviceManagerImplementation::pairDevice(const DeviceClassId &deviceClassId, const QString &name, const ParamList ¶ms)
|
DevicePairingInfo* DeviceManagerImplementation::pairDevice(const DeviceClassId &deviceClassId, const QString &name, const ParamList ¶ms)
|
||||||
{
|
{
|
||||||
PairingTransactionId transactionId = PairingTransactionId::createPairingTransactionId();
|
PairingTransactionId transactionId = PairingTransactionId::createPairingTransactionId();
|
||||||
DevicePairingInfo *info = new DevicePairingInfo(transactionId, deviceClassId, DeviceId(), name, params, DeviceId(), this, 30000);
|
// Create new device id
|
||||||
|
DeviceId newDeviceId = DeviceId::createDeviceId();
|
||||||
|
DevicePairingInfo *info = new DevicePairingInfo(transactionId, deviceClassId, newDeviceId, name, params, DeviceId(), this, 30000);
|
||||||
pairDeviceInternal(info);
|
pairDeviceInternal(info);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -521,7 +523,12 @@ DevicePairingInfo* DeviceManagerImplementation::pairDevice(const DeviceClassId &
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevicePairingInfo *info = new DevicePairingInfo(pairingTransactionId, deviceClassId, deviceDescriptor.deviceId(), name, deviceDescriptor.params(), deviceDescriptor.parentDeviceId(), this, 30000);
|
DeviceId deviceId = deviceDescriptor.deviceId();
|
||||||
|
// If it's a new device (not a reconfiguration), create a new DeviceId now.
|
||||||
|
if (deviceId.isNull()) {
|
||||||
|
deviceId = DeviceId::createDeviceId();
|
||||||
|
}
|
||||||
|
DevicePairingInfo *info = new DevicePairingInfo(pairingTransactionId, deviceClassId, deviceId, name, deviceDescriptor.params(), deviceDescriptor.parentDeviceId(), this, 30000);
|
||||||
pairDeviceInternal(info);
|
pairDeviceInternal(info);
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -548,13 +555,9 @@ DevicePairingInfo *DeviceManagerImplementation::confirmPairing(const PairingTran
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we already have a deviceId, we're reconfiguring an existing device, else we're adding a new one.
|
|
||||||
bool addNewDevice = false;
|
|
||||||
DeviceId deviceId = context.deviceId;
|
DeviceId deviceId = context.deviceId;
|
||||||
if (deviceId.isNull()) {
|
// If we already have a device for this ID, we're reconfiguring an existing device, else we're adding a new one.
|
||||||
deviceId = DeviceId::createDeviceId();
|
bool addNewDevice = !m_configuredDevices.contains(context.deviceId);
|
||||||
addNewDevice = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We're using two different info objects here, one to hand over to the plugin for the pairing, the other we give out
|
// We're using two different info objects here, one to hand over to the plugin for the pairing, the other we give out
|
||||||
// to the user. After the internal one has finished, we'll start a setupDevice job and finish the external pairingInfo only after
|
// to the user. After the internal one has finished, we'll start a setupDevice job and finish the external pairingInfo only after
|
||||||
|
|||||||
Reference in New Issue
Block a user