summaryrefslogtreecommitdiffstats
path: root/java/jni/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-14 14:06:24 +0200
committerSven Gothel <[email protected]>2020-05-14 14:06:24 +0200
commit07ee3e5457a5cdf4305ef4e1f404b2c632dfed07 (patch)
tree791e80bd33ff57436e902254992d62002549c1fe /java/jni/direct_bt
parent9e1dec8ed7c5b71f45c35817101e3f5b03e5d4aa (diff)
DBTManager(java/jni): get/setDefaultAdapter(..) java side implementation, remove JNI code
Diffstat (limited to 'java/jni/direct_bt')
-rw-r--r--java/jni/direct_bt/DBTManager.cxx37
1 files changed, 0 insertions, 37 deletions
diff --git a/java/jni/direct_bt/DBTManager.cxx b/java/jni/direct_bt/DBTManager.cxx
index c870b6da..6e59b1fb 100644
--- a/java/jni/direct_bt/DBTManager.cxx
+++ b/java/jni/direct_bt/DBTManager.cxx
@@ -66,43 +66,6 @@ void Java_direct_1bt_tinyb_DBTManager_deleteImpl(JNIEnv *env, jobject obj)
static const std::string _adapterClazzCtorArgs("(JLjava/lang/String;Ljava/lang/String;)V");
-jobject Java_direct_1bt_tinyb_DBTManager_getDefaultAdapterImpl(JNIEnv *env, jobject obj)
-{
- try {
- DBTManager *manager = getInstance<DBTManager>(env, obj);
- DBG_PRINT("Java_direct_1bt_tinyb_DBTManager_getDefaultAdapterImpl: Manager %s", manager->toString().c_str());
- (void) manager;
- const int defAdapterIdx = 0;
- DBTAdapter * adapter = new DBTAdapter(defAdapterIdx);
- if( !adapter->isValid() ) {
- delete adapter;
- throw BluetoothException("Invalid default adapter "+std::to_string(defAdapterIdx), E_FILE_LINE);
- }
- if( !adapter->hasDevId() ) {
- delete adapter;
- throw BluetoothException("Invalid default adapter dev-id "+std::to_string(defAdapterIdx), E_FILE_LINE);
- }
-
- // prepare adapter ctor
- const jstring addr = from_string_to_jstring(env, adapter->getAddressString());
- const jstring name = from_string_to_jstring(env, adapter->getName());
- if( java_exception_check(env, E_FILE_LINE) ) { return nullptr; }
- const jclass clazz = search_class(env, *adapter);
- const jmethodID clazz_ctor = search_method(env, clazz, "<init>", _adapterClazzCtorArgs.c_str(), false);
- jobject jAdapter = env->NewObject(clazz, clazz_ctor, (jlong)adapter, addr, name);
- if( java_exception_check(env, E_FILE_LINE) ) { return nullptr; }
- JNIGlobalRef::check(jAdapter, E_FILE_LINE);
- std::shared_ptr<JavaAnonObj> jAdapterRef = adapter->getJavaObject();
- JavaGlobalObj::check(jAdapterRef, E_FILE_LINE);
-
- DBG_PRINT("Java_direct_1bt_tinyb_DBTManager_getDefaultAdapterImpl: New Adapter %p %s", adapter, adapter->toString().c_str());
- return JavaGlobalObj::GetObject(jAdapterRef);
- } catch(...) {
- rethrow_and_raise_java_exception(env);
- }
- return nullptr;
-}
-
jobject Java_direct_1bt_tinyb_DBTManager_getAdapterListImpl(JNIEnv *env, jobject obj)
{
try {