Skip to content

Commit

Permalink
[Bouffalolab] Add Device Information provider support (project-chip#2…
Browse files Browse the repository at this point in the history
…5838)

* add device info provider support

* correct building for bl702

* Fix restyle
  • Loading branch information
wy-hh authored Mar 27, 2023
1 parent ee5fdea commit 58c7031
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/lighting-app/bouffalolab/bl602/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ bouffalolab_executable("lighting_app") {
}

sources += [
"${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp",
"${example_common_dir}/AppTask.cpp",
"${example_common_dir}/ZclCallbacks.cpp",
"${examples_plat_common_dir}/plat/LEDWidget.cpp",
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/bouffalolab/bl702/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ bouffalolab_executable("lighting_app") {
deps = [
":sdk",
"${chip_root}/examples/lighting-app/lighting-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/src/setup_payload",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
Expand Down
8 changes: 8 additions & 0 deletions examples/platform/bouffalolab/common/plat/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
#include "Rpc.h"
#endif

#include <DeviceInfoProviderImpl.h>

#if CONFIG_ENABLE_CHIP_SHELL || PW_RPC_ENABLED
#include "uart.h"
#endif
Expand All @@ -77,6 +79,8 @@ chip::app::Clusters::NetworkCommissioning::Instance
}
#endif

static chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider;

void ChipEventHandler(const ChipDeviceEvent * event, intptr_t arg)
{
switch (event->Type)
Expand Down Expand Up @@ -201,11 +205,15 @@ CHIP_ERROR PlatformManagerImpl::PlatformInit(void)
chip::app::DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(EXT_DISCOVERY_TIMEOUT_SECS);
#endif

chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider);

static CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();

ReturnLogErrorOnFailure(chip::Server::GetInstance().Init(initParams));

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

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

#if CHIP_ENABLE_OPENTHREAD
Expand Down

0 comments on commit 58c7031

Please sign in to comment.