Skip to content

Commit 8163d5a

Browse files
committed
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.
1 parent 761bac7 commit 8163d5a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/NimBLERemoteCharacteristic.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ bool NimBLERemoteCharacteristic::setNotify(uint16_t val, notify_callback notifyC
625625

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

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

src/NimBLERemoteCharacteristic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ class NimBLERemoteCharacteristic {
106106

107107
bool subscribe(bool notifications = true,
108108
notify_callback notifyCallback = nullptr,
109-
bool response = false);
110-
bool unsubscribe(bool response = false);
109+
bool response = true);
110+
bool unsubscribe(bool response = true);
111111
bool registerForNotify(notify_callback notifyCallback,
112112
bool notifications = true,
113113
bool response = true)

0 commit comments

Comments
 (0)