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
71
71
*
72
72
* @param[in] event_handler Pointer to event handler to remove
73
73
*/
74
- void removeEventHandler (T* target ) {
74
+ void removeEventHandler (T* event_handler ) {
75
75
node_t * to_remove = head;
76
- if (head->eh == target ) {
76
+ if (head->eh == event_handler ) {
77
77
head = head->next ;
78
78
} else {
79
79
auto * it = head;
80
80
while (it->next ) {
81
- if (it->next ->eh == target ) {
81
+ if (it->next ->eh == event_handler ) {
82
82
to_remove = it->next ;
83
83
break ;
84
84
}
@@ -94,6 +94,22 @@ class ChainableEventHandler
94
94
delete to_remove;
95
95
}
96
96
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
+
97
113
protected:
98
114
99
115
template <typename ... FnArgs, typename ... Args>
You can’t perform that action at this time.
0 commit comments