summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-06-25 00:30:09 +0200
committerSven Gothel <[email protected]>2020-06-25 00:30:09 +0200
commita1a31f0b59b9896a04973846bfad2aa0bc9e8d1f (patch)
tree782d40db1b54693d32d07d841a8cca4a3bb08573 /api
parent8693aa160c4c4f7b72c34c99e7550a224a856644 (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 'api')
-rw-r--r--api/direct_bt/DBTDevice.hpp17
-rw-r--r--api/direct_bt/GATTHandler.hpp13
2 files changed, 30 insertions, 0 deletions
diff --git a/api/direct_bt/DBTDevice.hpp b/api/direct_bt/DBTDevice.hpp
index 6c8097d1..e01ecaab 100644
--- a/api/direct_bt/DBTDevice.hpp
+++ b/api/direct_bt/DBTDevice.hpp
@@ -326,6 +326,23 @@ namespace direct_bt {
std::shared_ptr<GenericAccess> getGATTGenericAccess();
/**
+ * 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, the GATTHandler will initiate disconnect due to the occurring IO error.
+ * will issue a disconnect.
+ * </p>
+ * <p>
+ * See {@link #getGATTServices()} regarding GATT initialization.
+ * </p>
+ * @return {@code true} if successful, otherwise false in case no GATT services exists etc.
+ */
+ bool pingGATT();
+
+ /**
* Explicit disconnecting an open GATTHandler, which is usually performed via disconnect()
* <p>
* Implementation will also discard the GATTHandler reference.
diff --git a/api/direct_bt/GATTHandler.hpp b/api/direct_bt/GATTHandler.hpp
index 253077d0..92a79c38 100644
--- a/api/direct_bt/GATTHandler.hpp
+++ b/api/direct_bt/GATTHandler.hpp
@@ -374,6 +374,19 @@ namespace direct_bt {
std::shared_ptr<DeviceInformation> getDeviceInformation(std::vector<GATTServiceRef> & primServices);
std::shared_ptr<DeviceInformation> getDeviceInformation(std::vector<GATTCharacteristicRef> & deviceInfoCharDeclList);
+
+ /**
+ * Issues a 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.
+ */
+ bool ping();
};
} // namespace direct_bt