aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-10-10 04:52:25 +0200
committerSven Gothel <[email protected]>2021-10-10 04:52:25 +0200
commitae5fd90e31793b14f1e5a716b79a28ab75abcfdb (patch)
tree905e759f6627cfdfbd79c769cf908176f3da7932 /java
parent90422e7f0323b7f3e171c89db12612b0dd9f15c2 (diff)
Remove DirectBTJNISettings: Always use uuid_t -> uuid128_t mapping, unifying uuid_t
Equality and compare of uuid_t shall always be performed on uuid128_t if underlying types differ.
Diffstat (limited to 'java')
-rw-r--r--java/jau/direct_bt/DBTManager.java25
-rw-r--r--java/jni/direct_bt/DBTDevice.cxx4
-rw-r--r--java/jni/direct_bt/DBTGattChar.cxx4
-rw-r--r--java/jni/direct_bt/DBTGattService.cxx4
-rw-r--r--java/jni/direct_bt/DBTManager.cxx3
-rw-r--r--java/jni/direct_bt/helper_dbt.cxx2
-rw-r--r--java/jni/direct_bt/helper_dbt.hpp17
7 files changed, 6 insertions, 53 deletions
diff --git a/java/jau/direct_bt/DBTManager.java b/java/jau/direct_bt/DBTManager.java
index 33729ded..74958dcf 100644
--- a/java/jau/direct_bt/DBTManager.java
+++ b/java/jau/direct_bt/DBTManager.java
@@ -46,7 +46,6 @@ public class DBTManager implements BTManager
private static volatile boolean isJVMShuttingDown = false;
private static final List<Runnable> userShutdownHooks = new ArrayList<Runnable>();
- private static boolean unifyUUID128Bit = true;
static {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@@ -124,26 +123,6 @@ public class DBTManager implements BTManager
}
}
- /**
- * Returns whether uuid128_t consolidation is enabled
- * for native uuid16_t and uuid32_t values before string conversion.
- * @see #setUnifyUUID128Bit(boolean)
- */
- public static boolean getUnifyUUID128Bit() { return unifyUUID128Bit; }
-
- /**
- * Enables or disables uuid128_t consolidation
- * for native uuid16_t and uuid32_t values before string conversion.
- * <p>
- * Default is {@code true}.
- * </p>
- * <p>
- * If desired, this value should be set once before the first call of {@link #getManager()}!
- * </p>
- * @see #getUnifyUUID128Bit()
- */
- public static void setUnifyUUID128Bit(final boolean v) { unifyUUID128Bit=v; }
-
private long nativeInstance;
private final List<BTAdapter> adapters = new CopyOnWriteArrayList<BTAdapter>();
private final List<ChangedAdapterSetListener> changedAdapterSetListenerList = new CopyOnWriteArrayList<ChangedAdapterSetListener>();
@@ -298,11 +277,11 @@ public class DBTManager implements BTManager
}
}
- private native void initImpl(final boolean unifyUUID128Bit) throws BTException;
+ private native void initImpl() throws BTException;
private native void deleteImpl(long nativeInstance);
private DBTManager()
{
- initImpl(unifyUUID128Bit);
+ initImpl();
try {
adapters.addAll(getAdapterListImpl());
} catch (final BTException be) {
diff --git a/java/jni/direct_bt/DBTDevice.cxx b/java/jni/direct_bt/DBTDevice.cxx
index 5141b548..b3e9c2bf 100644
--- a/java/jni/direct_bt/DBTDevice.cxx
+++ b/java/jni/direct_bt/DBTDevice.cxx
@@ -798,9 +798,7 @@ jobject Java_jau_direct_1bt_DBTDevice_getServicesImpl(JNIEnv *env, jobject obj)
JavaGlobalObj::check(_device->getJavaObject(), E_FILE_LINE);
jobject jdevice = JavaGlobalObj::GetObject(_device->getJavaObject());
const jboolean isPrimary = service->primary;
- const jstring juuid = from_string_to_jstring(env_,
- directBTJNISettings.getUnifyUUID128Bit() ? service->type->toUUID128String() :
- service->type->toString());
+ const jstring juuid = from_string_to_jstring(env_, service->type->toUUID128String());
java_exception_check_and_throw(env_, E_FILE_LINE);
jobject jservice = env_->NewObject(clazz, clazz_ctor, (jlong)service, jdevice, isPrimary,
diff --git a/java/jni/direct_bt/DBTGattChar.cxx b/java/jni/direct_bt/DBTGattChar.cxx
index 5b6ab920..916beb4c 100644
--- a/java/jni/direct_bt/DBTGattChar.cxx
+++ b/java/jni/direct_bt/DBTGattChar.cxx
@@ -80,9 +80,7 @@ jobject Java_jau_direct_1bt_DBTGattChar_getDescriptorsImpl(JNIEnv *env, jobject
JavaGlobalObj::check(_characteristic->getJavaObject(), E_FILE_LINE);
jobject jcharacteristic = JavaGlobalObj::GetObject(_characteristic->getJavaObject());
- const jstring juuid = from_string_to_jstring(env_,
- directBTJNISettings.getUnifyUUID128Bit() ? descriptor->type->toUUID128String() :
- descriptor->type->toString());
+ const jstring juuid = from_string_to_jstring(env_, descriptor->type->toUUID128String());
java_exception_check_and_throw(env_, E_FILE_LINE);
const size_t value_size = descriptor->value.size();
diff --git a/java/jni/direct_bt/DBTGattService.cxx b/java/jni/direct_bt/DBTGattService.cxx
index 43539077..c6082cbe 100644
--- a/java/jni/direct_bt/DBTGattService.cxx
+++ b/java/jni/direct_bt/DBTGattService.cxx
@@ -105,9 +105,7 @@ jobject Java_jau_direct_1bt_DBTGattService_getCharsImpl(JNIEnv *env, jobject obj
JNIGlobalRef::check(jGattCharPropSet, E_FILE_LINE);
java_exception_check_and_throw(env_, E_FILE_LINE);
- const jstring uuid = from_string_to_jstring(env_,
- directBTJNISettings.getUnifyUUID128Bit() ? characteristic->value_type->toUUID128String() :
- characteristic->value_type->toString());
+ const jstring uuid = from_string_to_jstring(env_, characteristic->value_type->toUUID128String());
java_exception_check_and_throw(env_, E_FILE_LINE);
jobject jcharVal = env_->NewObject(clazz, clazz_ctor, (jlong)characteristic, jservice,
diff --git a/java/jni/direct_bt/DBTManager.cxx b/java/jni/direct_bt/DBTManager.cxx
index 985cb5b8..542e58a5 100644
--- a/java/jni/direct_bt/DBTManager.cxx
+++ b/java/jni/direct_bt/DBTManager.cxx
@@ -109,9 +109,8 @@ static void _addMgmtCBOnce(JNIEnv *env, BTManager & mgmt, JNIGlobalRef jmgmtRef,
}
}
-void Java_jau_direct_1bt_DBTManager_initImpl(JNIEnv *env, jobject obj, jboolean unifyUUID128Bit)
+void Java_jau_direct_1bt_DBTManager_initImpl(JNIEnv *env, jobject obj)
{
- directBTJNISettings.setUnifyUUID128Bit(unifyUUID128Bit);
try {
BTManager *manager = &BTManager::get(); // special: static singleton
setInstance<BTManager>(env, obj, manager);
diff --git a/java/jni/direct_bt/helper_dbt.cxx b/java/jni/direct_bt/helper_dbt.cxx
index 23d54105..7bc4d8af 100644
--- a/java/jni/direct_bt/helper_dbt.cxx
+++ b/java/jni/direct_bt/helper_dbt.cxx
@@ -32,8 +32,6 @@
using namespace direct_bt;
-DirectBTJNISettings direct_bt::directBTJNISettings;
-
static std::string jStringEmpty("");
static std::string jAddressTypePublic("public");
static std::string jAddressTypeRandom("random");
diff --git a/java/jni/direct_bt/helper_dbt.hpp b/java/jni/direct_bt/helper_dbt.hpp
index 8c7a45b5..3fd4f0ac 100644
--- a/java/jni/direct_bt/helper_dbt.hpp
+++ b/java/jni/direct_bt/helper_dbt.hpp
@@ -32,23 +32,6 @@
namespace direct_bt {
- class DirectBTJNISettings {
- private:
- bool unifyUUID128Bit = true;
-
- public:
- /**
- * Enables or disables uuid128_t consolidation
- * for native uuid16_t and uuid32_t values before string conversion.
- * <p>
- * Default is {@code true}.
- * </p>
- */
- bool getUnifyUUID128Bit() { return unifyUUID128Bit; }
- void setUnifyUUID128Bit(bool v) { unifyUUID128Bit = v; }
- };
- extern DirectBTJNISettings directBTJNISettings;
-
BDAddressType fromJavaAdressTypeToBDAddressType(JNIEnv *env, jstring jAddressType);
jstring fromBDAddressTypeToJavaAddressType(JNIEnv *env, BDAddressType bdAddressType);