#include "sdkconfig.h"
#if defined(CONFIG_BT_ENABLED)
#include "BLE2902.h"
BLE2902::BLE2902() : BLEDescriptor(BLEUUID((uint16_t) 0x2902)) {
uint8_t data[2] = { 0, 0 };
setValue(data, 2);
}
bool BLE2902::getNotifications() {
return (getValue()[0] & (1 << 0)) != 0;
}
bool BLE2902::getIndications() {
return (getValue()[0] & (1 << 1)) != 0;
}
void BLE2902::setIndications(bool flag) {
uint8_t *pValue = getValue();
if (flag) pValue[0] |= 1 << 1;
else pValue[0] &= ~(1 << 1);
}
void BLE2902::setNotifications(bool flag) {
uint8_t *pValue = getValue();
if (flag) pValue[0] |= 1 << 0;
else pValue[0] &= ~(1 << 0);
}
#endif