Use write with response when writing 0x2902 descriptors.

As per Bluetooth core specification we must write to 0x2902 descriptors with response request.
This change ensures the correct procedure is used.

Todo: Remove the "response" parameter from related functions.
This commit is contained in:
h2zero 2022-04-16 12:45:13 -06:00
parent 9e5db157f8
commit c285052f6d
2 changed files with 3 additions and 2 deletions

View file

@ -616,6 +616,7 @@ bool NimBLERemoteCharacteristic::setNotify(uint16_t val, notify_callback notifyC
NIMBLE_LOGD(LOG_TAG, "<< setNotify()"); NIMBLE_LOGD(LOG_TAG, "<< setNotify()");
response = true; // Always write with response as per Bluetooth core specification.
return desc->writeValue((uint8_t *)&val, 2, response); return desc->writeValue((uint8_t *)&val, 2, response);
} // setNotify } // setNotify

View file

@ -73,8 +73,8 @@ public:
bool subscribe(bool notifications = true, bool subscribe(bool notifications = true,
notify_callback notifyCallback = nullptr, notify_callback notifyCallback = nullptr,
bool response = false); bool response = true);
bool unsubscribe(bool response = false); bool unsubscribe(bool response = true);
bool registerForNotify(notify_callback notifyCallback, bool registerForNotify(notify_callback notifyCallback,
bool notifications = true, bool notifications = true,
bool response = true) bool response = true)