Skip to content

Commit

Permalink
[MATTER-338][K32W0] Move DeviceInfoProvider instantiation to AppTask
Browse files Browse the repository at this point in the history
Use common example for DeviceInfoProvider implementation.
Also see this PR: project-chip#21109

Signed-off-by: Marius Tache <[email protected]>
  • Loading branch information
marius-alex-tache committed Aug 5, 2022
1 parent bfef980 commit eaeaa50
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 488 deletions.
1 change: 1 addition & 0 deletions examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ k32w0_executable("contact_sensor_app") {
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/contact-sensor-app/contact-sensor-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
Expand Down
6 changes: 5 additions & 1 deletion examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <lib/support/ThreadOperationalDataset.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/internal/DeviceNetworkInfo.h>

#include <DeviceInfoProviderImpl.h>
#include <inet/EndPointStateOpenThread.h>

#include <app-common/zap-generated/attribute-id.h>
Expand Down Expand Up @@ -209,6 +209,10 @@ void AppTask::InitServer(intptr_t arg)
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();

auto& infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance();
infoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
chip::DeviceLayer::SetDeviceInfoProvider(&infoProvider);

// Init ZCL Data Model and start server
chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams;
nativeParams.lockCb = LockOpenThreadTask;
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ k32w0_executable("light_app") {
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/lighting-app/nxp/zap/",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/lib",
"${chip_root}/third_party/mbedtls:mbedtls",
"${k32w0_platform_dir}/app/support:freertos_mbedtls_utils",
Expand Down
6 changes: 5 additions & 1 deletion examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <lib/support/ThreadOperationalDataset.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/internal/DeviceNetworkInfo.h>

#include <DeviceInfoProviderImpl.h>
#include <inet/EndPointStateOpenThread.h>

#include <app-common/zap-generated/attribute-id.h>
Expand Down Expand Up @@ -205,6 +205,10 @@ void AppTask::InitServer(intptr_t arg)
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();

auto& infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance();
infoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
chip::DeviceLayer::SetDeviceInfoProvider(&infoProvider);

// Init ZCL Data Model and start server
chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams;
nativeParams.lockCb = LockOpenThreadTask;
Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ k32w0_executable("lock_app") {
":sdk",
"${chip_root}/examples/common/QRCode",
"${chip_root}/examples/lock-app/lock-common",
"${chip_root}/examples/providers:device_info_provider",
"${chip_root}/src/crypto",
"${chip_root}/src/lib",
"${chip_root}/third_party/mbedtls:mbedtls",
Expand Down
6 changes: 5 additions & 1 deletion examples/lock-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <lib/support/ThreadOperationalDataset.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/internal/DeviceNetworkInfo.h>

#include <DeviceInfoProviderImpl.h>
#include <inet/EndPointStateOpenThread.h>

#include <app-common/zap-generated/attribute-id.h>
Expand Down Expand Up @@ -181,6 +181,10 @@ void AppTask::InitServer(intptr_t arg)
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();

auto& infoProvider = chip::DeviceLayer::DeviceInfoProviderImpl::GetDefaultInstance();
infoProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
chip::DeviceLayer::SetDeviceInfoProvider(&infoProvider);

// Init ZCL Data Model and start server
chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams;
nativeParams.lockCb = LockOpenThreadTask;
Expand Down
2 changes: 0 additions & 2 deletions src/platform/nxp/k32w/k32w0/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ static_library("k32w0") {
"ConfigurationManagerImpl.h",
"ConnectivityManagerImpl.cpp",
"ConnectivityManagerImpl.h",
"DeviceInfoProviderImpl.cpp",
"DeviceInfoProviderImpl.h",
"DeviceNetworkProvisioningDelegateImpl.cpp",
"DeviceNetworkProvisioningDelegateImpl.h",
"DiagnosticDataProviderImpl.cpp",
Expand Down
Loading

0 comments on commit eaeaa50

Please sign in to comment.