diff options
author | Sven Gothel <[email protected]> | 2020-07-03 18:39:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-07-03 18:39:51 +0200 |
commit | 0a58adf310f9ae29f0e753c9594e6879e0e2c0c7 (patch) | |
tree | f9116f578b469357f3d7a2b05b18f0f8ce1ccc98 /java | |
parent | 22e3abf3661d7de42b3e6c738d8167718e3ca218 (diff) |
DBTDevice lookup in DBTAdapter requires its EUI48 address _and_ BDAddressType
Concluding commit 22e3abf3661d7de42b3e6c738d8167718e3ca218,
having all DBTDevice lookups (find) in DBTAdapter using the BDAddressType as well.
Diffstat (limited to 'java')
-rw-r--r-- | java/jni/direct_bt/DBTAdapter.cxx | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx index b98ce735..4aa4c434 100644 --- a/java/jni/direct_bt/DBTAdapter.cxx +++ b/java/jni/direct_bt/DBTAdapter.cxx @@ -621,17 +621,9 @@ jobject Java_direct_1bt_tinyb_DBTAdapter_connectDevice(JNIEnv *env, jobject obj, JavaGlobalObj::check(adapter->getJavaObject(), E_FILE_LINE); std::string saddress = from_jstring_to_string(env, jaddress); EUI48 address(saddress); - std::shared_ptr<DBTDevice> device = adapter->findDiscoveredDevice(address); + const BDAddressType addressType = fromJavaAdressTypeToBDAddressType(env, jaddressType); + std::shared_ptr<DBTDevice> device = adapter->findDiscoveredDevice(address, addressType); if( nullptr != device ) { - const BDAddressType addressType = fromJavaAdressTypeToBDAddressType(env, jaddressType); - const BDAddressType addressTypeDevice = device->getAddressType(); - if( addressTypeDevice != addressType ) { - // oops? - WARN_PRINT("DBTAdapter::connectDevice: AddressType mismatch, ignoring request: Requested %s, Device %s %s", - getBDAddressTypeString(addressType).c_str(), getBDAddressTypeString(addressTypeDevice).c_str(), - device->toString().c_str()); - } - std::shared_ptr<direct_bt::HCIHandler> hci = adapter->openHCI(); if( nullptr == hci ) { throw BluetoothException("Couldn't get or open adapter's HCI "+adapter->toString(), E_FILE_LINE); |