diff options
author | Sven Gothel <[email protected]> | 2020-07-21 22:15:23 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-07-21 22:15:23 +0200 |
commit | da1f91d69daa6eacb00824760b11f33a921732f5 (patch) | |
tree | 0b3620c88855e0e16677a4c7d4775888cbba2b61 /java | |
parent | 01eec2e5f4ce0c91f64bcf1035cdda22f6f6ea3a (diff) |
DBTAdapter: Make HCIHandler instance aggregated (lifecycle over full adapter lifecycle)
Since HCIHandler is being used to track all connections (direct or whitelisted),
it is essential to have it running over the whole adapter lifecycle.
openHCI() is now being performed within validateDevInfo(),
hence also sets adapter's valid state.
Call newly added checkValid() in user API on most 'action' methods,
throws exception if adapter is in invalid state.
Diffstat (limited to 'java')
-rw-r--r-- | java/jni/direct_bt/DBTAdapter.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx index 4aa4c434..26b3fbcb 100644 --- a/java/jni/direct_bt/DBTAdapter.cxx +++ b/java/jni/direct_bt/DBTAdapter.cxx @@ -624,9 +624,9 @@ jobject Java_direct_1bt_tinyb_DBTAdapter_connectDevice(JNIEnv *env, jobject obj, const BDAddressType addressType = fromJavaAdressTypeToBDAddressType(env, jaddressType); std::shared_ptr<DBTDevice> device = adapter->findDiscoveredDevice(address, addressType); if( nullptr != device ) { - std::shared_ptr<direct_bt::HCIHandler> hci = adapter->openHCI(); + std::shared_ptr<direct_bt::HCIHandler> hci = adapter->getHCI(); if( nullptr == hci ) { - throw BluetoothException("Couldn't get or open adapter's HCI "+adapter->toString(), E_FILE_LINE); + throw BluetoothException("Adapter's HCI not open "+adapter->toString(), E_FILE_LINE); } std::shared_ptr<JavaAnonObj> jDeviceRef = device->getJavaObject(); JavaGlobalObj::check(jDeviceRef, E_FILE_LINE); |