Skip to content

Commit

Permalink
Use write with response when writing 0x2902 descriptors.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
h2zero committed Apr 16, 2022
1 parent fc746b1 commit 42201d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/NimBLERemoteCharacteristic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ bool NimBLERemoteCharacteristic::setNotify(uint16_t val, notify_callback notifyC

NIMBLE_LOGD(LOG_TAG, "<< setNotify()");

response = true; // Always write with response as per Bluetooth core specification.
return desc->writeValue((uint8_t *)&val, 2, response);
} // setNotify

Expand Down
4 changes: 2 additions & 2 deletions src/NimBLERemoteCharacteristic.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class NimBLERemoteCharacteristic {

bool subscribe(bool notifications = true,
notify_callback notifyCallback = nullptr,
bool response = false);
bool unsubscribe(bool response = false);
bool response = true);
bool unsubscribe(bool response = true);
bool registerForNotify(notify_callback notifyCallback,
bool notifications = true,
bool response = true)
Expand Down

0 comments on commit 42201d4

Please sign in to comment.