Unverified Commit 342b9cf2 authored by buxtronix's avatar buxtronix Committed by GitHub

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

parent 11d071b1
......@@ -467,7 +467,8 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback,
uint8_t val[] = {0x01, 0x00};
if(!notifications) val[0] = 0x02;
BLERemoteDescriptor* desc = getDescriptor(BLEUUID((uint16_t)0x2902));
desc->writeValue(val, 2);
if (desc != nullptr)
desc->writeValue(val, 2);
} // End Register
else { // If we weren't passed a callback function, then this is an unregistration.
esp_err_t errRc = ::esp_ble_gattc_unregister_for_notify(
......@@ -482,7 +483,8 @@ void BLERemoteCharacteristic::registerForNotify(notify_callback notifyCallback,
uint8_t val[] = {0x00, 0x00};
BLERemoteDescriptor* desc = getDescriptor((uint16_t)0x2902);
desc->writeValue(val, 2);
if (desc != nullptr)
desc->writeValue(val, 2);
} // End Unregister
m_semaphoreRegForNotifyEvt.wait("registerForNotify");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment