SDK  23.9.2
For IoT System Software Development
Public Member Functions | List of all members
BLE2902 Class Reference

Descriptor for Client Characteristic Configuration. More...

#include <BLE2902.hpp>

Inheritance diagram for BLE2902:
BLEDescriptor

Public Member Functions

bool getNotifications ()
 Get the notifications value. More...
 
bool getIndications ()
 Get the indications value. More...
 
void setNotifications (bool flag)
 Set the notifications flag. More...
 
void setIndications (bool flag)
 Set the indications flag. More...
 
- Public Member Functions inherited from BLEDescriptor
 BLEDescriptor (const char *uuid, uint16_t max_len=100)
 BLEDescriptor constructor.
 
 BLEDescriptor (BLEUUID uuid, uint16_t max_len=100)
 BLEDescriptor constructor.
 
virtual ~BLEDescriptor ()
 BLEDescriptor destructor.
 
uint16_t getHandle ()
 Get the BLE handle for this descriptor. More...
 
size_t getLength ()
 Get the length of the value of this descriptor. More...
 
BLEUUID getUUID ()
 Get the UUID of the descriptor.
 
uint8_t * getValue ()
 Get the value of this descriptor. More...
 
void handleGATTServerEvent (void *info)
 
void setAccessPermissions (ble_gatt_perm_t perm)
 
void setCallbacks (BLEDescriptorCallbacks *pCallbacks)
 Set the callback handlers for this descriptor. More...
 
void setValue (uint8_t *data, size_t size)
 Set the value of the descriptor. More...
 
void setValue (std::string value)
 Set the value of the descriptor. More...
 
std::string toString ()
 Return a string representation of the descriptor. More...
 

Detailed Description

Descriptor for Client Characteristic Configuration.

This is a convenience descriptor for the Client Characteristic Configuration which has a UUID of 0x2902.

See also: https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.client_characteristic_configuration.xml

Member Function Documentation

◆ getIndications()

bool BLE2902::getIndications ( )

Get the indications value.

Returns
The indications value. True if indications are enabled and false if not.
52  {
53  return (getValue()[0] & (1 << 1)) != 0;
54 } // getIndications

◆ getNotifications()

bool BLE2902::getNotifications ( )

Get the notifications value.

Returns
The notifications value. True if notifications are enabled and false if not.
43  {
44  return (getValue()[0] & (1 << 0)) != 0;
45 } // getNotifications

◆ setIndications()

void BLE2902::setIndications ( bool  flag)

Set the indications flag.

Parameters
[in]flagThe indications flag.
61  {
62  uint8_t *pValue = getValue();
63  if (flag) pValue[0] |= 1 << 1;
64  else pValue[0] &= ~(1 << 1);
65 } // setIndications

◆ setNotifications()

void BLE2902::setNotifications ( bool  flag)

Set the notifications flag.

Parameters
[in]flagThe notifications flag.
72  {
73  uint8_t *pValue = getValue();
74  if (flag) pValue[0] |= 1 << 0;
75  else pValue[0] &= ~(1 << 0);
76 } // setNotifications

The documentation for this class was generated from the following files:
BLEDescriptor::getValue
uint8_t * getValue()
Get the value of this descriptor.
Definition: BLEDescriptor.cpp:97