BLE_API for nRF51

Fork of BLE_API by Bluetooth Low Energy

Revision:
748:a0396fb04ce0
Parent:
747:48d376eca517
Child:
749:30b5e01ffe2d
diff -r 48d376eca517 -r a0396fb04ce0 ble/GattCharacteristic.h
--- a/ble/GattCharacteristic.h	Tue Jul 21 13:25:39 2015 +0100
+++ b/ble/GattCharacteristic.h	Tue Jul 21 13:25:39 2015 +0100
@@ -457,9 +457,13 @@
 template <typename T>
 class ReadOnlyGattCharacteristic : public GattCharacteristic {
 public:
-    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) {
+    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),
+                           BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) {
         /* empty */
     }
 };
@@ -467,9 +471,13 @@
 template <typename T>
 class WriteOnlyGattCharacteristic : public GattCharacteristic {
 public:
-    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) {
+    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),
+                           BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) {
         /* empty */
     }
 };
@@ -477,10 +485,13 @@
 template <typename T>
 class ReadWriteGattCharacteristic : public GattCharacteristic {
 public:
-    ReadWriteGattCharacteristic<T>(const UUID &uuid, T *valuePtr, uint8_t additionalProperties = BLE_GATT_CHAR_PROPERTIES_NONE,
-                                   GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) :
+    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, descriptors, numDescriptors) {
+                           BLE_GATT_CHAR_PROPERTIES_READ | BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) {
         /* empty */
     }
 };
@@ -488,10 +499,13 @@
 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,
-                                                      GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) :
+    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, descriptors, numDescriptors) {
+                           BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) {
         /* empty */
     }
 };
@@ -499,10 +513,13 @@
 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,
-                                                     GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) :
+    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, descriptors, numDescriptors) {
+                           BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) {
         /* empty */
     }
 };
@@ -510,10 +527,13 @@
 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,
-                                                      GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) :
+    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, descriptors, numDescriptors) {
+                           BLE_GATT_CHAR_PROPERTIES_READ | BLE_GATT_CHAR_PROPERTIES_WRITE | additionalProperties, descriptors, numDescriptors) {
         /* empty */
     }
 };