summaryrefslogtreecommitdiffstats
path: root/java/jni
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-06-29 06:39:03 +0200
committerSven Gothel <[email protected]>2020-06-29 06:39:03 +0200
commitfe752e88e00739a72a61e28f4df778296f69ce1a (patch)
treed2598ffed7b27a2459ad0cfc8c51597dca1aa18c /java/jni
parentcb2875cf12344f47eb2640d393483eea464ebea4 (diff)
DBTDevice.java: Update 'name' on deviceUpdate EIRDataTypeSet.DataType.NAME (drop final qualifier, add volatile)v2.1.9
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().
Diffstat (limited to 'java/jni')
-rw-r--r--java/jni/direct_bt/DBTDevice.cxx11
1 files changed, 11 insertions, 0 deletions
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<DBTDevice>(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<DBTDevice>(env, obj);