yes Spada / Mbed OS programme
Committer:
spadaaa
Date:
Mon Jun 10 18:30:41 2019 +0000
Revision:
28:4c0d163ba01a
Parent:
14:c5578b5edabe
final test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
loicguibert 14:c5578b5edabe 1 #pragma once
loicguibert 14:c5578b5edabe 2
loicguibert 14:c5578b5edabe 3 #include "ble/BLE.h"
loicguibert 14:c5578b5edabe 4
loicguibert 14:c5578b5edabe 5 /**
loicguibert 14:c5578b5edabe 6 * Read, Write, Notify, Indicate Characteristic declaration helper.
loicguibert 14:c5578b5edabe 7 *
loicguibert 14:c5578b5edabe 8 * @tparam T type of data held by the characteristic.
loicguibert 14:c5578b5edabe 9 */
loicguibert 14:c5578b5edabe 10 template<typename T>
loicguibert 14:c5578b5edabe 11 class ReadNotifyGattCharacteristic : public GattCharacteristic {
loicguibert 14:c5578b5edabe 12 public:
loicguibert 14:c5578b5edabe 13 /**
loicguibert 14:c5578b5edabe 14 * Construct a characteristic that can be read or written and emit
loicguibert 14:c5578b5edabe 15 * notification or indication.
loicguibert 14:c5578b5edabe 16 *
loicguibert 14:c5578b5edabe 17 * @param[in] uuid The UUID of the characteristic.
loicguibert 14:c5578b5edabe 18 * @param[in] initial_value Initial value contained by the characteristic.
loicguibert 14:c5578b5edabe 19 */
loicguibert 14:c5578b5edabe 20 ReadNotifyGattCharacteristic(const UUID & uuid, T* initial_value)
loicguibert 14:c5578b5edabe 21 : GattCharacteristic(
loicguibert 14:c5578b5edabe 22 /* UUID */ uuid,
loicguibert 14:c5578b5edabe 23 /* Initial value */ reinterpret_cast<uint8_t*>(initial_value),
loicguibert 14:c5578b5edabe 24 /* Value size */ sizeof(T),
loicguibert 14:c5578b5edabe 25 /* Value capacity */ sizeof(T),
loicguibert 14:c5578b5edabe 26 /* Properties */ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ |
loicguibert 14:c5578b5edabe 27 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY,
loicguibert 14:c5578b5edabe 28 /* Descriptors */ NULL,
loicguibert 14:c5578b5edabe 29 /* Num descriptors */ 0,
loicguibert 14:c5578b5edabe 30 /* variable len */ false) {
loicguibert 14:c5578b5edabe 31
loicguibert 14:c5578b5edabe 32 }
loicguibert 14:c5578b5edabe 33 };
loicguibert 14:c5578b5edabe 34