esp-nimble-cpp / NimBLE-Arduino  1.3.1
NimBLEDescriptor Class Reference

A model of a BLE descriptor. More...

Inherited by NimBLE2904.

Public Member Functions

 NimBLEDescriptor (const char *uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
 NimBLEDescriptor constructor.
 
 NimBLEDescriptor (NimBLEUUID uuid, uint16_t properties, uint16_t max_len, NimBLECharacteristic *pCharacteristic=nullptr)
 NimBLEDescriptor constructor.
 
 ~NimBLEDescriptor ()
 NimBLEDescriptor destructor.
 
uint16_t getHandle ()
 Get the BLE handle for this descriptor. More...
 
NimBLEUUID getUUID ()
 Get the UUID of the descriptor.
 
std::string toString ()
 Return a string representation of the descriptor. More...
 
void setCallbacks (NimBLEDescriptorCallbacks *pCallbacks)
 Set the callback handlers for this descriptor. More...
 
size_t getLength ()
 Get the length of the value of this descriptor. More...
 
uint8_t * getValue ()
 Get the value of this descriptor. More...
 
std::string getStringValue ()
 Get the value of this descriptor as a string. More...
 
void setValue (const uint8_t *data, size_t size)
 Set the value of the descriptor. More...
 
void setValue (const std::string &value)
 Set the value of the descriptor. More...
 
NimBLECharacteristicgetCharacteristic ()
 Get the characteristic this descriptor belongs to. More...
 
template<typename T >
void setValue (const T &s)
 Convenience template to set the descriptor value to <type>val. More...
 

Detailed Description

A model of a BLE descriptor.

Member Function Documentation

◆ getCharacteristic()

NimBLECharacteristic * NimBLEDescriptor::getCharacteristic ( )

Get the characteristic this descriptor belongs to.

Returns
A pointer to the characteristic this descriptor belongs to.

◆ getHandle()

uint16_t NimBLEDescriptor::getHandle ( )

Get the BLE handle for this descriptor.

Returns
The handle for this descriptor.

◆ getLength()

size_t NimBLEDescriptor::getLength ( )

Get the length of the value of this descriptor.

Returns
The length (in bytes) of the value of this descriptor.

◆ getStringValue()

std::string NimBLEDescriptor::getStringValue ( )

Get the value of this descriptor as a string.

Returns
A std::string instance containing a copy of the descriptor's value.

◆ getValue()

uint8_t * NimBLEDescriptor::getValue ( )

Get the value of this descriptor.

Returns
A pointer to the value of this descriptor.

◆ setCallbacks()

void NimBLEDescriptor::setCallbacks ( NimBLEDescriptorCallbacks pCallbacks)

Set the callback handlers for this descriptor.

Parameters
[in]pCallbacksAn instance of a callback structure used to define any callbacks for the descriptor.

◆ setValue() [1/3]

void NimBLEDescriptor::setValue ( const std::string &  value)

Set the value of the descriptor.

Parameters
[in]valueThe value of the descriptor in string form.

◆ setValue() [2/3]

template<typename T >
void NimBLEDescriptor::setValue ( const T &  s)
inline

Convenience template to set the descriptor value to <type>val.

Parameters
[in]sThe value to set.

◆ setValue() [3/3]

void NimBLEDescriptor::setValue ( const uint8_t *  data,
size_t  length 
)

Set the value of the descriptor.

Parameters
[in]dataThe data to set for the descriptor.
[in]lengthThe length of the data in bytes.

◆ toString()

std::string NimBLEDescriptor::toString ( )

Return a string representation of the descriptor.

Returns
A string representation of the descriptor.