BLE
Fork of BLE_API by
Diff: public/DiscoveredCharacteristic.h
- Revision:
- 566:a3fb221c0813
- Parent:
- 525:6e97ab392e2a
- Child:
- 567:6681c6e0d7c0
--- 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