diff options
author | Sven Gothel <[email protected]> | 2020-06-25 00:30:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-06-25 00:30:09 +0200 |
commit | a1a31f0b59b9896a04973846bfad2aa0bc9e8d1f (patch) | |
tree | 782d40db1b54693d32d07d841a8cca4a3bb08573 /java/org/tinyb/BluetoothDevice.java | |
parent | 8693aa160c4c4f7b72c34c99e7550a224a856644 (diff) |
GATTHandler/DBTDevice (incl Java): Add ping[GATT](), testing device availability via retrieval of GATT info
Issues a ping to the device, validating whether it is still reachable.
This method could be periodically utilized to shorten the underlying OS disconnect period
after turning the device off, which lies within 7-13s.
In case the device is no more reachable, disconnect will be initiated due to the occurring IO error.
+++
Implementation attempts to read the mandatory APPEARANCE CharacteristicValue
of the mandatory GENERIC_ACCESS service.
Diffstat (limited to 'java/org/tinyb/BluetoothDevice.java')
-rw-r--r-- | java/org/tinyb/BluetoothDevice.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/java/org/tinyb/BluetoothDevice.java b/java/org/tinyb/BluetoothDevice.java index c8035001..d693eb6b 100644 --- a/java/org/tinyb/BluetoothDevice.java +++ b/java/org/tinyb/BluetoothDevice.java @@ -140,6 +140,21 @@ public interface BluetoothDevice extends BluetoothObject List<BluetoothGattService> getServices(); /** + * Issues a GATT ping to the device, validating whether it is still reachable. + * <p> + * This method could be periodically utilized to shorten the underlying OS disconnect period + * after turning the device off, which lies within 7-13s. + * </p> + * <p> + * In case the device is no more reachable, disconnect will be initiated due to the occurring IO error. + * </p> + * + * @return {@code true} if successful, otherwise false in case no GATT services exists etc. + * @since 2.0.0 + */ + boolean pingGATT(); + + /** * Returns the timestamp in monotonic milliseconds when this device instance has been created, * either via its initial discovery or its initial direct connection. * |