fork BLE_API to add update adv payload API
Fork of BLE_API by
Revision 747:48d376eca517, committed 2015-07-21
- Comitter:
- rgrover1
- Date:
- Tue Jul 21 13:25:39 2015 +0100
- Parent:
- 746:e2c7eb0f8b26
- Child:
- 748:a0396fb04ce0
- Commit message:
- Synchronized with git rev d79995b3
Author: Rohit Grover
Merge pull request #56 from OJFord/develop
expose descriptors optional arg in derived GattChar. constructors
Changed in this revision
ble/GattCharacteristic.h | Show annotated file Show diff for this revision Revisions of this file |
ble/GattService.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ble/GattCharacteristic.h Tue Jul 21 13:25:38 2015 +0100 +++ b/ble/GattCharacteristic.h Tue Jul 21 13:25:39 2015 +0100 @@ -457,8 +457,9 @@ template <typename T> class ReadOnlyGattCharacteristic : public GattCharacteristic { public: - ReadOnlyGattCharacteristic<T>(const UUID &uuid, T *valuePtr, uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE) : - GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T), sizeof(T), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties) { + ReadOnlyGattCharacteristic<T>(const UUID &uuid, T *valuePtr, uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE, + GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : + GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T), sizeof(T), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -466,8 +467,9 @@ template <typename T> class WriteOnlyGattCharacteristic : public GattCharacteristic { public: - WriteOnlyGattCharacteristic<T>(const UUID &uuid, T *valuePtr, uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE) : - GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T), sizeof(T), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties) { + WriteOnlyGattCharacteristic<T>(const UUID &uuid, T *valuePtr, uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE, + GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : + GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T), sizeof(T), GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -475,9 +477,10 @@ template <typename T> class ReadWriteGattCharacteristic : public GattCharacteristic { public: - ReadWriteGattCharacteristic<T>(const UUID &uuid, T *valuePtr, uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE) : + ReadWriteGattCharacteristic<T>(const UUID &uuid, T *valuePtr, uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE, + GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T), sizeof(T), - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties) { + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -485,9 +488,10 @@ template <typename T, unsigned NUM_ELEMENTS> class WriteOnlyArrayGattCharacteristic : public GattCharacteristic { public: - WriteOnlyArrayGattCharacteristic<T, NUM_ELEMENTS>(const UUID &uuid, T valuePtr[NUM_ELEMENTS], uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE) : + WriteOnlyArrayGattCharacteristic<T, NUM_ELEMENTS>(const UUID &uuid, T valuePtr[NUM_ELEMENTS], uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE, + GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS, - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties) { + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -495,9 +499,10 @@ template <typename T, unsigned NUM_ELEMENTS> class ReadOnlyArrayGattCharacteristic : public GattCharacteristic { public: - ReadOnlyArrayGattCharacteristic<T, NUM_ELEMENTS>(const UUID &uuid, T valuePtr[NUM_ELEMENTS], uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE) : + ReadOnlyArrayGattCharacteristic<T, NUM_ELEMENTS>(const UUID &uuid, T valuePtr[NUM_ELEMENTS], uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE, + GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS, - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties) { + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -505,9 +510,10 @@ template <typename T, unsigned NUM_ELEMENTS> class ReadWriteArrayGattCharacteristic : public GattCharacteristic { public: - ReadWriteArrayGattCharacteristic<T, NUM_ELEMENTS>(const UUID &uuid, T valuePtr[NUM_ELEMENTS], uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE) : + ReadWriteArrayGattCharacteristic<T, NUM_ELEMENTS>(const UUID &uuid, T valuePtr[NUM_ELEMENTS], uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE, + GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS, - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties) { + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) { /* empty */ } };
--- a/ble/GattService.h Tue Jul 21 13:25:38 2015 +0100 +++ b/ble/GattService.h Tue Jul 21 13:25:39 2015 +0100 @@ -45,13 +45,13 @@ public: /** - * @brief Creates a new GattCharacteristic using the specified 16-bit + * @brief Creates a new GattService using the specified 16-bit * UUID, value length, and properties * - * @note The UUID value must be unique in the service and is normally >1 + * @note The UUID value must be unique and is normally >1 * * @param[in] uuid - * The UUID to use for this characteristic + * The UUID to use for this service * @param[in] characteristics * A pointer to an array of characteristics to be included within this service * @param[in] numCharacteristics