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 113:7e3fd573d87b, committed 2014-08-28
- Comitter:
- carlescufi
- Date:
- Thu Aug 28 14:17:34 2014 +0200
- Parent:
- 112:64c88ad45610
- Child:
- 114:f1ede142a78f
- Commit message:
- Add optional descriptors to the char constructor
Changed in this revision
| public/GattCharacteristic.h | Show annotated file Show diff for this revision Revisions of this file |
| public/GattService.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/public/GattCharacteristic.h Wed Aug 27 15:22:22 2014 +0200
+++ b/public/GattCharacteristic.h Thu Aug 28 14:17:34 2014 +0200
@@ -297,7 +297,7 @@
uint16_t gatt_nsdesc; /**< Namespace description from Bluetooth Assigned Numbers, normally '0', see @ref BLE_GATT_CPF_NAMESPACES. */
} presentation_format_t;
- /**
+ /**
* @brief Creates a new GattCharacteristic using the specified 16-bit
* UUID, value length, and properties
*
@@ -313,21 +313,17 @@
* The max length in bytes of this characteristic's value
* @param[in] props
* The 8-bit bit field containing the characteristic's properties
- *
- * @section EXAMPLE
- *
- * @code
- *
- * // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write
- * GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE );
- *
- * @endcode
+ * @param[in] descriptors
+ * A pointer to an array of descriptors to be included within this characteristic
+ * @param[in] numDescriptors
+ * The number of descriptors
*/
/**************************************************************************/
GattCharacteristic(const UUID &uuid, uint8_t *valuePtr = NULL, uint16_t initialLen = 0, uint16_t maxLen = 0,
- uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE) :
- GattAttribute(uuid, valuePtr, initialLen, maxLen), _properties(props) {
- /* empty */
+ uint8_t props = BLE_GATT_CHAR_PROPERTIES_NONE,
+ GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) :
+ GattAttribute(uuid, valuePtr, initialLen, maxLen), _properties(props), _descriptors(descriptors), _descriptorCount(numDescriptors) {
+
}
public:
@@ -335,9 +331,10 @@
return _properties;
}
-
private:
uint8_t _properties;
+ GattAttribute ** _descriptors;
+ uint8_t _descriptorCount;
};
#endif // ifndef __GATT_CHARACTERISTIC_H__
--- a/public/GattService.h Wed Aug 27 15:22:22 2014 +0200
+++ b/public/GattService.h Thu Aug 28 14:17:34 2014 +0200
@@ -31,6 +31,20 @@
class GattService
{
public:
+ /**
+ * @brief Creates a new GattCharacteristic using the specified 16-bit
+ * UUID, value length, and properties
+ *
+ * @note The UUID value must be unique in the service and is normally >1
+ *
+ * @param[in] uuid
+ * The UUID to use for this characteristic
+ * @param[in] characteristics
+ * A pointer to an array of characteristics to be included within this service
+ * @param[in] numCharacteristics
+ * The number of characteristics
+ */
+ /**************************************************************************/
GattService(const UUID &uuid, GattCharacteristic *characteristics[], unsigned numCharacteristics);
enum {
