summaryrefslogtreecommitdiffstats
path: root/java/direct_bt/tinyb
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-03 04:05:08 +0200
committerSven Gothel <[email protected]>2020-05-03 04:05:08 +0200
commit646e8a02d3572569dc889e2162d1c900ca0d40b2 (patch)
tree329fd6b4cab47934e2a4ae84b23c4f023b1e9420 /java/direct_bt/tinyb
parentc57fd196538a3035cc465d33cd307e8b2a734639 (diff)
Java: Utilize new EIRDataType in BluetoothDeviceStatusListener; ...
- Utilize new EIRDataType in BluetoothDeviceStatusListener - DBTAdapter: Add null checks for java callbacks - JNI: Adapt to EIRDataType on deviceUpdated. - DBTManager: Implement getAdapterListImpl(), supporting multiple adapter. JNI Implementation uses proper lambda for java-object ctor and fixed 'convert_vector_to_jobject'. - JNI: Fix 'convert_vector_to_jobject' using vector<unique_ptr<..>> as we cannot escape from a shared_ptr, i.e. no release() of ownership. - Working ScannerTinyB01 (discovery + connect using multiple adapter)
Diffstat (limited to 'java/direct_bt/tinyb')
-rw-r--r--java/direct_bt/tinyb/DBTAdapter.java15
-rw-r--r--java/direct_bt/tinyb/DBTManager.java2
2 files changed, 11 insertions, 6 deletions
diff --git a/java/direct_bt/tinyb/DBTAdapter.java b/java/direct_bt/tinyb/DBTAdapter.java
index 2bc028b2..a8b99fbd 100644
--- a/java/direct_bt/tinyb/DBTAdapter.java
+++ b/java/direct_bt/tinyb/DBTAdapter.java
@@ -38,6 +38,7 @@ import org.tinyb.BluetoothException;
import org.tinyb.BluetoothManager;
import org.tinyb.BluetoothNotification;
import org.tinyb.BluetoothType;
+import org.tinyb.EIRDataType;
import org.tinyb.BluetoothDeviceStatusListener;
import org.tinyb.TransportType;
@@ -209,7 +210,9 @@ public class DBTAdapter extends DBTObject implements BluetoothAdapter
final boolean res = startDiscoveryImpl();
isDiscovering = res;
synchronized( stateLock ) {
- discoveringNotificationCB.run(res);
+ if( null != discoveringNotificationCB ) {
+ discoveringNotificationCB.run(res);
+ }
stateLock.notifyAll();
}
return res;
@@ -222,7 +225,9 @@ public class DBTAdapter extends DBTObject implements BluetoothAdapter
isDiscovering = false;
final boolean res = stopDiscoveryImpl();
synchronized( stateLock ) {
- discoveringNotificationCB.run(false);
+ if( null != discoveringNotificationCB ) {
+ discoveringNotificationCB.run(false);
+ }
stateLock.notifyAll();
}
return res;
@@ -316,10 +321,10 @@ public class DBTAdapter extends DBTObject implements BluetoothAdapter
}
@Override
- public void deviceUpdated(final BluetoothAdapter a, final BluetoothDevice device, final long timestamp) {
- System.err.println("DBTAdapter.DeviceStatusListener.updated: "+device+" on "+a);
+ public void deviceUpdated(final BluetoothAdapter a, final BluetoothDevice device, final long timestamp, final EIRDataType updateMask) {
+ System.err.println("DBTAdapter.DeviceStatusListener.updated: "+updateMask+" of "+device+" on "+a);
// nop on discoveredDevices
- userDeviceStatusListener.deviceUpdated(a, device, timestamp);
+ userDeviceStatusListener.deviceUpdated(a, device, timestamp, updateMask);
}
@Override
diff --git a/java/direct_bt/tinyb/DBTManager.java b/java/direct_bt/tinyb/DBTManager.java
index 4b200da3..4438c66f 100644
--- a/java/direct_bt/tinyb/DBTManager.java
+++ b/java/direct_bt/tinyb/DBTManager.java
@@ -122,7 +122,7 @@ public class DBTManager implements BluetoothManager
{
initImpl();
try {
- adapters.add(getDefaultAdapterImpl());
+ adapters.addAll(getAdapterListImpl());
} catch (final BluetoothException be) {
be.printStackTrace();
}