mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 14:49:53 +01:00
Advertise the Bluetooth address if the device is discoverable.
This commit is contained in:
@@ -146,11 +146,14 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin {
|
|||||||
// Try to make the device discoverable (requires root on Linux)
|
// Try to make the device discoverable (requires root on Linux)
|
||||||
try {
|
try {
|
||||||
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
|
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
|
||||||
|
} catch(BluetoothStateException e) {
|
||||||
|
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
|
||||||
|
}
|
||||||
|
// Advertise the address to contacts if the device is discoverable
|
||||||
|
if(localDevice.getDiscoverable() == DiscoveryAgent.GIAC) {
|
||||||
TransportProperties p = callback.getLocalProperties();
|
TransportProperties p = callback.getLocalProperties();
|
||||||
p.put("address", localDevice.getBluetoothAddress());
|
p.put("address", localDevice.getBluetoothAddress());
|
||||||
callback.setLocalProperties(p);
|
callback.setLocalProperties(p);
|
||||||
} catch(BluetoothStateException e) {
|
|
||||||
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user