From 89289603ff6e17a9e7a10dd3dc7e252806c2e1d0 Mon Sep 17 00:00:00 2001 From: wyhong Date: Sun, 26 Mar 2023 22:53:20 +0800 Subject: [PATCH 1/3] add device info provider support --- examples/lighting-app/bouffalolab/bl602/BUILD.gn | 1 + examples/lighting-app/bouffalolab/bl702/BUILD.gn | 1 + examples/platform/bouffalolab/common/plat/platform.cpp | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index a6ef75ec04a1a0..3c7122cb2d9145 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -112,6 +112,7 @@ bouffalolab_executable("lighting_app") { "${examples_plat_common_dir}/plat/main.cpp", "${examples_plat_common_dir}/plat/platform.cpp", "${examples_plat_common_dir}/plat/uart.c", + "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", ] deps = [ diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index 19dfe7aa7e70af..838a12c68ad0fb 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -188,6 +188,7 @@ bouffalolab_executable("lighting_app") { deps += [ "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", + "${chip_root}/examples/providers:device_info_provider", #"$dir_pw_trace", #"$dir_pw_trace_tokenized", diff --git a/examples/platform/bouffalolab/common/plat/platform.cpp b/examples/platform/bouffalolab/common/plat/platform.cpp index a6d142a1a75575..692b469eeb2c3b 100644 --- a/examples/platform/bouffalolab/common/plat/platform.cpp +++ b/examples/platform/bouffalolab/common/plat/platform.cpp @@ -58,6 +58,8 @@ #include "Rpc.h" #endif +#include + #if CONFIG_ENABLE_CHIP_SHELL || PW_RPC_ENABLED #include "uart.h" #endif @@ -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) @@ -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 From 28a5ebc5e734762e6985e1eb6bada416bbeba804 Mon Sep 17 00:00:00 2001 From: wyhong Date: Mon, 27 Mar 2023 00:34:11 +0800 Subject: [PATCH 2/3] correct building for bl702 --- examples/lighting-app/bouffalolab/bl702/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index 838a12c68ad0fb..d2f09a46a5ee61 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -139,6 +139,7 @@ bouffalolab_executable("lighting_app") { "${chip_root}/examples/lighting-app/lighting-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", + "${chip_root}/examples/providers:device_info_provider", "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", ] @@ -188,7 +189,6 @@ bouffalolab_executable("lighting_app") { deps += [ "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", - "${chip_root}/examples/providers:device_info_provider", #"$dir_pw_trace", #"$dir_pw_trace_tokenized", From 3b15d1e29d95d6dde054b804a43b018b2590dea3 Mon Sep 17 00:00:00 2001 From: wyhong Date: Mon, 27 Mar 2023 09:51:33 +0800 Subject: [PATCH 3/3] Fix restyle --- examples/lighting-app/bouffalolab/bl602/BUILD.gn | 2 +- examples/lighting-app/bouffalolab/bl702/BUILD.gn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index 3c7122cb2d9145..ef0424f16ed10d 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -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", @@ -112,7 +113,6 @@ bouffalolab_executable("lighting_app") { "${examples_plat_common_dir}/plat/main.cpp", "${examples_plat_common_dir}/plat/platform.cpp", "${examples_plat_common_dir}/plat/uart.c", - "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", ] deps = [ diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index d2f09a46a5ee61..75eeba1aaf569d 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -137,9 +137,9 @@ 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}/examples/providers:device_info_provider", "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", ]