summaryrefslogtreecommitdiffstats
path: root/java/jni
diff options
context:
space:
mode:
Diffstat (limited to 'java/jni')
-rw-r--r--java/jni/direct_bt/DBTAdapter.cxx20
1 files changed, 5 insertions, 15 deletions
diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx
index 360084b1..1e32ade8 100644
--- a/java/jni/direct_bt/DBTAdapter.cxx
+++ b/java/jni/direct_bt/DBTAdapter.cxx
@@ -392,21 +392,6 @@ jstring Java_direct_1bt_tinyb_DBTAdapter_toStringImpl(JNIEnv *env, jobject obj)
return nullptr;
}
-jboolean Java_direct_1bt_tinyb_DBTAdapter_openImpl(JNIEnv *env, jobject obj) {
- try {
- DBTAdapter *adapter = getInstance<DBTAdapter>(env, obj);
- DBG_PRINT("Java_direct_1bt_tinyb_DBTAdapter_deleteImpl %s", adapter->toString().c_str());
- std::shared_ptr<direct_bt::HCIComm> hciSession = adapter->openHCI();
- if( nullptr == hciSession ) {
- throw BluetoothException("Couldn't open adapter "+adapter->toString(), E_FILE_LINE);
- }
- return JNI_TRUE;
- } catch(...) {
- rethrow_and_raise_java_exception(env);
- }
- return JNI_FALSE;
-}
-
void Java_direct_1bt_tinyb_DBTAdapter_deleteImpl(JNIEnv *env, jobject obj)
{
try {
@@ -594,6 +579,11 @@ jobject Java_direct_1bt_tinyb_DBTAdapter_connectDevice(JNIEnv *env, jobject obj,
getBDAddressTypeString(addressType).c_str(), getBDAddressTypeString(addressTypeDevice).c_str(),
device->toString().c_str());
}
+
+ std::shared_ptr<direct_bt::HCIComm> hci = adapter->openHCI();
+ if( nullptr == hci ) {
+ throw BluetoothException("Couldn't get or open adapter's HCIComm "+adapter->toString(), E_FILE_LINE);
+ }
std::shared_ptr<JavaAnonObj> jDeviceRef = device->getJavaObject();
JavaGlobalObj::check(jDeviceRef, E_FILE_LINE);