Add register for notify without callback

* Add subscribe() and unsubscribe() methods to replace registerForNotify() in NimBLERemoteCharacteristic.

* registerForNotify() remains as a (depreciated) method.
This commit is contained in:
h2zero committed 2020-06-19 12:30:32 -06:00
1 parent 7983c0e50e
commit f624deacb5
2 files changed
+65 -25

No files matched your search

+7 -2
View File
@@ -78,9 +78,13 @@ public:
return *((T *)pData);
}
bool registerForNotify(notify_callback _callback,
bool subscribe(bool notifications = true,
bool response = true,
notify_callback notifyCallback = nullptr);
bool unsubscribe(bool response = true);
bool registerForNotify(notify_callback notifyCallback,
bool notifications = true,
bool response = true);
bool response = true) __attribute__ ((deprecated));
bool writeValue(const uint8_t* data,
size_t length,
bool response = false);
@@ -100,6 +104,7 @@ private:
friend class NimBLERemoteDescriptor;
// Private member functions
bool setNotify(uint16_t val, bool response = true, notify_callback notifyCallback = nullptr);
bool retrieveDescriptors(const NimBLEUUID *uuid_filter = nullptr);
static int onReadCB(uint16_t conn_handle, const struct ble_gatt_error *error,
struct ble_gatt_attr *attr, void *arg);