diff options
author | Sven Gothel <[email protected]> | 2020-07-03 15:26:37 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-07-03 15:26:37 +0200 |
commit | 58722cabae622579e17c860618e7f34576d2d521 (patch) | |
tree | 5edb272c2085ef41ab0fd03e3d964eb7e16eba40 /java/direct_bt | |
parent | 5f43b2454eac3ed762f2576ad8e549c26200661c (diff) |
EUI48::getBLERandomAddressType(): Pass BDAddressType, to only return a valid BLERandomAddressType related to the BDAddressType.
We validated the BLERandomAddressType in DBTDevice.java,
but created an invalid value in DBTDevice.cpp regardless of BDAddressType.
Resolved!
We also perform the validate in DBTDevice.cpp now.
Diffstat (limited to 'java/direct_bt')
-rw-r--r-- | java/direct_bt/tinyb/DBTDevice.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/java/direct_bt/tinyb/DBTDevice.java b/java/direct_bt/tinyb/DBTDevice.java index 66c8c48c..c021ade5 100644 --- a/java/direct_bt/tinyb/DBTDevice.java +++ b/java/direct_bt/tinyb/DBTDevice.java @@ -207,11 +207,11 @@ public class DBTDevice extends DBTObject implements BluetoothDevice this.leRandomAddressType = BLERandomAddressType.get(intBLERandomAddressType); if( BluetoothAddressType.BDADDR_LE_RANDOM == addressType ) { if( BLERandomAddressType.UNDEFINED == leRandomAddressType ) { - throw new IllegalArgumentException("BDADDR_LE_RANDOM: Invalid given native BLERandomAddressType "+intBLERandomAddressType); + throw new IllegalArgumentException("BDADDR_LE_RANDOM: Invalid given native BLERandomAddressType "+intBLERandomAddressType+": "+toString()); } } else { if( BLERandomAddressType.UNDEFINED != leRandomAddressType ) { - throw new IllegalArgumentException("Not BDADDR_LE_RANDOM: Invalid given native BLERandomAddressType "+leRandomAddressType); + throw new IllegalArgumentException("Not BDADDR_LE_RANDOM: Invalid given native BLERandomAddressType "+leRandomAddressType+": "+toString()); } } this.ts_creation = ts_creation; @@ -514,7 +514,13 @@ public class DBTDevice extends DBTObject implements BluetoothDevice public final String toString() { if( !isValid() ) { // UTF-8 271D = Cross - return "Device" + "\u271D" + "["+address+", '"+name+"']"; + final String leRandomStr; + if( BLERandomAddressType.UNDEFINED != this.leRandomAddressType ) { + leRandomStr = ", random "+leRandomAddressType.toString(); + } else { + leRandomStr = ""; + } + return "Device" + "\u271D" + "[address["+address+", "+addressType.toString()+leRandomStr+"], '"+name+"']"; } return toStringImpl(); } |