fork BLE_API to add update adv payload API
Fork of BLE_API by
Revision 708:41c26f44b1ef, committed 2015-06-19
- Comitter:
- rgrover1
- Date:
- Fri Jun 19 15:53:06 2015 +0100
- Parent:
- 707:94cea82e7d2c
- Child:
- 709:77f6fc6999cd
- 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:53:06 2015 +0100 +++ b/common/DiscoveredCharacteristic.cpp Fri Jun 19 15:53:06 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:53:06 2015 +0100 +++ b/public/DiscoveredCharacteristic.h Fri Jun 19 15:53:06 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