aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-24 01:57:40 +0200
committerSven Gothel <[email protected]>2020-05-24 01:57:40 +0200
commitc760eac8addfda8e63ae213827840d251ecadfa0 (patch)
treebe881d530020295d1e903b62a4388f6ba05d1361 /java
parentfaffa313cc31c184e861d7bee5f932013e2d9d00 (diff)
Add Whitelist to DBTManager/DBTAdapter and test (Result: No auto-connection)
To avoid the hassle with HCI connect/disconnect while scanning, we should test the whitelist supposed to be stored on the adapter to auto-connect. Initial testing didn't show any connection.
Diffstat (limited to 'java')
-rw-r--r--java/direct_bt/tinyb/DBTAdapter.java7
-rw-r--r--java/jni/direct_bt/DBTAdapter.cxx4
2 files changed, 7 insertions, 4 deletions
diff --git a/java/direct_bt/tinyb/DBTAdapter.java b/java/direct_bt/tinyb/DBTAdapter.java
index 9b60d27b..727503c7 100644
--- a/java/direct_bt/tinyb/DBTAdapter.java
+++ b/java/direct_bt/tinyb/DBTAdapter.java
@@ -240,12 +240,15 @@ public class DBTAdapter extends DBTObject implements BluetoothAdapter
@Override
public synchronized boolean startDiscovery() throws BluetoothException {
+ return startDiscovery(true);
+ }
+ public synchronized boolean startDiscovery(final boolean keepAlive) throws BluetoothException {
removeDevices();
- final boolean res = startDiscoveryImpl();
+ final boolean res = startDiscoveryImpl(keepAlive);
isDiscovering = res;
return res;
}
- private native boolean startDiscoveryImpl() throws BluetoothException;
+ private native boolean startDiscoveryImpl(boolean keepAlive) throws BluetoothException;
@Override
public synchronized boolean stopDiscovery() throws BluetoothException {
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx
index 1e32ade8..030e193b 100644
--- a/java/jni/direct_bt/DBTAdapter.cxx
+++ b/java/jni/direct_bt/DBTAdapter.cxx
@@ -403,11 +403,11 @@ void Java_direct_1bt_tinyb_DBTAdapter_deleteImpl(JNIEnv *env, jobject obj)
}
}
-jboolean Java_direct_1bt_tinyb_DBTAdapter_startDiscoveryImpl(JNIEnv *env, jobject obj)
+jboolean Java_direct_1bt_tinyb_DBTAdapter_startDiscoveryImpl(JNIEnv *env, jobject obj, jboolean keepAlive)
{
try {
DBTAdapter *adapter = getInstance<DBTAdapter>(env, obj);
- return adapter->startDiscovery();
+ return adapter->startDiscovery(keepAlive);
} catch(...) {
rethrow_and_raise_java_exception(env);
}