summaryrefslogtreecommitdiffstats
path: root/java/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-25 04:41:36 +0200
committerSven Gothel <[email protected]>2020-05-25 04:41:36 +0200
commit589e2718189a4501c3611cbceffc3a90d2ff7ef5 (patch)
treef8fc17201d3b49cd1df2b7993bcabf3186cabea3 /java/direct_bt
parenta7afa3cf8eb7e374a706b6a4d4346c91efd7fbfa (diff)
BluetoothDevice: Add connect(..) w/ LE connection parameter
This exposes a technical detail similar to BluetoothAdapter.addDeviceToWhitelist(..) .
Diffstat (limited to 'java/direct_bt')
-rw-r--r--java/direct_bt/tinyb/DBTDevice.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/java/direct_bt/tinyb/DBTDevice.java b/java/direct_bt/tinyb/DBTDevice.java
index 31146c03..18f52783 100644
--- a/java/direct_bt/tinyb/DBTDevice.java
+++ b/java/direct_bt/tinyb/DBTDevice.java
@@ -28,7 +28,6 @@ package direct_bt.tinyb;
import java.util.List;
import java.util.Map;
-import org.tinyb.BluetoothAdapter;
import org.tinyb.AdapterStatusListener;
import org.tinyb.BluetoothDevice;
import org.tinyb.BluetoothException;
@@ -37,7 +36,6 @@ import org.tinyb.BluetoothGattService;
import org.tinyb.BluetoothManager;
import org.tinyb.BluetoothNotification;
import org.tinyb.BluetoothType;
-import org.tinyb.BluetoothUtils;
import org.tinyb.EIRDataTypeSet;
import org.tinyb.GATTCharacteristicListener;
@@ -232,6 +230,29 @@ public class DBTDevice extends DBTObject implements BluetoothDevice
}
private native boolean connectImpl() throws BluetoothException;
+ @Override
+ public boolean connect(final short interval, final short window,
+ final short min_interval, final short max_interval,
+ final short latency, final short timeout) {
+ boolean res = false;
+ if( !connected ) {
+ res = connectImpl(interval, window, min_interval, max_interval, latency, timeout);
+ if( res ) {
+ connected = true;
+ userConnectedNotificationsCB.run(Boolean.TRUE);
+
+ // FIXME: Split up - may offload to other thread
+ // Currently service resolution performed in connectImpl()!
+ servicesResolved = true;
+ userServicesResolvedNotificationsCB.run(Boolean.TRUE);
+ }
+ }
+ return res;
+ }
+ private native boolean connectImpl(final short interval, final short window,
+ final short min_interval, final short max_interval,
+ final short latency, final short timeout);
+
/* DBT Java callbacks */
@Override