diff options
author | Sven Gothel <[email protected]> | 2020-05-31 18:18:01 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-05-31 18:18:01 +0200 |
commit | c4454638931dd66bf80ae0132b80d85fbf01932c (patch) | |
tree | f27b1bf76c59eb820cb2927c4bf9800de306f2e3 /examples/java/ScannerTinyB01.java | |
parent | 18bfd4108c06669256c7d52d961fe6197eceb202 (diff) |
AdapterStatusListener(C++/Java): Expose 'HCIErrorCode reason' on disconnect (split deviceConnectionChanged up), align args of deviceUpdated
The 'HCIErrorCode reason' gives us valuable information of the disconnect reason, hence we shall expose it to the user level
on the C++ and Java side.
Diffstat (limited to 'examples/java/ScannerTinyB01.java')
-rw-r--r-- | examples/java/ScannerTinyB01.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/examples/java/ScannerTinyB01.java b/examples/java/ScannerTinyB01.java index e3448890..e6f82632 100644 --- a/examples/java/ScannerTinyB01.java +++ b/examples/java/ScannerTinyB01.java @@ -41,6 +41,7 @@ import org.tinyb.BluetoothNotification; import org.tinyb.BluetoothUtils; import org.tinyb.EIRDataTypeSet; import org.tinyb.GATTCharacteristicListener; +import org.tinyb.HCIErrorCode; public class ScannerTinyB01 { static { @@ -155,19 +156,20 @@ public class ScannerTinyB01 { } @Override - public void deviceUpdated(final BluetoothDevice device, final long timestamp, final EIRDataTypeSet updateMask) { + public void deviceUpdated(final BluetoothDevice device, final EIRDataTypeSet updateMask, final long timestamp) { final boolean matches = device.getAddress().equals(waitForDevice); System.err.println("****** UPDATED: "+updateMask+" of "+device+" - match "+matches); - System.err.println("Status Adapter:"); - System.err.println(device.getAdapter().toString()); } @Override - public void deviceConnectionChanged(final BluetoothDevice device, final boolean connected, final long timestamp) { + public void deviceConnected(final BluetoothDevice device, final long timestamp) { final boolean matches = device.getAddress().equals(waitForDevice); - System.err.println("****** CONNECTION: connected "+connected+": "+device+" - matches "+matches); - System.err.println("Status Adapter:"); - System.err.println(device.getAdapter().toString()); + System.err.println("****** CONNECTED: "+device+" - matches "+matches); + } + + @Override + public void deviceDisconnected(final BluetoothDevice device, final HCIErrorCode reason, final long timestamp) { + System.err.println("****** DISCONNECTED: Reason "+reason+": "+device+" on "+device.getAdapter()); } }; adapter.addStatusListener(statusListener, null); |