Skip to content

Commit 4b7f2dd

Browse files
ArekBalysNordicrlubos
authored andcommitted
samples: matter: Align AttributePersistenceProvider with upstream
Aligned DefaultAttributePersistenceProvider and DeferredAttributePersistenceProvider with the recent changes in Matter Upstream repository. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent f7dbfc9 commit 4b7f2dd

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

samples/matter/light_bulb/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ target_sources(app PRIVATE
3737
src/app_task.cpp
3838
src/main.cpp
3939
src/zcl_callbacks.cpp
40+
${CHIP_ROOT}/src/app/util/persistence/DeferredAttributePersistenceProvider.cpp
4041
)
4142

4243
ncs_configure_data_model()

samples/matter/light_bulb/src/app_task.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
#endif
1919

2020
#include <app-common/zap-generated/attributes/Accessors.h>
21-
#include <app/DeferredAttributePersistenceProvider.h>
2221
#include <app/clusters/identify-server/identify-server.h>
2322
#include <app/server/Server.h>
23+
#include <app/util/persistence/DefaultAttributePersistenceProvider.h>
24+
#include <app/util/persistence/DeferredAttributePersistenceProvider.h>
2425
#include <setup_payload/OnboardingCodesUtil.h>
2526

2627
#include <zephyr/logging/log.h>
@@ -57,7 +58,10 @@ const struct pwm_dt_spec sLightPwmDevice = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led1));
5758
// be written, so it must live so long as the DeferredAttributePersistenceProvider object.
5859
DeferredAttribute gCurrentLevelPersister(ConcreteAttributePath(kLightEndpointId, Clusters::LevelControl::Id,
5960
Clusters::LevelControl::Attributes::CurrentLevel::Id));
60-
DeferredAttributePersistenceProvider gDeferredAttributePersister(Server::GetInstance().GetDefaultAttributePersister(),
61+
62+
// Deferred persistence will be auto-initialized as soon as the default persistence is initialized
63+
DefaultAttributePersistenceProvider gSimpleAttributePersistence;
64+
DeferredAttributePersistenceProvider gDeferredAttributePersister(gSimpleAttributePersistence,
6165
Span<DeferredAttribute>(&gCurrentLevelPersister, 1),
6266
System::Clock::Milliseconds32(5000));
6367

0 commit comments

Comments
 (0)