fix remove device method

bump api
This commit is contained in:
Simon Stürz 2015-10-20 16:45:38 +02:00 committed by Michael Zanetti
parent fc9b6f1887
commit 5f66f0cbe3
2 changed files with 17 additions and 2 deletions

View File

@ -184,6 +184,10 @@ QPair<DeviceManager::DeviceError, QList<RuleId> > GuhCore::removeConfiguredDevic
{
// Check if this is a child device
Device *device = findConfiguredDevice(deviceId);
if (!device)
return QPair<DeviceManager::DeviceError, QList<RuleId> > (DeviceManager::DeviceErrorDeviceNotFound, QList<RuleId>());
if (!device->parentId().isNull()) {
qCWarning(dcDeviceManager) << "The device is a child of" << device->parentId().toString() << ". Please remove the parent device.";
return QPair<DeviceManager::DeviceError, QList<RuleId> > (DeviceManager::DeviceErrorDeviceIsChild, QList<RuleId>());
@ -268,6 +272,10 @@ DeviceManager::DeviceError GuhCore::removeConfiguredDevice(const DeviceId &devic
{
// Check if this is a child device
Device *device = findConfiguredDevice(deviceId);
if (!device)
return DeviceManager::DeviceErrorDeviceNotFound;
if (!device->parentId().isNull()) {
qCWarning(dcDeviceManager) << "The device is a child of" << device->parentId().toString() << ". Please remove the parent device.";
return DeviceManager::DeviceErrorDeviceIsChild;

View File

@ -196,7 +196,7 @@
}
},
"Devices.PairDevice": {
"description": "Pair a device. Use this for DeviceClasses with a setupMethod different than SetupMethodJustAdd.Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. CreateMethodJustAdd takes the parameters you want to have with that device. CreateMethodDiscovery requires the use of a deviceDescriptorId. If success is true, the return values will contain a pairingTransactionId, a displayMessage and the setupMethod. Depending on the setupMethod you should either proceed with AddConfiguredDevice or PairDevice.",
"description": "Pair a device. Use this for DeviceClasses with a setupMethod different than SetupMethodJustAdd. Use deviceDescriptorId or deviceParams, depending on the createMethod of the device class. CreateMethodJustAdd takes the parameters you want to have with that device. CreateMethodDiscovery requires the use of a deviceDescriptorId. If success is true, the return values will contain a pairingTransactionId, a displayMessage and the setupMethod. Depending on the setupMethod you should either proceed with AddConfiguredDevice or PairDevice.",
"params": {
"deviceClassId": "Uuid",
"o:deviceDescriptorId": "Uuid",
@ -215,6 +215,7 @@
"description": "Remove a device from the system.",
"params": {
"deviceId": "Uuid",
"o:removePolicy": "$ref:RemovePolicy",
"o:removePolicyList": [
{
"policy": "$ref:RemovePolicy",
@ -223,7 +224,10 @@
]
},
"returns": {
"deviceError": "$ref:DeviceError"
"deviceError": "$ref:DeviceError",
"o:ruleIds": [
"Uuid"
]
}
},
"Devices.SetPluginConfiguration": {
@ -549,6 +553,7 @@
"deviceClassId": "Uuid",
"id": "Uuid",
"name": "String",
"o:parentId": "Uuid",
"params": [
"$ref:Param"
],
@ -604,6 +609,8 @@
"DeviceErrorAuthentificationFailure",
"DeviceErrorAsync",
"DeviceErrorDeviceInUse",
"DeviceErrorDeviceInRule",
"DeviceErrorDeviceIsChild",
"DeviceErrorPairingTransactionIdNotFound",
"DeviceErrorParameterNotWritable"
],