NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
NimBLERemoteCharacteristic Class Reference

A model of a remote BLE characteristic. More...

#include <NimBLERemoteCharacteristic.h>

Inherits NimBLERemoteValueAttribute.

Public Member Functions

std::string toString () const
 Convert a NimBLERemoteCharacteristic to a string representation;.
 
const NimBLERemoteServicegetRemoteService () const
 Get the remote service associated with this characteristic.
 
void deleteDescriptors () const
 Delete the descriptors in the descriptor vector.
 
size_t deleteDescriptor (const NimBLEUUID &uuid) const
 Delete descriptor by UUID.
 
bool canBroadcast () const
 Does the characteristic support value broadcasting?
 
bool canRead () const
 Does the characteristic support reading?
 
bool canWriteNoResponse () const
 Does the characteristic support writing without a response?
 
bool canWrite () const
 Does the characteristic support writing?
 
bool canNotify () const
 Does the characteristic support reading with encryption?
 
bool canIndicate () const
 Does the characteristic support indication?
 
bool canWriteSigned () const
 Does the characteristic support signed writing?
 
bool hasExtendedProps () const
 Does the characteristic support extended properties?
 
bool subscribe (bool notifications=true, const notify_callback notifyCallback=nullptr, bool response=true) const
 Subscribe for notifications or indications.
 
bool unsubscribe (bool response=true) const
 Unsubscribe for notifications or indications.
 
std::vector< NimBLERemoteDescriptor * >::iterator begin () const
 Get iterator to the beginning of the vector of remote descriptor pointers.
 
std::vector< NimBLERemoteDescriptor * >::iterator end () const
 Get iterator to the end of the vector of remote descriptor pointers.
 
NimBLERemoteDescriptorgetDescriptor (const NimBLEUUID &uuid) const
 Get the descriptor instance with the given UUID that belongs to this characteristic.
 
const std::vector< NimBLERemoteDescriptor * > & getDescriptors (bool refresh=false) const
 Get a pointer to the vector of found descriptors.
 

Detailed Description

A model of a remote BLE characteristic.

Member Function Documentation

◆ begin()

std::vector< NimBLERemoteDescriptor * >::iterator NimBLERemoteCharacteristic::begin ( ) const

Get iterator to the beginning of the vector of remote descriptor pointers.

Returns
An iterator to the beginning of the vector of remote descriptor pointers.

◆ canBroadcast()

bool NimBLERemoteCharacteristic::canBroadcast ( ) const

Does the characteristic support value broadcasting?

Returns
True if supported.

◆ canIndicate()

bool NimBLERemoteCharacteristic::canIndicate ( ) const

Does the characteristic support indication?

Returns
True if supported.

◆ canNotify()

bool NimBLERemoteCharacteristic::canNotify ( ) const

Does the characteristic support reading with encryption?

Returns
True if supported.

◆ canRead()

bool NimBLERemoteCharacteristic::canRead ( ) const

Does the characteristic support reading?

Returns
True if supported.

◆ canWrite()

bool NimBLERemoteCharacteristic::canWrite ( ) const

Does the characteristic support writing?

Returns
True if supported.

◆ canWriteNoResponse()

bool NimBLERemoteCharacteristic::canWriteNoResponse ( ) const

Does the characteristic support writing without a response?

Returns
True if supported.

◆ canWriteSigned()

bool NimBLERemoteCharacteristic::canWriteSigned ( ) const

Does the characteristic support signed writing?

Returns
True if supported.

◆ deleteDescriptor()

size_t NimBLERemoteCharacteristic::deleteDescriptor ( const NimBLEUUID uuid) const

Delete descriptor by UUID.

Parameters
[in]uuidThe UUID of the descriptor to be deleted.
Returns
Number of descriptors left in the vector.

◆ deleteDescriptors()

void NimBLERemoteCharacteristic::deleteDescriptors ( ) const

Delete the descriptors in the descriptor vector.

We maintain a vector called m_vDescriptors that contains pointers to NimBLERemoteDescriptors object references. Since we allocated these in this class, we are also responsible for deleting them. This method does just that.

◆ end()

std::vector< NimBLERemoteDescriptor * >::iterator NimBLERemoteCharacteristic::end ( ) const

Get iterator to the end of the vector of remote descriptor pointers.

Returns
An iterator to the end of the vector of remote descriptor pointers.

◆ getDescriptor()

NimBLERemoteDescriptor * NimBLERemoteCharacteristic::getDescriptor ( const NimBLEUUID uuid) const

Get the descriptor instance with the given UUID that belongs to this characteristic.

Parameters
[in]uuidThe UUID of the descriptor to find.
Returns
The Remote descriptor (if present) or nullptr if not present.

◆ getDescriptors()

const std::vector< NimBLERemoteDescriptor * > & NimBLERemoteCharacteristic::getDescriptors ( bool  refresh = false) const

Get a pointer to the vector of found descriptors.

Parameters
[in]refreshIf true the current descriptor vector will be cleared and
all descriptors for this characteristic retrieved from the peripheral.
If false the vector will be returned with the currently stored descriptors of this characteristic.
Returns
A pointer to the vector of descriptors for this characteristic.

◆ getRemoteService()

const NimBLERemoteService * NimBLERemoteCharacteristic::getRemoteService ( ) const

Get the remote service associated with this characteristic.

Returns
The remote service associated with this characteristic.

◆ hasExtendedProps()

bool NimBLERemoteCharacteristic::hasExtendedProps ( ) const

Does the characteristic support extended properties?

Returns
True if supported.

◆ subscribe()

bool NimBLERemoteCharacteristic::subscribe ( bool  notifications = true,
const notify_callback  notifyCallback = nullptr,
bool  response = true 
) const

Subscribe for notifications or indications.

Parameters
[in]notificationsIf true, subscribe for notifications, false subscribe for indications.
[in]notifyCallbackA callback to be invoked for a notification.
[in]responseIf true, require a write response from the descriptor write operation. If NULL is provided then no callback is performed.
Returns
false if writing to the descriptor failed.

◆ toString()

std::string NimBLERemoteCharacteristic::toString ( ) const

Convert a NimBLERemoteCharacteristic to a string representation;.

Returns
a String representation.

◆ unsubscribe()

bool NimBLERemoteCharacteristic::unsubscribe ( bool  response = true) const

Unsubscribe for notifications or indications.

Parameters
[in]responsebool if true, require a write response from the descriptor write operation.
Returns
false if writing to the descriptor failed.