abc
Fork of BLE_API by
Diff: public/GattCharacteristic.h
- Revision:
- 408:c8e057dcbb26
- Parent:
- 325:501ad8b8bbe5
diff -r 8c645f5694b2 -r c8e057dcbb26 public/GattCharacteristic.h --- a/public/GattCharacteristic.h Fri Mar 27 13:03:37 2015 +0000 +++ b/public/GattCharacteristic.h Mon Jun 08 12:56:47 2015 +0000 @@ -436,12 +436,23 @@ GattCharacteristic& operator=(const GattCharacteristic &); }; + +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) : + GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS, + GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties) { + /* empty */ + } +}; + 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) { - /* empty */ + //empty } }; @@ -474,15 +485,6 @@ } }; -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) : - GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS, - GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties) { - /* empty */ - } -}; template <typename T, unsigned NUM_ELEMENTS> class ReadWriteArrayGattCharacteristic : public GattCharacteristic {