Merge PR #239: Add discovery mode to userandpassword mock device
This commit is contained in:
commit
436b0aeffc
@ -124,6 +124,17 @@ void DevicePluginMock::discoverDevices(DeviceDiscoveryInfo *info)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (info->deviceClassId() == mockUserAndPassDeviceClassId) {
|
||||||
|
QTimer::singleShot(1000, info, [this, info](){
|
||||||
|
if (myDevices().filterByDeviceClassId(mockUserAndPassDeviceClassId).isEmpty()) {
|
||||||
|
DeviceDescriptor descriptor(mockUserAndPassDeviceClassId, "Mock User & Password (Discovered)", QString());
|
||||||
|
info->addDeviceDescriptor(descriptor);
|
||||||
|
}
|
||||||
|
info->finish(Device::DeviceErrorNoError);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
qCWarning(dcMockDevice()) << "Cannot discover for deviceClassId" << info->deviceClassId();
|
qCWarning(dcMockDevice()) << "Cannot discover for deviceClassId" << info->deviceClassId();
|
||||||
info->finish(Device::DeviceErrorDeviceNotFound);
|
info->finish(Device::DeviceErrorDeviceNotFound);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -866,7 +866,7 @@
|
|||||||
"id": "6fe07a77-9c07-4736-81e2-d504314bbcb9",
|
"id": "6fe07a77-9c07-4736-81e2-d504314bbcb9",
|
||||||
"name": "mockUserAndPass",
|
"name": "mockUserAndPass",
|
||||||
"displayName": "Mock Device (User & Password)",
|
"displayName": "Mock Device (User & Password)",
|
||||||
"createMethods": ["user"],
|
"createMethods": ["discovery", "user"],
|
||||||
"setupMethod": "userandpassword"
|
"setupMethod": "userandpassword"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user