summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-07-03 15:27:31 +0200
committerSven Gothel <[email protected]>2020-07-03 15:27:31 +0200
commit22e3abf3661d7de42b3e6c738d8167718e3ca218 (patch)
tree13983ff10e2d8c7c4c0e60d186c7a74bf132b82b
parent58722cabae622579e17c860618e7f34576d2d521 (diff)
DBTDevice (C++/Java) equality/identity requires its EUI48 address _and_ BDAddressTypev2.1.11
The BDAddressType is the magic 49th bit of the EUI48 address, as it specifies the semantics of its 2-high bits.
-rw-r--r--api/direct_bt/DBTDevice.hpp2
-rw-r--r--java/direct_bt/tinyb/DBTDevice.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp
index 5dd8e9db..eda7a482 100644
--- a/api/direct_bt/DBTDevice.hpp
+++ b/api/direct_bt/DBTDevice.hpp
@@ -385,7 +385,7 @@ namespace direct_bt {
{ return lhs.address < rhs.address; }
inline bool operator==(const DBTDevice& lhs, const DBTDevice& rhs)
- { return lhs.address == rhs.address; }
+ { return lhs.address == rhs.address && lhs.addressType == rhs.addressType; }
inline bool operator!=(const DBTDevice& lhs, const DBTDevice& rhs)
{ return !(lhs == rhs); }
diff --git a/java/direct_bt/tinyb/DBTDevice.java b/java/direct_bt/tinyb/DBTDevice.java
index c021ade5..74547cef 100644
--- a/java/direct_bt/tinyb/DBTDevice.java
+++ b/java/direct_bt/tinyb/DBTDevice.java
@@ -261,7 +261,7 @@ public class DBTDevice extends DBTObject implements BluetoothDevice
return false;
}
final DBTDevice other = (DBTDevice)obj;
- return address.equals(other.address);
+ return address.equals(other.address) && addressType.equals(other.addressType);
}
@Override