15#ifndef MAIN_NIMBLEDESCRIPTOR_H_
16#define MAIN_NIMBLEDESCRIPTOR_H_
19#if defined(CONFIG_BT_ENABLED) && defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
21#include "NimBLECharacteristic.h"
22#include "NimBLEUUID.h"
23#include "NimBLEAttValue.h"
57 void setValue(
const uint8_t* data,
size_t size);
58 void setValue(
const std::vector<uint8_t>& vec);
78 T
getValue(time_t *timestamp =
nullptr,
bool skipSizeCheck =
false) {
79 return m_value.
getValue<T>(timestamp, skipSizeCheck);
87 static int handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
88 struct ble_gatt_access_ctxt *ctxt,
void *arg);
89 void setHandle(uint16_t handle);
116#include "NimBLE2904.h"
Descriptor for Characteristic Presentation Format.
Definition: NimBLE2904.h:37
A specialized container class to hold BLE attribute values.
Definition: NimBLEAttValue.h:61
bool setValue(const uint8_t *value, uint16_t len)
Set the value from a buffer.
Definition: NimBLEAttValue.h:380
const uint8_t * getValue(time_t *timestamp)
Get a pointer to the value buffer with timestamp.
Definition: NimBLEAttValue.h:369
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:63
Callbacks that can be associated with a BLE descriptors to inform of events.
Definition: NimBLEDescriptor.h:109
virtual void onRead(NimBLEDescriptor *pDescriptor)
Callback function to support a read request.
Definition: NimBLEDescriptor.cpp:289
virtual void onWrite(NimBLEDescriptor *pDescriptor)
Callback function to support a write request.
Definition: NimBLEDescriptor.cpp:299
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:35
size_t getLength()
Get the length of the value of this descriptor.
Definition: NimBLEDescriptor.cpp:107
NimBLECharacteristic * getCharacteristic()
Get the characteristic this descriptor belongs to.
Definition: NimBLEDescriptor.cpp:146
uint16_t getHandle()
Get the BLE handle for this descriptor.
Definition: NimBLEDescriptor.cpp:98
T getValue(time_t *timestamp=nullptr, bool skipSizeCheck=false)
Template to convert the descriptor data to <type>.
Definition: NimBLEDescriptor.h:78
std::string getStringValue()
Get the value of this descriptor as a string.
Definition: NimBLEDescriptor.cpp:137
NimBLEAttValue getValue(time_t *timestamp=nullptr)
Get the value of this descriptor.
Definition: NimBLEDescriptor.cpp:124
void setValue(const T &s)
Template to set the characteristic value to <type>val.
Definition: NimBLEDescriptor.h:67
void setValue(const uint8_t *data, size_t size)
Set the value of the descriptor.
Definition: NimBLEDescriptor.cpp:248
void setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)
Set the callback handlers for this descriptor.
Definition: NimBLEDescriptor.cpp:221
NimBLEUUID getUUID()
Get the UUID of the descriptor.
Definition: NimBLEDescriptor.cpp:115
std::string toString()
Return a string representation of the descriptor.
Definition: NimBLEDescriptor.cpp:275
~NimBLEDescriptor()
NimBLEDescriptor destructor.
Definition: NimBLEDescriptor.cpp:91
The model of a BLE service.
Definition: NimBLEService.h:34
A model of a BLE UUID.
Definition: NimBLEUUID.h:37