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"
29 uint16_t attr_max_len;
64 void setValue(
const uint8_t* data,
size_t size);
65 void setValue(
const std::string &value);
82 static int handleGapEvent(uint16_t conn_handle, uint16_t attr_handle,
83 struct ble_gatt_access_ctxt *ctxt,
void *arg);
84 void setHandle(uint16_t handle);
111 #include "NimBLE2904.h"
Descriptor for Characteristic Presentation Format.
Definition: NimBLE2904.h:40
The model of a BLE Characteristic.
Definition: NimBLECharacteristic.h:62
Callbacks that can be associated with a BLE descriptors to inform of events.
Definition: NimBLEDescriptor.h:104
virtual void onRead(NimBLEDescriptor *pDescriptor)
Callback function to support a read request.
Definition: NimBLEDescriptor.cpp:282
virtual void onWrite(NimBLEDescriptor *pDescriptor)
Callback function to support a write request.
Definition: NimBLEDescriptor.cpp:292
A model of a BLE descriptor.
Definition: NimBLEDescriptor.h:42
size_t getLength()
Get the length of the value of this descriptor.
Definition: NimBLEDescriptor.cpp:103
NimBLEDescriptor(const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
NimBLEDescriptor constructor.
Definition: NimBLEDescriptor.cpp:33
NimBLECharacteristic * getCharacteristic()
Get the characteristic this descriptor belongs to.
Definition: NimBLEDescriptor.cpp:138
uint16_t getHandle()
Get the BLE handle for this descriptor.
Definition: NimBLEDescriptor.cpp:94
std::string getStringValue()
Get the value of this descriptor as a string.
Definition: NimBLEDescriptor.cpp:129
void setValue(const T &s)
Convenience template to set the descriptor value to <type>val.
Definition: NimBLEDescriptor.h:73
void setValue(const uint8_t *data, size_t size)
Set the value of the descriptor.
Definition: NimBLEDescriptor.cpp:233
void setCallbacks(NimBLEDescriptorCallbacks *pCallbacks)
Set the callback handlers for this descriptor.
Definition: NimBLEDescriptor.cpp:206
NimBLEUUID getUUID()
Get the UUID of the descriptor.
Definition: NimBLEDescriptor.cpp:111
std::string toString()
Return a string representation of the descriptor.
Definition: NimBLEDescriptor.cpp:268
uint8_t * getValue()
Get the value of this descriptor.
Definition: NimBLEDescriptor.cpp:120
~NimBLEDescriptor()
NimBLEDescriptor destructor.
Definition: NimBLEDescriptor.cpp:86
The model of a BLE service.
Definition: NimBLEService.h:34
A model of a BLE UUID.
Definition: NimBLEUUID.h:37