aboutsummaryrefslogtreecommitdiffstats
path: root/java/tinyb/dbus/DBusManager.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-10-13 02:19:02 +0200
committerSven Gothel <[email protected]>2020-10-13 02:19:02 +0200
commitf3acf0e335bf65e67aa5b4d292bb5446ffbde271 (patch)
treea206c9b4aa0d550fe0d73f9d7e7d24e5680ad6d0 /java/tinyb/dbus/DBusManager.java
parentd5adce54eedbbe17f47db839f47280ba8fcf1f49 (diff)
AdapterStatusListener[1] and DBTAdapter[2] API Refinement: [1] non const DBTAdapter, [2] use HCIStatusCode for start/stopDiscovery
and well as [2] return boolean for set[Discoverable|Bondable|Powered](..). AdapterStatusListener needs to pass non-const DBTAdapter to allow actionable modification of adapter state, e.g. start/stopDiscovery. HCIStatusCode is desired for start/stopDiscovery, allowing user to read actual HCI status code on failure. boolean return value for set[Discoverable|Bondable|Powered](..) reflecting general success or failure on these basic commands.
Diffstat (limited to 'java/tinyb/dbus/DBusManager.java')
-rw-r--r--java/tinyb/dbus/DBusManager.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/java/tinyb/dbus/DBusManager.java b/java/tinyb/dbus/DBusManager.java
index 61d0935d..e815aeec 100644
--- a/java/tinyb/dbus/DBusManager.java
+++ b/java/tinyb/dbus/DBusManager.java
@@ -37,6 +37,7 @@ import org.tinyb.BluetoothGattService;
import org.tinyb.BluetoothObject;
import org.tinyb.BluetoothManager;
import org.tinyb.BluetoothType;
+import org.tinyb.HCIStatusCode;
public class DBusManager implements BluetoothManager
{
@@ -109,12 +110,15 @@ public class DBusManager implements BluetoothManager
public native boolean startDiscovery() throws BluetoothException;
@Override
- public boolean startDiscovery(final boolean keepAlive) throws BluetoothException {
- return startDiscovery(); // FIXME keepAlive
+ public HCIStatusCode startDiscovery(final boolean keepAlive) throws BluetoothException {
+ return startDiscovery() ? HCIStatusCode.SUCCESS : HCIStatusCode.INTERNAL_FAILURE; // FIXME keepAlive
}
@Override
- public native boolean stopDiscovery() throws BluetoothException;
+ public HCIStatusCode stopDiscovery() throws BluetoothException {
+ return stopDiscoveryImpl() ? HCIStatusCode.SUCCESS : HCIStatusCode.INTERNAL_FAILURE;
+ }
+ private native boolean stopDiscoveryImpl() throws BluetoothException;
@Override
public native boolean getDiscovering() throws BluetoothException;