From 9fa9531e504eb37a8904307f8cb4fb88ab395cac Mon Sep 17 00:00:00 2001 From: Ketan Padegaonkar Date: Wed, 19 May 2021 22:21:05 -0600 Subject: [PATCH] Add method to get the callbacks from a characteristic. This is useul to be able to unit/integration test the behavior of a characteristic. --- src/NimBLECharacteristic.cpp | 7 +++++++ src/NimBLECharacteristic.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/NimBLECharacteristic.cpp b/src/NimBLECharacteristic.cpp index 23ca8ba..992e3e5 100644 --- a/src/NimBLECharacteristic.cpp +++ b/src/NimBLECharacteristic.cpp @@ -444,6 +444,13 @@ void NimBLECharacteristic::setCallbacks(NimBLECharacteristicCallbacks* pCallback } } // setCallbacks +/** + * @brief Get the callback handlers for this characteristic. + */ +NimBLECharacteristicCallbacks* NimBLECharacteristic::getCallbacks() { + return m_pCallbacks; +} //getCallbacks + /** * @brief Set the value of the characteristic. diff --git a/src/NimBLECharacteristic.h b/src/NimBLECharacteristic.h index 22670df..aee21b0 100644 --- a/src/NimBLECharacteristic.h +++ b/src/NimBLECharacteristic.h @@ -65,6 +65,8 @@ public: std::string toString(); void setCallbacks(NimBLECharacteristicCallbacks* pCallbacks); + NimBLECharacteristicCallbacks* + getCallbacks(); void indicate(); void notify(bool is_notification = true);