Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bouffalolab] Add Device Information provider support #25838

Merged
merged 3 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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