From 7d09102c4de14524fde68c9ef1f25b3027498ce9 Mon Sep 17 00:00:00 2001 From: akwizgran <akwizgran@users.sourceforge.net> Date: Tue, 8 Nov 2011 21:12:08 +0000 Subject: [PATCH] Advertise the Bluetooth address if the device is discoverable. --- .../net/sf/briar/plugins/bluetooth/BluetoothPlugin.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java b/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java index e784b5a88f..75d42231d1 100644 --- a/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java +++ b/components/net/sf/briar/plugins/bluetooth/BluetoothPlugin.java @@ -146,11 +146,14 @@ class BluetoothPlugin extends AbstractPlugin implements StreamPlugin { // Try to make the device discoverable (requires root on Linux) try { 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(); p.put("address", localDevice.getBluetoothAddress()); callback.setLocalProperties(p); - } catch(BluetoothStateException e) { - if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage()); } } -- GitLab