Skip to content

Commit

Permalink
[bouffalo lab] Make it possible for application to implement its own …
Browse files Browse the repository at this point in the history
…fabric delegate
  • Loading branch information
wy-hh committed Feb 12, 2025
1 parent e5a49c8 commit b3738c2
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_FABRIC_TABLE_DELEGATE
#define CONFIG_APP_FABRIC_TABLE_DELEGATE 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 @@ -178,6 +178,7 @@ void UnlockOpenThreadTask(void)
}
#endif

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

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

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

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

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

Expand Down

0 comments on commit b3738c2

Please sign in to comment.