Skip to content

Commit 106ab63

Browse files
Added condition that DUT not to go deep sleep till it is provisioned
1 parent fe7ade5 commit 106ab63

File tree

5 files changed

+26
-13
lines changed

5 files changed

+26
-13
lines changed

examples/platform/silabs/wifi/icd/ApplicationSleepManager.cpp

+21-10
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ CHIP_ERROR ApplicationSleepManager::Init()
5353
void ApplicationSleepManager::OnCommissioningWindowOpened()
5454
{
5555
mIsCommissionningWindowOpen = true;
56-
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
56+
#if (defined(SLI_SI917) && SLI_SI917 == 1)
5757
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
58-
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
58+
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
5959
}
6060

6161
void ApplicationSleepManager::OnCommissioningWindowClosed()
6262
{
6363
mIsCommissionningWindowOpen = false;
64-
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
64+
#if (defined(SLI_SI917) && SLI_SI917 == 1)
6565
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
66-
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
66+
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
6767
}
6868

6969
void ApplicationSleepManager::OnSubscriptionEstablished(chip::app::ReadHandler & aReadHandler)
@@ -93,6 +93,17 @@ void ApplicationSleepManager::OnFabricCommitted(const chip::FabricTable & fabric
9393
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
9494
}
9595

96+
bool ApplicationSleepManager::CanGoToDeepSleep()
97+
{
98+
bool canGoToDeepSleep = true;
99+
if (mIsCommissionningWindowOpen)
100+
{
101+
ChipLogProgress(AppServer, "Commissioning Window is Open - Cannot go to Deep sleep");
102+
canGoToDeepSleep = false;
103+
}
104+
return canGoToDeepSleep;
105+
}
106+
96107
bool ApplicationSleepManager::CanGoToLIBasedSleep()
97108
{
98109
bool canGoToLIBasedSleep = true;
@@ -170,19 +181,19 @@ bool ApplicationSleepManager::ProcessKeychainEdgeCase()
170181
void ApplicationSleepManager::OnEnterActiveMode()
171182
{
172183
mIsInActiveMode = true;
173-
// TEMP-fix: Added SLI_SI91X_MCU_INTERFACE to delay 917 NCP sleep till wifi-connection
174-
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
184+
// TEMP-fix: Added SLI_SI917 to delay 9116 NCP sleep till wifi-connection
185+
#if (defined(SLI_SI917) && SLI_SI917 == 1)
175186
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
176-
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
187+
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
177188
}
178189

179190
void ApplicationSleepManager::OnEnterIdleMode()
180191
{
181192
mIsInActiveMode = false;
182-
// TEMP-fix: Added SLI_SI91X_MCU_INTERFACE to delay 917 NCP sleep till wifi-connection
183-
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
193+
// TEMP-fix: Added SLI_SI917 to delay 9116 NCP sleep till wifi-connection
194+
#if (defined(SLI_SI917) && SLI_SI917 == 1)
184195
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
185-
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
196+
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
186197
}
187198

188199
void ApplicationSleepManager::OnTransitionToIdle()

examples/platform/silabs/wifi/icd/ApplicationSleepManager.h

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class ApplicationSleepManager : public chip::app::ReadHandler::ApplicationCallba
114114
* false if the device cannot go to LI sleep
115115
*/
116116
bool CanGoToLIBasedSleep() override;
117+
bool CanGoToDeepSleep() override;
117118

118119
// FabricTable::Delegate implementation
119120

src/platform/silabs/wifi/WifiInterfaceAbstraction.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ typedef enum
118118

119119
typedef struct
120120
{
121-
char ssid[WFX_MAX_SSID_LENGTH + 1];
121+
char ssid[WFX_MAX_SSID_LENGTH + 1] = {0};
122122
size_t ssid_length;
123-
char passkey[WFX_MAX_PASSKEY_LENGTH + 1];
123+
char passkey[WFX_MAX_PASSKEY_LENGTH + 1] = {0};
124124
size_t passkey_length;
125125
wfx_sec_t security;
126126
} wfx_wifi_provision_t;

src/platform/silabs/wifi/icd/WifiSleepManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ CHIP_ERROR WifiSleepManager::VerifyAndTransitionToLowPowerMode(PowerEvent event)
169169
wfx_wifi_provision_t wifiConfig;
170170
wfx_get_wifi_provision(&wifiConfig);
171171

172-
if (!(wifiConfig.ssid[0] != 0))
172+
if (!(wifiConfig.ssid[0] != 0) && (mCallback && mCallback->CanGoToDeepSleep()))
173173
{
174174
return ConfigureDeepSleep();
175175
}

src/platform/silabs/wifi/icd/WifiSleepManager.h

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class WifiSleepManager
7070
* @return false The Wi-Fi Sleep Manager cannot go to LI based sleep or an error occured in the processing.
7171
*/
7272
virtual bool CanGoToLIBasedSleep() = 0;
73+
virtual bool CanGoToDeepSleep() = 0;
7374
};
7475

7576
/**

0 commit comments

Comments
 (0)