Remove assert for 0x2902, make a dummy descriptor instead.

Rather than asserting for a harmless situation, this will just create a dummy descriptor
object, marked as removed, and print a warning.
This commit is contained in:
h2zero
2024-07-03 14:03:12 -06:00
committed by h2zero
parent fae53b8d7f
commit b8d6e3d87f
2 changed files with 9 additions and 4 deletions

View File

@@ -55,7 +55,14 @@ NimBLEDescriptor::NimBLEDescriptor(NimBLEUUID uuid, uint16_t properties, uint16_
m_pCharacteristic = pCharacteristic;
m_pCallbacks = &defaultCallbacks; // No initial callback.
m_properties = 0;
m_removed = 0;
// Check if this is the client configuration descriptor and set to removed if true.
if (uuid == NimBLEUUID((uint16_t)0x2902)) {
NIMBLE_LOGW(LOG_TAG, "Manually created 2902 descriptor has no functionality; please remove.");
m_removed = 1;
} else {
m_removed = 0;
}
if (properties & BLE_GATT_CHR_F_READ) { // convert uint16_t properties to uint8_t
m_properties |= BLE_ATT_F_READ;