diff options
-rw-r--r-- | java/direct_bt/tinyb/DBTManager.java | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/java/direct_bt/tinyb/DBTManager.java b/java/direct_bt/tinyb/DBTManager.java index d4dcd70f..6874da74 100644 --- a/java/direct_bt/tinyb/DBTManager.java +++ b/java/direct_bt/tinyb/DBTManager.java @@ -213,21 +213,16 @@ public class DBTManager implements BluetoothManager /** * {@inheritDoc} * <p> - * This call is a quite expensive service query, see below. + * This call could be a quite expensive service query, see below. * </p> * <p> - * This implementation only fetches all {@link BluetoothGattService} from all {@link BluetoothDevice}s - * from the {@link #getDefaultAdapter()}. + * This implementation returns all {@link BluetoothGattService} from all {@link BluetoothDevice}s + * from the {@link #getDefaultAdapter()} using {@link BluetoothDevice#getServices()}. * </p> * <p> * This implementation does not {@link BluetoothAdapter#startDiscovery() start} an explicit discovery, * but previous {@link BluetoothAdapter#getDevices() discovered devices} are being queried. * </p> - * <p> - * In case a {@link BluetoothDevice} hasn't detected any service yet, - * i.e. {@link BluetoothDevice#getServicesResolved()} and {@link BluetoothDevice#getConnected()} is false, - * a new {@link BluetoothDevice#connect() connect/disconnect} cycle is performed. - * </p> */ @Override public List<BluetoothGattService> getServices() { @@ -237,16 +232,10 @@ public class DBTManager implements BluetoothManager final List<BluetoothDevice> devices = adapter.getDevices(); for(final Iterator<BluetoothDevice> iterD=devices.iterator(); iterD.hasNext(); ) { final BluetoothDevice device = iterD.next(); - if( !device.getServicesResolved() && !device.getConnected() ) { - if( device.connect() ) { - if( !device.getServicesResolved() ) { - throw new InternalError("Device connected but services not resolved"); - } - device.disconnect(); - } - } final List<BluetoothGattService> devServices = device.getServices(); - res.addAll(devServices); + if( null != devServices ) { + res.addAll(devServices); + } } } return res; |