22
22
23
23
#pragma once
24
24
25
- #include <platform/CHIPDeviceLayer .h>
25
+ #include <platform/PlatformManager .h>
26
26
27
- #include <algorithm>
28
- #include <list>
29
27
#include <queue>
30
28
31
29
namespace chip {
@@ -46,34 +44,11 @@ class PlatformManagerImpl final : public PlatformManager
46
44
private:
47
45
// ===== Methods that implement the PlatformManager abstract interface.
48
46
49
- struct EventHandler
50
- {
51
- PlatformManager::EventHandlerFunct Handler;
52
- intptr_t Arg;
53
-
54
- bool operator==(const EventHandler & other) const { return Handler == other.Handler && Arg == other.Arg; }
55
- };
56
-
57
47
CHIP_ERROR _InitChipStack() { return CHIP_NO_ERROR; }
58
48
void _Shutdown() {}
59
49
60
- CHIP_ERROR _AddEventHandler(EventHandlerFunct handler, intptr_t arg = 0)
61
- {
62
- EventHandler eventHandler = { .Handler = handler, .Arg = arg };
63
- if (std::find(mEventHandlers.begin(), mEventHandlers.end(), eventHandler) == mEventHandlers.end())
64
- {
65
- mEventHandlers.push_back(eventHandler);
66
- }
67
-
68
- return CHIP_NO_ERROR;
69
- }
70
-
71
- void _RemoveEventHandler(EventHandlerFunct handler, intptr_t arg = 0)
72
- {
73
- EventHandler eventHandler = { .Handler = handler, .Arg = arg };
74
- mEventHandlers.remove(eventHandler);
75
- }
76
-
50
+ CHIP_ERROR _AddEventHandler(EventHandlerFunct handler, intptr_t arg = 0) { return CHIP_ERROR_NOT_IMPLEMENTED; }
51
+ void _RemoveEventHandler(EventHandlerFunct handler, intptr_t arg = 0) {}
77
52
void _HandleServerStarted() {}
78
53
void _HandleServerShuttingDown() {}
79
54
@@ -133,26 +108,8 @@ class PlatformManagerImpl final : public PlatformManager
133
108
event->CallWorkFunct.WorkFunct(event->CallWorkFunct.Arg);
134
109
break;
135
110
136
- default: {
137
- #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
138
- BLEMgr().OnPlatformEvent(event);
139
- #endif
140
- #if CHIP_DEVICE_CONFIG_ENABLE_THREAD
141
- ThreadStackMgr().OnPlatformEvent(event);
142
- #endif
143
- ConnectivityMgr().OnPlatformEvent(event);
144
-
145
- if (!event->IsInternal())
146
- {
147
- // iterate over local copy in case handler unregisters itself
148
- auto handlers = mEventHandlers;
149
- for (auto & handler : handlers)
150
- {
151
- handler.Handler(event, handler.Arg);
152
- }
153
- }
154
- }
155
- break;
111
+ default:
112
+ break;
156
113
}
157
114
}
158
115
@@ -178,7 +135,6 @@ class PlatformManagerImpl final : public PlatformManager
178
135
179
136
bool mShouldRunEventLoop = true;
180
137
std::queue<ChipDeviceEvent> mQueue;
181
- std::list<EventHandler> mEventHandlers;
182
138
};
183
139
184
140
/**
0 commit comments