jgh

Dependents:   Migration

Fork of BLE_API by Bluetooth Low Energy

Revision:
565:a3fb221c0813
Parent:
524:6e97ab392e2a
Child:
566:6681c6e0d7c0
diff -r 1d8aa4ad07fe -r a3fb221c0813 public/DiscoveredCharacteristic.h
--- 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