Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 565:a3fb221c0813, committed 2015-06-19
- Comitter:
- rgrover1
- Date:
- Fri Jun 19 15:52:11 2015 +0100
- Parent:
- 564:1d8aa4ad07fe
- Child:
- 566:6681c6e0d7c0
- Commit message:
- Synchronized with git rev b7e6ddfa
Author: Rohit Grover
DiscoveredCharacteristic: add API for discovering descriptors.
Changed in this revision
--- a/common/DiscoveredCharacteristic.cpp Fri Jun 19 15:52:11 2015 +0100
+++ b/common/DiscoveredCharacteristic.cpp Fri Jun 19 15:52:11 2015 +0100
@@ -60,4 +60,10 @@
}
return gattc->write(GattClient::GATT_OP_WRITE_CMD, connHandle, valueHandle, length, value);
+}
+
+ble_error_t
+DiscoveredCharacteristic::discoverDescriptors(DescriptorCallback_t callback, const UUID &matchingUUID) const
+{
+ return BLE_ERROR_NOT_IMPLEMENTED; /* TODO: this needs to be filled in. */
}
\ No newline at end of file
--- a/public/DiscoveredCharacteristic.h Fri Jun 19 15:52:11 2015 +0100
+++ b/public/DiscoveredCharacteristic.h Fri Jun 19 15:52:11 2015 +0100
@@ -52,6 +52,25 @@
};
/**
+ * Structure for holding information about the service and the characteristics
+ * found during the discovery process.
+ */
+ struct DiscoveredDescriptor {
+ GattAttribute::Handle_t handle; /**< Descriptor Handle. */
+ UUID uuid; /**< Descriptor UUID. */
+ };
+
+ /**
+ * Callback type for when a characteristic descriptor is found during descriptor-
+ * discovery. The receiving function is passed in a pointer to a
+ * DiscoveredDescriptor object which will remain valid for the lifetime
+ * of the callback. Memory for this object is owned by the BLE_API eventing
+ * framework. The application can safely make a persistent shallow-copy of
+ * this object in order to work with the characteristic beyond the callback.
+ */
+ typedef void (*DescriptorCallback_t)(const DiscoveredDescriptor *);
+
+ /**
* Initiate (or continue) a read for the value attribute, optionally at a
* given offset. If the Characteristic or Descriptor to be read is longer
* than ATT_MTU - 1, this function must be called multiple times with
@@ -87,6 +106,17 @@
ble_error_t writeWoResponse(uint16_t length, const uint8_t *value) const;
/**
+ * Initiate a GATT Characteristic Descriptor Discovery procedure for descriptors within this characteristic.
+ *
+ * @param callback
+ * @param matchingUUID
+ * filter for descriptors. Defaults to wildcard which will discover all descriptors.
+ *
+ * @return BLE_ERROR_NONE if descriptor discovery is launched successfully; else an appropriate error.
+ */
+ ble_error_t discoverDescriptors(DescriptorCallback_t callback, const UUID &matchingUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) const;
+
+ /**
* Perform a write procedure.
*
* @param length
