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.
ReadNotifyGattCharacteristic.h
- Committer:
- loicguibert
- Date:
- 2019-04-02
- Revision:
- 14:c5578b5edabe
File content as of revision 14:c5578b5edabe:
#pragma once
#include "ble/BLE.h"
/**
* Read, Write, Notify, Indicate Characteristic declaration helper.
*
* @tparam T type of data held by the characteristic.
*/
template<typename T>
class ReadNotifyGattCharacteristic : public GattCharacteristic {
public:
/**
* Construct a characteristic that can be read or written and emit
* notification or indication.
*
* @param[in] uuid The UUID of the characteristic.
* @param[in] initial_value Initial value contained by the characteristic.
*/
ReadNotifyGattCharacteristic(const UUID & uuid, T* initial_value)
: GattCharacteristic(
/* UUID */ uuid,
/* Initial value */ reinterpret_cast<uint8_t*>(initial_value),
/* Value size */ sizeof(T),
/* Value capacity */ sizeof(T),
/* Properties */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY,
/* Descriptors */ NULL,
/* Num descriptors */ 0,
/* variable len */ false) {
}
};