NimBLE-Arduino 1.4.2
Loading...
Searching...
No Matches
NimBLERemoteDescriptor Class Reference

A model of remote BLE descriptor. More...

#include <NimBLERemoteDescriptor.h>

Public Member Functions

uint16_t getHandle ()
 Retrieve the handle associated with this remote descriptor. More...
 
NimBLERemoteCharacteristicgetRemoteCharacteristic ()
 Get the characteristic that owns this descriptor. More...
 
NimBLEUUID getUUID ()
 Retrieve the UUID associated this remote descriptor. More...
 
NimBLEAttValue readValue ()
 Read the value of the remote descriptor. 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 a new value to a remote descriptor. More...
 
bool writeValue (const std::vector< uint8_t > &v, bool response=false)
 Write a new value to a remote descriptor from a std::vector<uint8_t>. More...
 
bool writeValue (const char *s, bool response=false)
 Write a new value to the remote descriptor from a const char*. More...
 
template<typename T >
bool writeValue (const T &s, bool response=false)
 Template to set the remote descriptor value to <type>val. More...
 
template<typename T >
bool writeValue (const T &s, bool response=false)
 Template to set the remote descriptor value to <type>val. More...
 
template<typename T >
readValue (bool skipSizeCheck=false)
 Template to convert the remote descriptor data to <type>. 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]

NimBLEAttValue 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

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/5]

bool NimBLERemoteDescriptor::writeValue ( const char *  char_s,
bool  response = false 
)

Write a new value to the remote descriptor from a const char*.

Parameters
[in]char_sA character string to write to the remote descriptor.
[in]responseWhether we require a response from the write.
Returns
false if not connected or otherwise cannot perform write.

◆ writeValue() [2/5]

bool NimBLERemoteDescriptor::writeValue ( const std::vector< uint8_t > &  vec,
bool  response = false 
)

Write a new value to a remote descriptor from a std::vector<uint8_t>.

Parameters
[in]vecA std::vector<uint8_t> value to write to the remote descriptor.
[in]responseWhether we require a response from the write.
Returns
false if not connected or otherwise cannot perform write.

◆ writeValue() [3/5]

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

Template to set the remote descriptor value to <type>val.

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

Only used for non-arrays and types without a c_str() method.

◆ writeValue() [4/5]

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

Template to set the remote descriptor value to <type>val.

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

Only used if the <type> has a c_str() method.

◆ writeValue() [5/5]

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

Write a new value to a 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
false if not connected or otherwise cannot perform write.