aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-09-26 11:35:41 +0200
committerSven Gothel <[email protected]>2020-09-26 11:35:41 +0200
commit704ddf678544cd722aeae73b952a1899e5f319e8 (patch)
treecafb5c287cd48fe29c9d06aa43bbbe10a58f5385 /java
parent0aacb220265e223d1e36635bc0517c3fa600ba8e (diff)
DBTAdapter::startDiscoveryBackground() check isEnabled(); DBTAdapter.stopDiscovery() shall always call DBTAdapter::stopDiscovery()
DBTAdapter::startDiscoveryBackground() check isEnabled() same as startDiscovery(), adapter needs to be powered on. Added note in stopDiscovery(), as we don't check isEnabled. Here we shall pass through to have at least the discovery state updated and listeners notified. +++ DBTAdapter.stopDiscovery() shall always call DBTAdapter::stopDiscovery(), same as DBTAdapter.startDiscovery(). Just in case 'isDiscovery' state differs from native implementation, it shall be corrected here. (Robustness)
Diffstat (limited to 'java')
-rw-r--r--java/direct_bt/tinyb/DBTAdapter.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/java/direct_bt/tinyb/DBTAdapter.java b/java/direct_bt/tinyb/DBTAdapter.java
index 549de9bf..d3e42fab 100644
--- a/java/direct_bt/tinyb/DBTAdapter.java
+++ b/java/direct_bt/tinyb/DBTAdapter.java
@@ -342,10 +342,8 @@ public class DBTAdapter extends DBTObject implements BluetoothAdapter
@Override
public boolean stopDiscovery() throws BluetoothException {
synchronized( discoveryLock ) {
- if( isDiscovering.get() ) {
- return stopDiscoveryImpl(); // event callbacks will be generated by implementation
- }
- return true;
+ // Ignoring 'isDiscovering', be consistent with startDiscovery
+ return stopDiscoveryImpl(); // event callbacks will be generated by implementation
}
}
private native boolean stopDiscoveryImpl() throws BluetoothException;