aboutsummaryrefslogtreecommitdiffstats
path: root/java/jni
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-11-14 00:58:08 +0100
committerSven Gothel <[email protected]>2021-11-14 00:58:08 +0100
commit11e174d9c648e593d5a8fdbf976a72819a6351e1 (patch)
treed219957a996cea72f0732f7983a4d99bd71bf048 /java/jni
parent2078513a45b47758ca72b694d549a63b53957777 (diff)
Complete DBGattServer Lifecycle: Add DBGatt* dtor on Java side; Remove BTAdapter held reference on disconnect, align ref holding in Java BTAdapter; Add explicit shutdown test
Diffstat (limited to 'java/jni')
-rw-r--r--java/jni/direct_bt/DBGattServer.cxx48
1 files changed, 48 insertions, 0 deletions
diff --git a/java/jni/direct_bt/DBGattServer.cxx b/java/jni/direct_bt/DBGattServer.cxx
index fbef1800..9a3ee0c9 100644
--- a/java/jni/direct_bt/DBGattServer.cxx
+++ b/java/jni/direct_bt/DBGattServer.cxx
@@ -132,6 +132,18 @@ jlong Java_org_direct_1bt_DBGattDesc_ctorImpl(JNIEnv *env, jclass clazz,
return (jlong) (intptr_t)nullptr;
}
+void Java_org_direct_1bt_DBGattDesc_dtorImpl(JNIEnv *env, jclass clazz, jlong nativeInstance) {
+ (void)clazz;
+ try {
+ if( 0 != nativeInstance ) {
+ std::shared_ptr<DBGattDesc> * ref_ptr = reinterpret_cast<std::shared_ptr<DBGattDesc> *>(nativeInstance);
+ delete ref_ptr;
+ }
+ } catch(...) {
+ rethrow_and_raise_java_exception(env);
+ }
+}
+
jshort Java_org_direct_1bt_DBGattDesc_getHandle(JNIEnv *env, jobject obj)
{
try {
@@ -244,6 +256,18 @@ jlong Java_org_direct_1bt_DBGattChar_ctorImpl(JNIEnv *env, jclass clazz,
return (jlong) (intptr_t)nullptr;
}
+void Java_org_direct_1bt_DBGattChar_dtorImpl(JNIEnv *env, jclass clazz, jlong nativeInstance) {
+ (void)clazz;
+ try {
+ if( 0 != nativeInstance ) {
+ std::shared_ptr<DBGattChar> * ref_ptr = reinterpret_cast<std::shared_ptr<DBGattChar> *>(nativeInstance);
+ delete ref_ptr;
+ }
+ } catch(...) {
+ rethrow_and_raise_java_exception(env);
+ }
+}
+
jshort Java_org_direct_1bt_DBGattChar_getHandle(JNIEnv *env, jobject obj)
{
try {
@@ -347,6 +371,18 @@ jlong Java_org_direct_1bt_DBGattService_ctorImpl(JNIEnv *env, jclass clazz,
return (jlong) (intptr_t)nullptr;
}
+void Java_org_direct_1bt_DBGattService_dtorImpl(JNIEnv *env, jclass clazz, jlong nativeInstance) {
+ (void)clazz;
+ try {
+ if( 0 != nativeInstance ) {
+ std::shared_ptr<DBGattService> * ref_ptr = reinterpret_cast<std::shared_ptr<DBGattService> *>(nativeInstance);
+ delete ref_ptr;
+ }
+ } catch(...) {
+ rethrow_and_raise_java_exception(env);
+ }
+}
+
jshort Java_org_direct_1bt_DBGattService_getHandle(JNIEnv *env, jobject obj)
{
try {
@@ -423,6 +459,18 @@ jlong Java_org_direct_1bt_DBGattServer_ctorImpl(JNIEnv *env, jclass clazz,
return (jlong) (intptr_t)nullptr;
}
+void Java_org_direct_1bt_DBGattServer_dtorImpl(JNIEnv *env, jclass clazz, jlong nativeInstance) {
+ (void)clazz;
+ try {
+ if( 0 != nativeInstance ) {
+ std::shared_ptr<DBGattServer> * ref_ptr = reinterpret_cast<std::shared_ptr<DBGattServer> *>(nativeInstance);
+ delete ref_ptr;
+ }
+ } catch(...) {
+ rethrow_and_raise_java_exception(env);
+ }
+}
+
jint Java_org_direct_1bt_DBGattServer_getMaxAttMTU(JNIEnv *env, jobject obj)
{
try {