diff options
author | Sven Gothel <[email protected]> | 2021-02-09 05:18:48 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-02-09 05:18:48 +0100 |
commit | 7ce8651a5737f5a66c8be3f4cb975e134a7a0699 (patch) | |
tree | 381f6e24a87cb09400e71f5df5de93c61e55986f /java | |
parent | 02914f26e252bd9ce61b5c7569703c73ff4f205a (diff) |
BTDevice.java: Add isValid() query, i.e. device reference valid and device not removed
Diffstat (limited to 'java')
-rw-r--r-- | java/jau/direct_bt/DBTDevice.java | 4 | ||||
-rw-r--r-- | java/org/direct_bt/BTDevice.java | 9 | ||||
-rw-r--r-- | java/tinyb/dbus/DBusDevice.java | 3 |
3 files changed, 16 insertions, 0 deletions
diff --git a/java/jau/direct_bt/DBTDevice.java b/java/jau/direct_bt/DBTDevice.java index 1985aae9..1b464a27 100644 --- a/java/jau/direct_bt/DBTDevice.java +++ b/java/jau/direct_bt/DBTDevice.java @@ -697,6 +697,10 @@ public class DBTDevice extends DBTObject implements BTDevice private native boolean removeImpl() throws BTException; @Override + public final boolean isValid() { return super.isValid() /* && isValidImpl() */; } + // public native boolean isValidImpl(); + + @Override public List<BTGattService> getServices() { try { final List<BTGattService> services = getServicesImpl(); diff --git a/java/org/direct_bt/BTDevice.java b/java/org/direct_bt/BTDevice.java index fa06d89d..0b8eaf4e 100644 --- a/java/org/direct_bt/BTDevice.java +++ b/java/org/direct_bt/BTDevice.java @@ -555,6 +555,15 @@ public interface BTDevice extends BTObject */ boolean remove() throws BTException; + /** + * Returns whether the device is valid, i.e. reference is valid + * but not necessarily {@link #getConnected() connected}. + * @return true if this device's references are valid and hasn't been {@link #remove()}'ed + * @see #remove() + * @since 2.2.0 + */ + public boolean isValid(); + /** Cancels an initiated pairing operation * @return TRUE if the paring is cancelled successfully */ diff --git a/java/tinyb/dbus/DBusDevice.java b/java/tinyb/dbus/DBusDevice.java index 42a37117..7fd552a6 100644 --- a/java/tinyb/dbus/DBusDevice.java +++ b/java/tinyb/dbus/DBusDevice.java @@ -168,6 +168,9 @@ public class DBusDevice extends DBusObject implements BTDevice public native boolean remove() throws BTException; @Override + public final boolean isValid() { return super.isValid(); } + + @Override public native boolean cancelPairing() throws BTException; @Override |