diff options
author | Petre Eftime <[email protected]> | 2016-07-05 14:17:43 +0300 |
---|---|---|
committer | Petre Eftime <[email protected]> | 2016-07-05 15:26:18 +0300 |
commit | a646843cdc94b3a80db29c27928271664412ca00 (patch) | |
tree | 242921f0ced36bc74e706aa5adae1f2d745e7c17 /java | |
parent | 3e629a23b367dd2c6a4b0c5d6ec970f6278805c1 (diff) |
java: throw BluetoothExceptions explicitly
Signed-off-by: Petre Eftime <[email protected]>
Diffstat (limited to 'java')
-rw-r--r-- | java/BluetoothAdapter.java | 4 | ||||
-rw-r--r-- | java/BluetoothDevice.java | 12 | ||||
-rw-r--r-- | java/BluetoothGattCharacteristic.java | 4 | ||||
-rw-r--r-- | java/BluetoothGattDescriptor.java | 2 | ||||
-rw-r--r-- | java/BluetoothManager.java | 8 |
5 files changed, 15 insertions, 15 deletions
diff --git a/java/BluetoothAdapter.java b/java/BluetoothAdapter.java index 4c8314f0..cd51823d 100644 --- a/java/BluetoothAdapter.java +++ b/java/BluetoothAdapter.java @@ -74,12 +74,12 @@ public class BluetoothAdapter extends BluetoothObject /** Turns on device discovery if it is disabled. * @return TRUE if discovery was successfully enabled */ - public native boolean startDiscovery(); + public native boolean startDiscovery() throws BluetoothException; /** Turns off device discovery if it is enabled. * @return TRUE if discovery was successfully disabled */ - public native boolean stopDiscovery(); + public native boolean stopDiscovery() throws BluetoothException; /** Returns a list of BluetoothDevices visible from this adapter. * @return A list of BluetoothDevices visible on this adapter, diff --git a/java/BluetoothDevice.java b/java/BluetoothDevice.java index 0c1061b7..07605b59 100644 --- a/java/BluetoothDevice.java +++ b/java/BluetoothDevice.java @@ -73,36 +73,36 @@ public class BluetoothDevice extends BluetoothObject * profiles. * @return TRUE if the device disconnected */ - public native boolean disconnect(); + public native boolean disconnect() throws BluetoothException; /** A connection to this device is established, connecting each profile * flagged as auto-connectable. * @return TRUE if the device connected */ - public native boolean connect(); + public native boolean connect() throws BluetoothException; /** Connects a specific profile available on the device, given by UUID * @param arg_UUID The UUID of the profile to be connected * @return TRUE if the profile connected successfully */ - public native boolean connectProfile(String arg_UUID); + public native boolean connectProfile(String arg_UUID) throws BluetoothException; /** Disconnects a specific profile available on the device, given by UUID * @param arg_UUID The UUID of the profile to be disconnected * @return TRUE if the profile disconnected successfully */ - public native boolean disconnectProfile(String arg_UUID); + public native boolean disconnectProfile(String arg_UUID) throws BluetoothException; /** A connection to this device is established, and the device is then * paired. * @return TRUE if the device connected and paired */ - public native boolean pair(); + public native boolean pair() throws BluetoothException; /** Cancels an initiated pairing operation * @return TRUE if the paring is cancelled successfully */ - public native boolean cancelPairing(); + public native boolean cancelPairing() throws BluetoothException; /** Returns a list of BluetoothGattServices available on this device. * @return A list of BluetoothGattServices available on this device, diff --git a/java/BluetoothGattCharacteristic.java b/java/BluetoothGattCharacteristic.java index 4ef0fd19..cb80c3be 100644 --- a/java/BluetoothGattCharacteristic.java +++ b/java/BluetoothGattCharacteristic.java @@ -72,7 +72,7 @@ public class BluetoothGattCharacteristic extends BluetoothObject /** Reads the value of this characteristic. * @return A std::vector<unsgined char> containing the value of this characteristic. */ - public native byte[] readValue(); + public native byte[] readValue() throws BluetoothException; public native void enableValueNotifications(BluetoothNotification<byte[]> callback); public native void disableValueNotifications(); @@ -82,7 +82,7 @@ public class BluetoothGattCharacteristic extends BluetoothObject * to be written packed in a GBytes struct * @return TRUE if value was written succesfully */ - public native boolean writeValue(byte[] argValue); + public native boolean writeValue(byte[] argValue) throws BluetoothException; /* D-Bus property accessors: */ diff --git a/java/BluetoothGattDescriptor.java b/java/BluetoothGattDescriptor.java index 80fdd60b..b1a87c78 100644 --- a/java/BluetoothGattDescriptor.java +++ b/java/BluetoothGattDescriptor.java @@ -48,7 +48,7 @@ public class BluetoothGattDescriptor extends BluetoothObject * to be written packed in a GBytes struct * @return TRUE if value was written succesfully */ - public native boolean writeValue(byte[] argValue); + public native boolean writeValue(byte[] argValue) throws BluetoothException; public native void enableValueNotifications(BluetoothNotification<byte[]> value); public native void disableValueNotifications(); diff --git a/java/BluetoothManager.java b/java/BluetoothManager.java index c101a133..f684403e 100644 --- a/java/BluetoothManager.java +++ b/java/BluetoothManager.java @@ -193,14 +193,14 @@ public class BluetoothManager /** Turns on device discovery on the default adapter if it is disabled. * @return TRUE if discovery was successfully enabled */ - public native boolean startDiscovery(); + public native boolean startDiscovery() throws BluetoothException; /** Turns off device discovery on the default adapter if it is enabled. * @return TRUE if discovery was successfully disabled */ - public native boolean stopDiscovery(); + public native boolean stopDiscovery() throws BluetoothException; - private native void init(); + private native void init() throws BluetoothException; private native void delete(); private BluetoothManager() { @@ -210,7 +210,7 @@ public class BluetoothManager /** Returns an instance of BluetoothManager, to be used instead of constructor. * @return An initialized BluetoothManager instance. */ - public static synchronized BluetoothManager getBluetoothManager() throws RuntimeException + public static synchronized BluetoothManager getBluetoothManager() throws RuntimeException, BluetoothException { if (inst == null) { |