From fe752e88e00739a72a61e28f4df778296f69ce1a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 29 Jun 2020 06:39:03 +0200 Subject: DBTDevice.java: Update 'name' on deviceUpdate EIRDataTypeSet.DataType.NAME (drop final qualifier, add volatile) On rare occasions (?) it may happen that the device discovery didn't include the device's name when reported via deviceFound(..) callback etc. Therefor allow updating of the name, using the C++ DBTDevice::getName(). --- java/jni/direct_bt/DBTDevice.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'java/jni') diff --git a/java/jni/direct_bt/DBTDevice.cxx b/java/jni/direct_bt/DBTDevice.cxx index e0acb004..808a3e2e 100644 --- a/java/jni/direct_bt/DBTDevice.cxx +++ b/java/jni/direct_bt/DBTDevice.cxx @@ -146,6 +146,17 @@ void Java_direct_1bt_tinyb_DBTDevice_initImpl(JNIEnv *env, jobject obj) } } +jstring Java_direct_1bt_tinyb_DBTDevice_getNameImpl(JNIEnv *env, jobject obj) { + try { + DBTDevice *nativePtr = getInstance(env, obj); + JavaGlobalObj::check(nativePtr->getJavaObject(), E_FILE_LINE); + return from_string_to_jstring(env, nativePtr->getName()); + } catch(...) { + rethrow_and_raise_java_exception(env); + } + return nullptr; +} + jstring Java_direct_1bt_tinyb_DBTDevice_toStringImpl(JNIEnv *env, jobject obj) { try { DBTDevice *nativePtr = getInstance(env, obj); -- cgit v1.2.3