aboutsummaryrefslogtreecommitdiffstats
path: root/examples/java/ScannerTinyB01.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-07-27 07:33:12 +0200
committerSven Gothel <[email protected]>2020-07-27 07:33:12 +0200
commit6e71e6e8fcf1a075d2b14ce5b2f18081cb436abd (patch)
tree8d047dadc1488f3a091d9df7ed58d830821c5cef /examples/java/ScannerTinyB01.java
parentb7d7d08c108fb3a1d17d3542dce1f942f6bb4059 (diff)
C++/Java *Device::connect*(..), disconnect(): Return HCIStatusCode instead of just boolean, passing through potential HCI error detail
The HCIStatusCode on failed connect*/disconnect commands issued via direct_bt HCI, could help applications making a better fail-recovery decision than just having the binary result.
Diffstat (limited to 'examples/java/ScannerTinyB01.java')
-rw-r--r--examples/java/ScannerTinyB01.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/java/ScannerTinyB01.java b/examples/java/ScannerTinyB01.java
index d6385167..4dda480c 100644
--- a/examples/java/ScannerTinyB01.java
+++ b/examples/java/ScannerTinyB01.java
@@ -275,13 +275,14 @@ public class ScannerTinyB01 {
final long t2 = BluetoothUtils.getCurrentMilliseconds();
final long t3;
- if ( sensor.connect() ) {
+ HCIStatusCode res;
+ if ( ( res = sensor.connect() ) == HCIStatusCode.SUCCESS ) {
t3 = BluetoothUtils.getCurrentMilliseconds();
- System.err.println("Sensor connected: "+(t3-t2)+" ms, total "+(t3-t0)+" ms");
+ System.err.println("Sensor connect issued: "+(t3-t2)+" ms, total "+(t3-t0)+" ms");
System.err.println("Sensor connectedNotification: "+connectedNotification.getValue());
} else {
t3 = BluetoothUtils.getCurrentMilliseconds();
- System.out.println("Could not connect device: "+(t3-t2)+" ms, total "+(t3-t0)+" ms");
+ System.out.println("connect command failed, res "+res+": "+(t3-t2)+" ms, total "+(t3-t0)+" ms");
// we tolerate the failed immediate connect, as it might happen at a later time
}