Skip to content

Commit ae3a1db

Browse files
committed
matter: Don't advertise when waiting for last fabric removed action
Close commissioning window on last fabric removal. It will be reopened depending on `CHIP_LAST_FABRIC_REMOVED_ACTION`. Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent 2ef57f3 commit ae3a1db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

samples/matter/common/src/app/fabric_table_delegate.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@ class AppFabricTableDelegate : public chip::FabricTable::Delegate {
4242
void OnFabricRemoved(const chip::FabricTable &fabricTable, chip::FabricIndex fabricIndex)
4343
{
4444
#ifndef CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
45-
k_timer_start(&sFabricRemovedTimer, K_MSEC(CONFIG_CHIP_LAST_FABRIC_REMOVED_ACTION_DELAY), K_NO_WAIT);
45+
auto &server = chip::Server::GetInstance();
46+
47+
if (server.GetFabricTable().FabricCount() == 0) {
48+
if (chip::DeviceLayer::ConnectivityMgr().IsBLEAdvertisingEnabled()) {
49+
server.GetCommissioningWindowManager().CloseCommissioningWindow();
50+
}
51+
52+
k_timer_start(&sFabricRemovedTimer, K_MSEC(CONFIG_CHIP_LAST_FABRIC_REMOVED_ACTION_DELAY),
53+
K_NO_WAIT);
54+
}
4655
#endif // CONFIG_CHIP_LAST_FABRIC_REMOVED_NONE
4756
}
4857

0 commit comments

Comments
 (0)