summaryrefslogtreecommitdiffstats
path: root/examples/java/DBTScanner10.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-11-24 21:05:27 +0100
committerSven Gothel <[email protected]>2020-11-24 21:05:27 +0100
commitcc475330fd173ee0e38b4a9a8cb5205fa2136bed (patch)
treec6c97247cbd8f0304473caf1865f366b3ea9cab9 /examples/java/DBTScanner10.java
parent9f932fc51e5bed3d1a059131667191f56c20d7fb (diff)
DBTDevice: Clarify setConn* Security parameter API: Provide more versatile overloaded variant and simplified API entries.
setConnSecurityLevel(..) no more sets SMPIOCapability, only advise in API doc to avoid complexity.
Diffstat (limited to 'examples/java/DBTScanner10.java')
-rw-r--r--examples/java/DBTScanner10.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/examples/java/DBTScanner10.java b/examples/java/DBTScanner10.java
index 33e799ca..1cbfb426 100644
--- a/examples/java/DBTScanner10.java
+++ b/examples/java/DBTScanner10.java
@@ -77,7 +77,7 @@ public class DBTScanner10 {
final List<String> waitForDevices = new ArrayList<String>();
- static final int NO_PASSKEY = 0xffffffff;
+ static final int NO_PASSKEY = -1;
int pairing_passkey = NO_PASSKEY;
BTSecurityLevel sec_level = BTSecurityLevel.UNSET;
SMPIOCapability io_capabilities = SMPIOCapability.UNSET;
@@ -295,7 +295,11 @@ public class DBTScanner10 {
if( BTSecurityLevel.UNSET.value < sec_level.value && SMPIOCapability.UNSET.value != io_capabilities.value ) {
device.setConnSecurity(sec_level, io_capabilities, true /* blocking */);
} else if( BTSecurityLevel.UNSET.value < sec_level.value ) {
- device.setConnSecurityLevel(sec_level, true /* blocking */);
+ if( BTSecurityLevel.ENC_ONLY.value >= sec_level.value ) {
+ device.setConnSecurity(sec_level, SMPIOCapability.NO_INPUT_NO_OUTPUT, true /* blocking */);
+ } else {
+ device.setConnSecurityLevel(sec_level);
+ }
} else if( SMPIOCapability.UNSET.value != io_capabilities.value ) {
device.setConnIOCapability(io_capabilities, true /* blocking */);
}