|
24 | 24 | #include <app/CommandHandler.h>
|
25 | 25 | #include <app/att-storage.h>
|
26 | 26 | #include <app/clusters/identify-server/identify-server.h>
|
27 |
| -#include <app/clusters/network-commissioning/network-commissioning.h> |
28 | 27 | #include <app/server/Server.h>
|
29 | 28 | #include <app/util/af.h>
|
30 | 29 | #include <lib/support/CHIPMem.h>
|
|
36 | 35 | #include <transport/SessionManager.h>
|
37 | 36 | #include <transport/raw/PeerAddress.h>
|
38 | 37 |
|
39 |
| -#if CHIP_DEVICE_LAYER_TARGET_DARWIN |
40 |
| -#include <platform/Darwin/NetworkCommissioningDriver.h> |
41 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI |
42 |
| -#include <platform/Darwin/WiFi/NetworkCommissioningWiFiDriver.h> |
43 |
| -#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI |
44 |
| -#endif // CHIP_DEVICE_LAYER_TARGET_DARWIN |
45 |
| - |
46 |
| -#if CHIP_DEVICE_LAYER_TARGET_LINUX |
47 |
| -#include <platform/Linux/NetworkCommissioningDriver.h> |
48 |
| -#endif // CHIP_DEVICE_LAYER_TARGET_LINUX |
49 |
| - |
50 | 38 | #include <Options.h>
|
51 | 39 |
|
52 | 40 | using namespace chip;
|
@@ -105,42 +93,7 @@ static Identify gIdentify1 = {
|
105 | 93 | OnTriggerEffect,
|
106 | 94 | };
|
107 | 95 |
|
108 |
| -// Network commissioning |
109 | 96 | namespace {
|
110 |
| -// This file is being used by platforms other than Linux, so we need this check to disable related features since we only |
111 |
| -// implemented them on linux. |
112 |
| -constexpr EndpointId kNetworkCommissioningEndpointMain = 0; |
113 |
| -constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE; |
114 |
| - |
115 |
| -#if CHIP_DEVICE_LAYER_TARGET_LINUX |
116 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD |
117 |
| -NetworkCommissioning::LinuxThreadDriver sThreadDriver; |
118 |
| -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD |
119 |
| - |
120 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI |
121 |
| -NetworkCommissioning::LinuxWiFiDriver sWiFiDriver; |
122 |
| -#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI |
123 |
| - |
124 |
| -NetworkCommissioning::LinuxEthernetDriver sEthernetDriver; |
125 |
| -#endif // CHIP_DEVICE_LAYER_TARGET_LINUX |
126 |
| - |
127 |
| -#if CHIP_DEVICE_LAYER_TARGET_DARWIN |
128 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI |
129 |
| -NetworkCommissioning::DarwinWiFiDriver sWiFiDriver; |
130 |
| -#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI |
131 |
| - |
132 |
| -NetworkCommissioning::DarwinEthernetDriver sEthernetDriver; |
133 |
| -#endif // CHIP_DEVICE_LAYER_TARGET_DARWIN |
134 |
| - |
135 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD |
136 |
| -Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sThreadDriver); |
137 |
| -#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD |
138 |
| - |
139 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI |
140 |
| -Clusters::NetworkCommissioning::Instance sWiFiNetworkCommissioningInstance(kNetworkCommissioningEndpointSecondary, &sWiFiDriver); |
141 |
| -#endif |
142 |
| - |
143 |
| -Clusters::NetworkCommissioning::Instance sEthernetNetworkCommissioningInstance(kNetworkCommissioningEndpointMain, &sEthernetDriver); |
144 | 97 |
|
145 | 98 | class ExampleDeviceInstanceInfoProvider : public DeviceInstanceInfoProvider
|
146 | 99 | {
|
@@ -200,58 +153,6 @@ ExampleDeviceInstanceInfoProvider gExampleDeviceInstanceInfoProvider;
|
200 | 153 |
|
201 | 154 | void ApplicationInit()
|
202 | 155 | {
|
203 |
| - (void) kNetworkCommissioningEndpointMain; |
204 |
| - // Enable secondary endpoint only when we need it, this should be applied to all platforms. |
205 |
| - emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); |
206 |
| - |
207 |
| - const bool kThreadEnabled = { |
208 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD |
209 |
| - LinuxDeviceOptions::GetInstance().mThread |
210 |
| -#else |
211 |
| - false |
212 |
| -#endif |
213 |
| - }; |
214 |
| - |
215 |
| - const bool kWiFiEnabled = { |
216 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI |
217 |
| - LinuxDeviceOptions::GetInstance().mWiFi |
218 |
| -#else |
219 |
| - false |
220 |
| -#endif |
221 |
| - }; |
222 |
| - |
223 |
| - if (kThreadEnabled && kWiFiEnabled) |
224 |
| - { |
225 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD |
226 |
| - sThreadNetworkCommissioningInstance.Init(); |
227 |
| -#endif |
228 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI |
229 |
| - sWiFiNetworkCommissioningInstance.Init(); |
230 |
| -#endif |
231 |
| - // Only enable secondary endpoint for network commissioning cluster when both WiFi and Thread are enabled. |
232 |
| - emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, true); |
233 |
| - } |
234 |
| - else if (kThreadEnabled) |
235 |
| - { |
236 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD |
237 |
| - sThreadNetworkCommissioningInstance.Init(); |
238 |
| -#endif |
239 |
| - } |
240 |
| - else if (kWiFiEnabled) |
241 |
| - { |
242 |
| -#if CHIP_DEVICE_CONFIG_ENABLE_WIFI |
243 |
| - // If we only enable WiFi on this device, "move" WiFi instance to main NetworkCommissioning cluster endpoint. |
244 |
| - sWiFiNetworkCommissioningInstance.~Instance(); |
245 |
| - new (&sWiFiNetworkCommissioningInstance) |
246 |
| - Clusters::NetworkCommissioning::Instance(kNetworkCommissioningEndpointMain, &sWiFiDriver); |
247 |
| - sWiFiNetworkCommissioningInstance.Init(); |
248 |
| -#endif |
249 |
| - } |
250 |
| - else |
251 |
| - { |
252 |
| - sEthernetNetworkCommissioningInstance.Init(); |
253 |
| - } |
254 |
| - |
255 | 156 | std::string path = kChipEventFifoPathPrefix + std::to_string(getpid());
|
256 | 157 |
|
257 | 158 | if (sChipNamedPipeCommands.Start(path, &sAllClustersCommandDelegate) != CHIP_NO_ERROR)
|
|
0 commit comments