Fix handling of registerForNotify in BLERemoteCharacteristic.cpp (#4063)

This commit is contained in:
buxtronix 2020-09-30 22:20:28 +10:00 committed by GitHub
parent 11d071b1c8
commit 342b9cf2d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -467,6 +467,7 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback,
uint8_t val[] = {0x01, 0x00};
if(!notifications) val[0] = 0x02;
BLERemoteDescriptor* desc = getDescriptor(BLEUUID((uint16_t)0x2902));
if (desc != nullptr)
desc->writeValue(val, 2);
} // End Register
else { // If we weren't passed a callback function, then this is an unregistration.
@ -482,6 +483,7 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback,
uint8_t val[] = {0x00, 0x00};
BLERemoteDescriptor* desc = getDescriptor((uint16_t)0x2902);
if (desc != nullptr)
desc->writeValue(val, 2);
} // End Unregister