mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Fix BlueCove address and URL format.
This commit is contained in:
@@ -21,7 +21,9 @@ import javax.microedition.io.StreamConnectionNotifier;
|
|||||||
import static java.util.logging.Level.WARNING;
|
import static java.util.logging.Level.WARNING;
|
||||||
import static java.util.logging.Logger.getLogger;
|
import static java.util.logging.Logger.getLogger;
|
||||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||||
|
import static org.briarproject.bramble.util.StringUtils.fromHexString;
|
||||||
import static org.briarproject.bramble.util.StringUtils.isValidMac;
|
import static org.briarproject.bramble.util.StringUtils.isValidMac;
|
||||||
|
import static org.briarproject.bramble.util.StringUtils.macToString;
|
||||||
|
|
||||||
@MethodsNotNullByDefault
|
@MethodsNotNullByDefault
|
||||||
@ParametersNotNullByDefault
|
@ParametersNotNullByDefault
|
||||||
@@ -65,12 +67,13 @@ class JavaBluetoothPlugin extends
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
String getBluetoothAddress() {
|
String getBluetoothAddress() {
|
||||||
return localDevice.getBluetoothAddress();
|
if (localDevice == null) return null;
|
||||||
|
return macToString(fromHexString(localDevice.getBluetoothAddress()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
StreamConnectionNotifier openServerSocket(String uuid) throws IOException {
|
StreamConnectionNotifier openServerSocket(String uuid) throws IOException {
|
||||||
String url = makeUrl("localhost", uuid);
|
String url = makeServerSocketUrl(uuid);
|
||||||
return (StreamConnectionNotifier) Connector.open(url);
|
return (StreamConnectionNotifier) Connector.open(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,9 +100,7 @@ class JavaBluetoothPlugin extends
|
|||||||
@Override
|
@Override
|
||||||
DuplexTransportConnection connectTo(String address, String uuid)
|
DuplexTransportConnection connectTo(String address, String uuid)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
String url = makeUrl(address, uuid);
|
throw new IOException("Not implemented"); // TODO
|
||||||
StreamConnection s = (StreamConnection) Connector.open(url);
|
|
||||||
return connectionFactory.wrapSocket(this, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,7 +114,9 @@ class JavaBluetoothPlugin extends
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
private String makeUrl(String address, String uuid) {
|
private String makeServerSocketUrl(String uuid) {
|
||||||
return "btspp://" + address + ":" + uuid + ";name=RFCOMM";
|
uuid = uuid.replaceAll("-", "");
|
||||||
|
return "btspp://" + "localhost" + ":" + uuid
|
||||||
|
+ ";encrypt=false;authenticate=false";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user