Skip to content

Commit

Permalink
[SED] Fix Commissioning with Long Idle time (#23936)
Browse files Browse the repository at this point in the history
* Update Active Mode during commissioning

* Apply comments
  • Loading branch information
jepenven-silabs authored and pull[bot] committed Oct 12, 2023
1 parent c4eb51a commit 1141399
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ void CommissioningWindowManager::ResetState()
mECMIterations = 0;
mECMSaltLength = 0;

#if CHIP_DEVICE_CONFIG_ENABLE_SED
if (mSEDActiveModeEnabled)
{
DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(false);
mSEDActiveModeEnabled = false;
}
#endif

UpdateWindowStatus(CommissioningWindowStatus::kWindowNotOpen);

UpdateOpenerFabricIndex(NullNullable);
Expand Down Expand Up @@ -223,8 +231,9 @@ CHIP_ERROR CommissioningWindowManager::AdvertiseAndListenForPASE()
mPairingSession.Clear();

#if CHIP_DEVICE_CONFIG_ENABLE_SED
if (!mIsBLE && !mListeningForPASE)
if (!mSEDActiveModeEnabled)
{
mSEDActiveModeEnabled = true;
DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(true);
}
#endif
Expand Down Expand Up @@ -455,13 +464,6 @@ CHIP_ERROR CommissioningWindowManager::StopAdvertisement(bool aShuttingDown)
{
RestoreDiscriminator();

#if CHIP_DEVICE_CONFIG_ENABLE_SED
if (!mIsBLE && mListeningForPASE)
{
DeviceLayer::ConnectivityMgr().RequestSEDActiveMode(false);
}
#endif

mServer->GetExchangeManager().UnregisterUnsolicitedMessageHandlerForType(Protocols::SecureChannel::MsgType::PBKDFParamRequest);
mListeningForPASE = false;
mPairingSession.Clear();
Expand Down
4 changes: 4 additions & 0 deletions src/app/server/CommissioningWindowManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class CommissioningWindowManager : public SessionEstablishmentDelegate,
uint32_t mECMSaltLength = 0;
uint8_t mECMSalt[kSpake2p_Max_PBKDF_Salt_Length];

#if CHIP_DEVICE_CONFIG_ENABLE_SED
bool mSEDActiveModeEnabled = false;
#endif

// For tests only, so that we can test the commissioning window timeout
// without having to wait 3 minutes.
Optional<System::Clock::Seconds16> mMinCommissioningTimeoutOverride;
Expand Down

0 comments on commit 1141399

Please sign in to comment.