diff options
author | Sven Gothel <[email protected]> | 2020-06-24 13:55:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-24 13:55:54 +0200 |
commit | 548fa6e1bcf2518c3650e0149653826209117c44 (patch) | |
tree | d55fd8ea92dd7dd853f5675b72d365d78341b23b /java/direct_bt | |
parent | 9e64daadd7cdd5bcb7bd8bdc1400b3836125a2e9 (diff) |
DBTDevice::getServices() shall not throw an exception but return null on error (TinyB API)
Diffstat (limited to 'java/direct_bt')
-rw-r--r-- | java/direct_bt/tinyb/DBTDevice.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/java/direct_bt/tinyb/DBTDevice.java b/java/direct_bt/tinyb/DBTDevice.java index f0ab41ea..e2390a51 100644 --- a/java/direct_bt/tinyb/DBTDevice.java +++ b/java/direct_bt/tinyb/DBTDevice.java @@ -508,7 +508,18 @@ public class DBTDevice extends DBTObject implements BluetoothDevice public native boolean remove() throws BluetoothException; @Override - public native List<BluetoothGattService> getServices(); + public List<BluetoothGattService> getServices() { + try { + return getServicesImpl(); + } catch (final Throwable t) { + if(DEBUG) { + System.err.println("Caught "+t.getMessage()+" on thread "+Thread.currentThread().toString()); + t.printStackTrace(); + } + } + return null; + } + private native List<BluetoothGattService> getServicesImpl(); /* property accessors: */ |