implement Dbus addDevice and removeDevice methods

update documentation
This commit is contained in:
John Freed 2021-08-17 16:12:28 +02:00
parent bc3f8803dc
commit da1bb918bf
4 changed files with 37 additions and 4 deletions

View file

@ -39,6 +39,7 @@ import org.whispersystems.signalservice.api.util.InvalidNumberException;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.HashSet;
@ -699,6 +700,26 @@ public class DbusSignalImpl implements Signal {
return DbusSignalControlImpl.link(newDeviceName);
}
@Override
public void addDevice(String uri) {
try {
m.addDeviceLink(new URI(uri));
} catch (IOException | InvalidKeyException e) {
throw new Error.Failure(e.getClass().getSimpleName() + "Add device link failed. " + e.getMessage());
} catch (URISyntaxException e) {
throw new Error.Failure(e.getClass().getSimpleName() + "Device link uri has invalid format: " + e.getMessage());
}
}
@Override
public void removeDevice(int deviceId) {
try {
m.removeLinkedDevices(deviceId);
} catch (IOException e) {
throw new Error.Failure(e.getClass().getSimpleName() + "Error while removing device: " + e.getMessage());
}
}
@Override
public void register(
String number, boolean voiceVerification