extend
Fork of BLE_API by
Revision 1131:292690888896, committed 2016-03-22
- Comitter:
- 0cean
- Date:
- Tue Mar 22 09:54:54 2016 +0000
- Parent:
- 883:a097e1be76f4
- Commit message:
- ??????????????Notify???
Changed in this revision
ble/GattCharacteristic.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r a097e1be76f4 -r 292690888896 ble/GattCharacteristic.h --- a/ble/GattCharacteristic.h Tue Nov 03 13:21:03 2015 +0000 +++ b/ble/GattCharacteristic.h Tue Mar 22 09:54:54 2016 +0000 @@ -466,7 +466,7 @@ 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) { + BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -522,7 +522,7 @@ GattAttribute *descriptors[] = NULL, unsigned numDescriptors = 0) : GattCharacteristic(uuid, reinterpret_cast<uint8_t *>(valuePtr), sizeof(T) * NUM_ELEMENTS, sizeof(T) * NUM_ELEMENTS, - BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) { + BLE_GATT_CHAR_PROPERTIES_READ | additionalProperties, descriptors, numDescriptors) { /* empty */ } }; @@ -541,4 +541,33 @@ } }; +template <typename T, unsigned NUM_ELEMENTS> +class NotifyOnlyArrayGattCharacteristic : public GattCharacteristic { +public: + NotifyOnlyArrayGattCharacteristic<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, + BLE_GATT_CHAR_PROPERTIES_NOTIFY | additionalProperties, descriptors, numDescriptors) { + /* empty */ + } +}; + +template <typename T, unsigned NUM_ELEMENTS> +class ReadNotifyOnlyArrayGattCharacteristic : public GattCharacteristic { +public: + ReadNotifyOnlyArrayGattCharacteristic<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, + BLE_GATT_CHAR_PROPERTIES_READ | BLE_GATT_CHAR_PROPERTIES_NOTIFY | additionalProperties, descriptors, numDescriptors) { + /* empty */ + } +}; + + #endif // ifndef __GATT_CHARACTERISTIC_H__ \ No newline at end of file