diff options
-rw-r--r-- | api/direct_bt/BTAdapter.hpp | 1 | ||||
-rw-r--r-- | java/jau/direct_bt/DBTAdapter.java | 3 | ||||
-rw-r--r-- | java/jni/direct_bt/DBTAdapter.cxx | 11 | ||||
-rw-r--r-- | java/org/direct_bt/BTAdapter.java | 9 |
4 files changed, 24 insertions, 0 deletions
diff --git a/api/direct_bt/BTAdapter.hpp b/api/direct_bt/BTAdapter.hpp index 90aeedcd..06d64478 100644 --- a/api/direct_bt/BTAdapter.hpp +++ b/api/direct_bt/BTAdapter.hpp @@ -643,6 +643,7 @@ namespace direct_bt { * By default, Secure Connections (SC) is enabled if supported. * * @param enable + * @return true if successful, otherwise false * @see getSecureConnectionsEnabled() * @since 2.4.0 */ diff --git a/java/jau/direct_bt/DBTAdapter.java b/java/jau/direct_bt/DBTAdapter.java index c1301733..a6dd1254 100644 --- a/java/jau/direct_bt/DBTAdapter.java +++ b/java/jau/direct_bt/DBTAdapter.java @@ -268,6 +268,9 @@ public class DBTAdapter extends DBTObject implements BTAdapter public native boolean setPowered(final boolean power_on); @Override + public native boolean getSecureConnectionsEnabled(); + + @Override public native boolean setSecureConnections(final boolean enable); @Override diff --git a/java/jni/direct_bt/DBTAdapter.cxx b/java/jni/direct_bt/DBTAdapter.cxx index a9898dbc..524f2064 100644 --- a/java/jni/direct_bt/DBTAdapter.cxx +++ b/java/jni/direct_bt/DBTAdapter.cxx @@ -888,6 +888,17 @@ jboolean Java_jau_direct_1bt_DBTAdapter_setPowered(JNIEnv *env, jobject obj, jbo return JNI_FALSE; } +jboolean Java_jau_direct_1bt_DBTAdapter_getSecureConnectionsEnabled(JNIEnv *env, jobject obj) { + try { + BTAdapter *adapter = jau::getJavaUplinkObject<BTAdapter>(env, obj); + jau::JavaGlobalObj::check(adapter->getJavaObject(), E_FILE_LINE); + return adapter->getSecureConnectionsEnabled() ? JNI_TRUE : JNI_FALSE; + } catch(...) { + rethrow_and_raise_java_exception(env); + } + return JNI_FALSE; +} + jboolean Java_jau_direct_1bt_DBTAdapter_setSecureConnections(JNIEnv *env, jobject obj, jboolean enable) { try { BTAdapter *adapter = jau::getJavaUplinkObject<BTAdapter>(env, obj); diff --git a/java/org/direct_bt/BTAdapter.java b/java/org/direct_bt/BTAdapter.java index 795cde39..f9d222f5 100644 --- a/java/org/direct_bt/BTAdapter.java +++ b/java/org/direct_bt/BTAdapter.java @@ -458,11 +458,20 @@ public interface BTAdapter extends BTObject boolean setPowered(final boolean power_on); /** + * Returns whether Secure Connections (SC) is enabled. + * @see #setSecureConnections(boolean) + * @since 2.4.0 + */ + boolean getSecureConnectionsEnabled(); + + /** * Enable or disable Secure Connections (SC) of the adapter. * * By default, Secure Connections (SC) is enabled if supported. * * @param enable + * @return true if successful, otherwise false + * @see #getSecureConnectionsEnabled() * @since 2.4.0 */ boolean setSecureConnections(final boolean enable); |