diff options
author | Misterioso <[email protected]> | 2017-09-27 10:30:22 +0200 |
---|---|---|
committer | petreeftime <[email protected]> | 2017-10-03 08:27:19 +0300 |
commit | 76f092daeb37d254db822ac536ec01a26ad5e982 (patch) | |
tree | 8c196b83c74ecb39e0e37cf24bb798569995a148 /java/jni/BluetoothManager.cxx | |
parent | 73121e050cd3c3019844ed488388f80ff0be82f1 (diff) |
Added Java method BluetoothManager::getDiscovering()
Added a method to check if a discovery process is running directly from the BluetoothManager (completion to startDiscovery and stopDiscovery).
Signed-off-by: Jorge Esteves <[email protected]>
Diffstat (limited to 'java/jni/BluetoothManager.cxx')
-rw-r--r-- | java/jni/BluetoothManager.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/java/jni/BluetoothManager.cxx b/java/jni/BluetoothManager.cxx index d5c652e..dac0432 100644 --- a/java/jni/BluetoothManager.cxx +++ b/java/jni/BluetoothManager.cxx @@ -370,6 +370,25 @@ jboolean Java_tinyb_BluetoothManager_stopDiscovery(JNIEnv *env, jobject obj) return JNI_FALSE; } +jboolean Java_tinyb_BluetoothManager_getDiscovering(JNIEnv *env, jobject obj) +{ + try { + BluetoothManager *manager = getInstance<BluetoothManager>(env, obj); + return manager->get_discovering() ? JNI_TRUE : JNI_FALSE; + } catch (std::bad_alloc &e) { + raise_java_oom_exception(env, e); + } catch (BluetoothException &e) { + raise_java_bluetooth_exception(env, e); + } catch (std::runtime_error &e) { + raise_java_runtime_exception(env, e); + } catch (std::invalid_argument &e) { + raise_java_invalid_arg_exception(env, e); + } catch (std::exception &e) { + raise_java_exception(env, e); + } + return JNI_FALSE; +} + void Java_tinyb_BluetoothManager_init(JNIEnv *env, jobject obj) { try { |