aboutsummaryrefslogtreecommitdiffstats
path: root/java/org/tinyb
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-25 10:33:12 +0100
committerSven Gothel <[email protected]>2020-10-25 10:33:12 +0100
commit5f6fdee65c34337b1ade27de59192dbfe613317d (patch)
treea4e674e07e9d516ef3cea2bf6d67dcb93bf87bd6 /java/org/tinyb
parent530db7b53364c7ba3460d2db8bde53bf2a20ef3f (diff)
Add ChangedAdapterSetCallback (C++), ChangedAdapterSetListener (Java) for [DBT|Bluetooth]Manager, enabling fully event driven workflow w/ adapter add/remove
Diffstat (limited to 'java/org/tinyb')
-rw-r--r--java/org/tinyb/BluetoothManager.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/java/org/tinyb/BluetoothManager.java b/java/org/tinyb/BluetoothManager.java
index b8754303..2a558805 100644
--- a/java/org/tinyb/BluetoothManager.java
+++ b/java/org/tinyb/BluetoothManager.java
@@ -75,6 +75,27 @@ public interface BluetoothManager
String toString();
}
+
+ /**
+ * Event listener to receive change events regarding the system's {@link BluetoothAdapter} set,
+ * e.g. about a removed or added {@link BluetoothAdapter} due to user interaction or 'cold reset'.
+ * @since 2.0.0
+ * @implNote Not implemented on tinyb.dbus
+ */
+ public static interface ChangedAdapterSetListener {
+ /**
+ * {@link BluetoothAdapter} was added to the system.
+ * @param adapter the newly added {@link BluetoothAdapter} to the system
+ */
+ void adapterAdded(final BluetoothAdapter adapter);
+
+ /**
+ * {@link BluetoothAdapter} was removed from the system.
+ * @param adapter the removed {@link BluetoothAdapter} from the system
+ */
+ void adapterRemoved(final BluetoothAdapter adapter);
+ }
+
/**
* Returns this implmentation's {@link Settings}.
*/
@@ -269,6 +290,26 @@ public interface BluetoothManager
public boolean getDiscovering() throws BluetoothException;
/**
+ * Add the given {@link ChangedAdapterSetListener} to this manager.
+ * <p>
+ * When a new callback is added, all available adapter's will be reported as added,
+ * this allows a fully event driven workflow.
+ * </p>
+ * @since 2.0.0
+ * @implNote Not implemented on tinyb.dbus
+ */
+ void addChangedAdapterSetListener(final ChangedAdapterSetListener l);
+
+ /**
+ * Remove the given {@link ChangedAdapterSetListener} from this manager.
+ * @param l the to be removed element
+ * @return the number of removed elements
+ * @since 2.0.0
+ * @implNote Not implemented on tinyb.dbus
+ */
+ int removeChangedAdapterSetListener(final ChangedAdapterSetListener l);
+
+ /**
* Release the native memory associated with this object and all related Bluetooth resources.
* The object should not be used following a call to close
* <p>