Skip to content

Commit

Permalink
Remove more usage of dataModelProvider input. This should now be a cl…
Browse files Browse the repository at this point in the history
…ean safe storage refactor
  • Loading branch information
andreilitvin committed Nov 19, 2024
1 parent e325098 commit 35db533
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams)
VerifyOrExit(initParams.operationalKeystore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrExit(initParams.opCertStore != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrExit(initParams.reportScheduler != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrExit(initParams.dataModelProvider != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT);

// TODO(16969): Remove chip::Platform::MemoryInit() call from Server class, it belongs to outer code
chip::Platform::MemoryInit();
Expand Down Expand Up @@ -161,11 +160,13 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams)
SuccessOrExit(err = mSafeAttributePersister.Init(mDeviceStorage));
SetSafeAttributePersistenceProvider(&mSafeAttributePersister);

// Ember requires a persistence provider:
// Temporary setup until a full ember decoupling (including the InitDataModelHandler) is done outside
// of app code:
// - InitDataModelHandler uses ember init (so needs a data model provider)
// - CodegenDataModelProvider requires a persistence provider to use, so this must be called late
// enough, after SetSafeAttributePersistenceProvider
chip::app::InteractionModelEngine::GetInstance()->SetDataModelProvider(initParams.dataModelProvider);
// - Ember requires a persistence provider which is available currently from CodegenDataModelProvider, so
// ensure the codegen data model provider is initialized.
// TODO: this should eventually become a `SetDataModelProvider` that is based on `initParams`
(void) chip::app::InteractionModelEngine::GetInstance()->GetDataModelProvider();

{
FabricTable::InitParams fabricTableInitParams;
Expand Down
1 change: 0 additions & 1 deletion src/app/server/java/AndroidAppServerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ CHIP_ERROR ChipAndroidAppInit(AppDelegate * appDelegate)
// Init ZCL Data Model and CHIP App Server
static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();
initParams.dataModelProvider = app::CodegenDataModelProviderInstance();
if (appDelegate != nullptr)
{
initParams.appDelegate = appDelegate;
Expand Down

0 comments on commit 35db533

Please sign in to comment.