15 #ifndef MAIN_NIMBLEDESCRIPTOR_H_
16 #define MAIN_NIMBLEDESCRIPTOR_H_
17 #include "sdkconfig.h"
18 #if defined(CONFIG_BT_ENABLED)
21 #if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
23 #include "NimBLECharacteristic.h"
24 #include "NimBLEUUID.h"
31 uint16_t attr_max_len;
66 void setValue(
const uint8_t* data,
size_t size);
67 void setValue(
const std::string &value);
84 static int handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
85 struct ble_gatt_access_ctxt *ctxt,
void *arg);
86 void setHandle(uint16_t handle);
95 portMUX_TYPE m_valMux;
114 #include "NimBLE2904.h"
Descriptor for Characteristic Presentation Format.
Definition: NimBLE2904.h:43
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:60
Callbacks that can be associated with a BLE descriptors to inform of events.
Definition: NimBLEDescriptor.h:107
virtual void onRead(NimBLEDescriptor *pDescriptor)
Callback function to support a read request.
Definition: NimBLEDescriptor.cpp:279
virtual void onWrite(NimBLEDescriptor *pDescriptor)
Callback function to support a write request.
Definition: NimBLEDescriptor.cpp:288
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:44
size_t getLength()
Get the length of the value of this descriptor.
Definition: NimBLEDescriptor.cpp:106
NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
NimBLEDescriptor constructor.
Definition: NimBLEDescriptor.cpp:35
NimBLECharacteristic * getCharacteristic()
Get the characteristic this descriptor belongs to.
Definition: NimBLEDescriptor.cpp:141
uint16_t getHandle()
Get the BLE handle for this descriptor.
Definition: NimBLEDescriptor.cpp:97
std::string getStringValue()
Get the value of this descriptor as a string.
Definition: NimBLEDescriptor.cpp:132
void setValue(const T &s)
Convenience template to set the descriptor value to <type>val.
Definition: NimBLEDescriptor.h:75
void setValue(const uint8_t *data, size_t size)
Set the value of the descriptor.
Definition: NimBLEDescriptor.cpp:232
void setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)
Set the callback handlers for this descriptor.
Definition: NimBLEDescriptor.cpp:205
NimBLEUUID getUUID()
Get the UUID of the descriptor.
Definition: NimBLEDescriptor.cpp:114
std::string toString()
Return a string representation of the descriptor.
Definition: NimBLEDescriptor.cpp:265
uint8_t * getValue()
Get the value of this descriptor.
Definition: NimBLEDescriptor.cpp:123
~NimBLEDescriptor()
NimBLEDescriptor destructor.
Definition: NimBLEDescriptor.cpp:89
The model of a BLE service.
Definition: NimBLEService.h:36
A model of a BLE UUID.
Definition: NimBLEUUID.h:31