- final ProvisioningManager provisioningManager = c.getNewProvisioningManager();
- final URI deviceLinkUri = provisioningManager.getDeviceLinkUri();
- new Thread(() -> {
- try {
- provisioningManager.finishDeviceLink(newDeviceName);
- } catch (IOException | TimeoutException | UserAlreadyExists e) {
- e.printStackTrace();
- }
- }).start();
+ deviceLinkUri = c.getNewProvisioningDeviceLinkUri();
+ } catch (TimeoutException | IOException e) {
+ throw new SignalControl.Error.Failure(e.getClass().getSimpleName() + " " + e.getMessage());
+ }
+ Thread.ofPlatform().name("dbus-link").start(() -> {
+ final ProvisioningManager provisioningManager = c.getProvisioningManagerFor(deviceLinkUri);
+ try {
+ provisioningManager.finishDeviceLink(newDeviceName);
+ } catch (IOException | TimeoutException | UserAlreadyExistsException e) {
+ logger.warn("Failed to finish linking", e);
+ }
+ });
+ return deviceLinkUri.toString();
+ }
+
+ @Override
+ public String startLink() throws Error.Failure {
+ try {
+ final URI deviceLinkUri = c.getNewProvisioningDeviceLinkUri();