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

A model of remote BLE descriptor. More...

Public Member Functions

uint16_t getHandle ()
 Retrieve the handle associated with this remote descriptor. More...
 
NimBLERemoteCharacteristic * getRemoteCharacteristic ()
 Get the characteristic that owns this descriptor. More...
 
NimBLEUUID getUUID ()
 Retrieve the UUID associated this remote descriptor. More...
 
std::string readValue ()
 Read the value of the remote descriptor. More...
 
template<typename T >
T readValue (bool skipSizeCheck=false)
 A template to convert the remote descriptor data to <type>. More...
 
uint8_t readUInt8 () __attribute__((deprecated("Use template readValue<uint8_t>()")))
 Read a byte value. More...
 
uint16_t readUInt16 () __attribute__((deprecated("Use template readValue<uint16_t>()")))
 Read an unsigned 16 bit value. More...
 
uint32_t readUInt32 () __attribute__((deprecated("Use template readValue<uint32_t>()")))
 Read an unsigned 32 bit value. More...
 
std::string toString (void)
 Return a string representation of this Remote Descriptor. More...
 
bool writeValue (const uint8_t *data, size_t length, bool response=false)
 Write data to the BLE Remote Descriptor. More...
 
bool writeValue (const std::string &newValue, bool response=false)
 Write data represented as a string to the BLE Remote Descriptor. More...
 
template<typename T >
bool writeValue (const T &s, bool response=false)
 Convenience template to set the remote descriptor value to <type>val. More...
 

Detailed Description

A model of remote BLE descriptor.

Member Function Documentation

◆ getHandle()

uint16_t NimBLERemoteDescriptor::getHandle ( )

Retrieve the handle associated with this remote descriptor.

Returns
The handle associated with this remote descriptor.

◆ getRemoteCharacteristic()

NimBLERemoteCharacteristic * NimBLERemoteDescriptor::getRemoteCharacteristic ( )

Get the characteristic that owns this descriptor.

Returns
The characteristic that owns this descriptor.

◆ getUUID()

NimBLEUUID NimBLERemoteDescriptor::getUUID ( )

Retrieve the UUID associated this remote descriptor.

Returns
The UUID associated this remote descriptor.

◆ readUInt16()

uint16_t NimBLERemoteDescriptor::readUInt16 ( )

Read an unsigned 16 bit value.

Returns
The unsigned 16 bit value.
Deprecated:
Use readValue<uint16_t>().

◆ readUInt32()

uint32_t NimBLERemoteDescriptor::readUInt32 ( )

Read an unsigned 32 bit value.

Returns
the unsigned 32 bit value.
Deprecated:
Use readValue<uint32_t>().

◆ readUInt8()

uint8_t NimBLERemoteDescriptor::readUInt8 ( )

Read a byte value.

Returns
The value as a byte
Deprecated:
Use readValue<uint8_t>().

◆ readValue() [1/2]

std::string NimBLERemoteDescriptor::readValue ( )

Read the value of the remote descriptor.

Returns
The value of the remote descriptor.

◆ readValue() [2/2]

template<typename T >
T NimBLERemoteDescriptor::readValue ( bool  skipSizeCheck = false)
inline

A template to convert the remote descriptor data to <type>.

Template Parameters
TThe type to convert the data to.
Parameters
[in]skipSizeCheckIf true it will skip checking if the data size is less than sizeof(<type>).
Returns
The data converted to <type> or NULL if skipSizeCheck is false and the data is less than sizeof(<type>).

Use: readValue<type>(skipSizeCheck);

◆ toString()

std::string NimBLERemoteDescriptor::toString ( void  )

Return a string representation of this Remote Descriptor.

Returns
A string representation of this Remote Descriptor.

◆ writeValue() [1/3]

bool NimBLERemoteDescriptor::writeValue ( const std::string &  newValue,
bool  response = false 
)

Write data represented as a string to the BLE Remote Descriptor.

Parameters
[in]newValueThe data to send to the remote descriptor.
[in]responseTrue if we expect a response.
Returns
True if successful

◆ writeValue() [2/3]

template<typename T >
bool NimBLERemoteDescriptor::writeValue ( const T &  s,
bool  response = false 
)
inline

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

Parameters
[in]sThe value to write.
[in]responseTrue == request write response.

◆ writeValue() [3/3]

bool NimBLERemoteDescriptor::writeValue ( const uint8_t *  data,
size_t  length,
bool  response = false 
)

Write data to the BLE Remote Descriptor.

Parameters
[in]dataThe data to send to the remote descriptor.
[in]lengthThe length of the data to send.
[in]responseTrue if we expect a write response.
Returns
True if successful