Skip to content

Commit

Permalink
[bouffalo lab] Advertise commissionable on last fabric removal is dis…
Browse files Browse the repository at this point in the history
…abled by default (project-chip#37531)

* [bouffalo lab] Make it possible for application to implement its own fabric delegate

* Advertise commissionable on last fabric removal is disabled by default
  • Loading branch information
wy-hh committed Feb 15, 2025
1 parent 517d968 commit 837e910
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/platform/bouffalolab/common/plat/plat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@

#define EXT_DISCOVERY_TIMEOUT_SECS 20

#ifndef CONFIG_APP_ADVERTISE_COMMISSIONABLE_ON_LAST_FABRIC_REMOVAL
#define CONFIG_APP_ADVERTISE_COMMISSIONABLE_ON_LAST_FABRIC_REMOVAL 0
#endif

typedef void (*app_pds_gpio_irq_handler_t)(void * arg);

#ifdef __cplusplus
Expand Down
4 changes: 4 additions & 0 deletions examples/platform/bouffalolab/common/plat/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void UnlockOpenThreadTask(void)
}
#endif

#if CONFIG_APP_ADVERTISE_COMMISSIONABLE_ON_LAST_FABRIC_REMOVAL
class AppFabricTableDelegate : public FabricTable::Delegate
{
void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex)
Expand Down Expand Up @@ -205,6 +206,7 @@ class AppFabricTableDelegate : public FabricTable::Delegate
}
}
};
#endif

CHIP_ERROR PlatformManagerImpl::PlatformInit(void)
{
Expand Down Expand Up @@ -293,8 +295,10 @@ CHIP_ERROR PlatformManagerImpl::PlatformInit(void)

gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage());

#if CONFIG_APP_ADVERTISE_COMMISSIONABLE_ON_LAST_FABRIC_REMOVAL
static AppFabricTableDelegate sAppFabricDelegate;
chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&sAppFabricDelegate);
#endif

chip::DeviceLayer::PlatformMgr().UnlockChipStack();

Expand Down

0 comments on commit 837e910

Please sign in to comment.