@@ -46,6 +46,7 @@ using namespace ::chip;
46
46
using namespace ::chip::Inet;
47
47
using namespace ::chip::System;
48
48
using namespace ::chip::DeviceLayer::Internal;
49
+ using namespace ::chip::DeviceLayer::Silabs;
49
50
50
51
namespace chip {
51
52
namespace DeviceLayer {
@@ -65,7 +66,7 @@ CHIP_ERROR ConnectivityManagerImpl::_Init()
65
66
// TODO Initialize the Chip Addressing and Routing Module.
66
67
67
68
// Ensure that station mode is enabled.
68
- ConfigureStationMode ();
69
+ WifiInterface::GetInstance (). ConfigureStationMode ();
69
70
70
71
err = DeviceLayer::SystemLayer ().ScheduleWork (DriveStationState, NULL );
71
72
@@ -84,11 +85,11 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
84
85
85
86
switch (event->Platform .WFXSystemEvent .data .genericMsgEvent .header .id )
86
87
{
87
- case to_underlying (WifiEvent::kStartUp ):
88
+ case to_underlying (WifiInterface:: WifiEvent::kStartUp ):
88
89
ChipLogProgress (DeviceLayer, " WIFI_EVENT_STA_START" );
89
90
DriveStationState ();
90
91
break ;
91
- case to_underlying (WifiEvent::kConnect ):
92
+ case to_underlying (WifiInterface:: WifiEvent::kConnect ):
92
93
ChipLogProgress (DeviceLayer, " WIFI_EVENT_STA_CONNECTED" );
93
94
if (mWiFiStationState == kWiFiStationState_Connecting )
94
95
{
@@ -103,7 +104,7 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
103
104
}
104
105
DriveStationState ();
105
106
break ;
106
- case to_underlying (WifiEvent::kDisconnect ):
107
+ case to_underlying (WifiInterface:: WifiEvent::kDisconnect ):
107
108
ChipLogProgress (DeviceLayer, " WIFI_EVENT_STA_DISCONNECTED" );
108
109
if (mWiFiStationState == kWiFiStationState_Connecting )
109
110
{
@@ -112,9 +113,9 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
112
113
DriveStationState ();
113
114
break ;
114
115
115
- case to_underlying (WifiEvent::kGotIPv4 ):
116
- case to_underlying (WifiEvent::kLostIP ):
117
- case to_underlying (WifiEvent::kGotIPv6 ):
116
+ case to_underlying (WifiInterface:: WifiEvent::kGotIPv4 ):
117
+ case to_underlying (WifiInterface:: WifiEvent::kLostIP ):
118
+ case to_underlying (WifiInterface:: WifiEvent::kGotIPv6 ):
118
119
ChipLogProgress (DeviceLayer, " IP Change Event" );
119
120
UpdateInternetConnectivityState ();
120
121
break ;
@@ -128,7 +129,7 @@ ConnectivityManager::WiFiStationMode ConnectivityManagerImpl::_GetWiFiStationMod
128
129
{
129
130
if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled )
130
131
{
131
- if (IsStationModeEnabled ())
132
+ if (WifiInterface::GetInstance (). IsStationModeEnabled ())
132
133
{
133
134
mWiFiStationMode = kWiFiStationMode_Enabled ;
134
135
}
@@ -143,12 +144,12 @@ ConnectivityManager::WiFiStationMode ConnectivityManagerImpl::_GetWiFiStationMod
143
144
144
145
bool ConnectivityManagerImpl::_IsWiFiStationProvisioned (void )
145
146
{
146
- return IsWifiProvisioned ();
147
+ return WifiInterface::GetInstance (). IsWifiProvisioned ();
147
148
}
148
149
149
150
bool ConnectivityManagerImpl::_IsWiFiStationEnabled (void )
150
151
{
151
- return IsStationModeEnabled ();
152
+ return WifiInterface::GetInstance (). IsStationModeEnabled ();
152
153
}
153
154
154
155
CHIP_ERROR ConnectivityManagerImpl::_SetWiFiStationMode (ConnectivityManager::WiFiStationMode val)
@@ -176,7 +177,7 @@ void ConnectivityManagerImpl::_ClearWiFiStationProvision(void)
176
177
{
177
178
if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled )
178
179
{
179
- ClearWifiCredentials ();
180
+ WifiInterface::GetInstance (). ClearWifiCredentials ();
180
181
181
182
DeviceLayer::SystemLayer ().ScheduleWork (DriveStationState, NULL );
182
183
}
@@ -222,14 +223,14 @@ void ConnectivityManagerImpl::DriveStationState()
222
223
if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled )
223
224
{
224
225
// Ensure that the Wifi task is started.
225
- CHIP_ERROR error = StartWifiTask ();
226
+ CHIP_ERROR error = WifiInterface::GetInstance (). StartWifiTask ();
226
227
VerifyOrReturn (error == CHIP_NO_ERROR, ChipLogError (DeviceLayer, " StartWifiTask() failed: %s" , ErrorStr (error)));
227
228
228
229
// Ensure that station mode is enabled in the WiFi layer.
229
- ConfigureStationMode ();
230
+ WifiInterface::GetInstance (). ConfigureStationMode ();
230
231
}
231
232
232
- stationConnected = IsStationConnected ();
233
+ stationConnected = WifiInterface::GetInstance (). IsStationConnected ();
233
234
234
235
// If the station interface is currently connected ...
235
236
if (stationConnected)
@@ -255,7 +256,7 @@ void ConnectivityManagerImpl::DriveStationState()
255
256
{
256
257
ChipLogProgress (DeviceLayer, " Disconnecting WiFi station interface" );
257
258
258
- CHIP_ERROR error = TriggerDisconnection ();
259
+ CHIP_ERROR error = WifiInterface::GetInstance (). TriggerDisconnection ();
259
260
SuccessOrExitAction (error, ChipLogError (DeviceLayer, " TriggerDisconnection() failed: %s" , ErrorStr (error)));
260
261
261
262
ChangeWiFiStationState (kWiFiStationState_Disconnecting );
@@ -299,7 +300,8 @@ void ConnectivityManagerImpl::DriveStationState()
299
300
if (mWiFiStationState != kWiFiStationState_Connecting )
300
301
{
301
302
ChipLogProgress (DeviceLayer, " Attempting to connect WiFi" );
302
- SuccessOrExitAction (ConnectToAccessPoint (), ChipLogError (DeviceLayer, " ConnectToAccessPoint() failed" ));
303
+ SuccessOrExitAction (WifiInterface::GetInstance ().ConnectToAccessPoint (),
304
+ ChipLogError (DeviceLayer, " ConnectToAccessPoint() failed" ));
303
305
304
306
ChangeWiFiStationState (kWiFiStationState_Connecting );
305
307
}
@@ -376,9 +378,9 @@ void ConnectivityManagerImpl::UpdateInternetConnectivityState(void)
376
378
if (mWiFiStationState == kWiFiStationState_Connected )
377
379
{
378
380
#if CHIP_DEVICE_CONFIG_ENABLE_IPV4
379
- haveIPv4Conn = HasAnIPv4Address ();
381
+ haveIPv4Conn = WifiInterface::GetIstance (). HasAnIPv4Address ();
380
382
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
381
- haveIPv6Conn = HasAnIPv6Address ();
383
+ haveIPv6Conn = WifiInterface::GetInstance (). HasAnIPv6Address ();
382
384
}
383
385
384
386
// If the internet connectivity state has changed...
0 commit comments