File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
connectivity/FEATURE_BLE/include/ble/common Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -71,14 +71,14 @@ class ChainableEventHandler
7171 *
7272 * @param[in] event_handler Pointer to event handler to remove
7373 */
74- void removeEventHandler (T* target ) {
74+ void removeEventHandler (T* event_handler ) {
7575 node_t * to_remove = head;
76- if (head->eh == target ) {
76+ if (head->eh == event_handler ) {
7777 head = head->next ;
7878 } else {
7979 auto * it = head;
8080 while (it->next ) {
81- if (it->next ->eh == target ) {
81+ if (it->next ->eh == event_handler ) {
8282 to_remove = it->next ;
8383 break ;
8484 }
@@ -94,6 +94,22 @@ class ChainableEventHandler
9494 delete to_remove;
9595 }
9696
97+ /* *
98+ * Test if an event handler is present in the chain or not.
99+ *
100+ * @param[in] event_handler Pointer to event handler to check
101+ */
102+ bool isEventHandlerPresent (T* event_handler) {
103+ auto * it = head;
104+ while (it) {
105+ if (it == event_handler) {
106+ return true ;
107+ }
108+ it = it->next ;
109+ }
110+ return false ;
111+ }
112+
97113protected:
98114
99115 template <typename ... FnArgs, typename ... Args>
You can’t perform that action at this time.
0 commit comments