diff options
author | Sven Gothel <[email protected]> | 2020-06-09 20:55:50 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-09 20:55:50 +0200 |
commit | 888cda5041d45c98b93c2ed506d08f3f453240f8 (patch) | |
tree | b6944321d87c4499ce07cf8f57beea8ec4e1334e /java/direct_bt | |
parent | 0ae1a240086654ada3f9805c5fd4a38003007696 (diff) |
C++: Utilize 'currentScanType' for start/stop discovery same as for Java code; use atomic<ScanType> avoiding race conditions
C++/Java: Only update the discovering state for false in DISCOVERING listener if keepAlive == false.
C++ like Java pendant, only perform start/stop discovery in appropriate discovery state
C++ expose discovery state 'currentScanType'
Diffstat (limited to 'java/direct_bt')
-rw-r--r-- | java/direct_bt/tinyb/DBTAdapter.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/java/direct_bt/tinyb/DBTAdapter.java b/java/direct_bt/tinyb/DBTAdapter.java index 4f0d1025..4cbc071f 100644 --- a/java/direct_bt/tinyb/DBTAdapter.java +++ b/java/direct_bt/tinyb/DBTAdapter.java @@ -429,6 +429,10 @@ public class DBTAdapter extends DBTObject implements BluetoothAdapter if( DEBUG ) { System.err.println("Adapter.StatusListener.DISCOVERING: enabled "+enabled+", keepAlive "+keepAlive+" on "+adapter); } + if( !enabled && keepAlive ) { + // Don't update isDiscovering:=false and don't notify user IF keepAlive! + return; + } if( isDiscovering.compareAndSet(!enabled, enabled) ) { synchronized(userCallbackLock) { if( null != userDiscoveringNotificationCB ) { |