Skip to content

Commit

Permalink
[ota] Store Default OTA Providers in flash (#15970)
Browse files Browse the repository at this point in the history
* [ota] Store Default OTA Providers in flash

Store Default OTA Providers in flash each time the attribute
is modified and load it back on the application startup.

* Restyled by clang-format

* Fix build and reduce flash usage

Co-authored-by: Restyled.io <commits@restyled.io>
Former-commit-id: b942392
  • Loading branch information
2 people authored and pull[bot] committed Apr 8, 2022
1 parent bcd9a0f commit 1826852
Show file tree
Hide file tree
Showing 38 changed files with 146 additions and 79 deletions.
1 change: 1 addition & 0 deletions config/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ if (CONFIG_CHIP_OTA_REQUESTOR)
target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/examples/platform/mbed/ota/OTARequestorDriverImpl.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp
${CHIP_ROOT}/src/platform/mbed/OTAImageProcessorImpl.cpp
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ list(
#OTARequestor
${chip_dir}/src/app/clusters/ota-requestor/BDXDownloader.cpp
${chip_dir}/src/app/clusters/ota-requestor/OTARequestor.cpp
${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
${chip_dir}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp
${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
)
Expand Down
6 changes: 5 additions & 1 deletion examples/all-clusters-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <support/CHIPMem.h>

#if CONFIG_ENABLE_OTA_REQUESTOR
#include "app/clusters/ota-requestor/DefaultOTARequestorStorage.h"
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
Expand Down Expand Up @@ -91,6 +92,7 @@ static DeviceCallbacks EchoCallbacks;

#if CONFIG_ENABLE_OTA_REQUESTOR
OTARequestor gRequestorCore;
DefaultOTARequestorStorage gRequestorStorage;
GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
AmebaOTAImageProcessor gImageProcessor;
Expand All @@ -115,8 +117,10 @@ static void InitOTARequestor(void)
// Initialize and interconnect the Requestor and Image Processor objects -- START
SetRequestorInstance(&gRequestorCore);

gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());

// Set server instance used for session establishment
gRequestorCore.Init(&(chip::Server::GetInstance()), &gRequestorUser, &gDownloader);
gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);

// WARNING: this is probably not realistic to know such details of the image or to even have an OTADownloader instantiated at
// the beginning of program execution. We're using hardcoded values here for now since this is a reference application.
Expand Down
5 changes: 4 additions & 1 deletion examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

#include <app/clusters/network-commissioning/network-commissioning.h>
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <app/server/OnboardingCodesUtil.h>
Expand Down Expand Up @@ -77,6 +78,7 @@ namespace {

#if CONFIG_ENABLE_OTA_REQUESTOR
OTARequestor gRequestorCore;
DefaultOTARequestorStorage gRequestorStorage;
GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
OTAImageProcessorImpl gImageProcessor;
Expand Down Expand Up @@ -127,7 +129,8 @@ static void InitOTARequestor(void)
{
#if CONFIG_ENABLE_OTA_REQUESTOR
SetRequestorInstance(&gRequestorCore);
gRequestorCore.Init(&Server::GetInstance(), &gRequestorUser, &gDownloader);
gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
Expand Down
5 changes: 1 addition & 4 deletions examples/all-clusters-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ target_sources(app PRIVATE
${ALL_CLUSTERS_COMMON_DIR}/src/bridged-actions-stub.cpp
${GEN_DIR}/all-clusters-app/zap-generated/callback-stub.cpp
${GEN_DIR}/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp)
${NRFCONNECT_COMMON}/util/LEDWidget.cpp)


chip_configure_data_model(app
Expand Down
3 changes: 2 additions & 1 deletion examples/all-clusters-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ void AppTask::InitOTARequestor()
mOTAImageProcessor.SetOTADownloader(&mBDXDownloader);
mBDXDownloader.SetImageProcessorDelegate(&mOTAImageProcessor);
mOTARequestorDriver.Init(&mOTARequestor, &mOTAImageProcessor);
mOTARequestor.Init(&chip::Server::GetInstance(), &mOTARequestorDriver, &mBDXDownloader);
mOTARequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
mOTARequestor.Init(chip::Server::GetInstance(), mOTARequestorStorage, mOTARequestorDriver, mBDXDownloader);
chip::SetRequestorInstance(&mOTARequestor);
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#if CONFIG_CHIP_OTA_REQUESTOR
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <platform/nrfconnect/OTAImageProcessorImpl.h>
Expand Down Expand Up @@ -73,6 +74,7 @@ class AppTask
bool mHaveBLEConnections{ false };

#if CONFIG_CHIP_OTA_REQUESTOR
chip::DefaultOTARequestorStorage mOTARequestorStorage;
chip::DeviceLayer::GenericOTARequestorDriver mOTARequestorDriver;
chip::DeviceLayer::OTAImageProcessorImpl mOTAImageProcessor;
chip::BDXDownloader mBDXDownloader;
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ list(
#OTARequestor
${chip_dir}/src/app/clusters/ota-requestor/BDXDownloader.cpp
${chip_dir}/src/app/clusters/ota-requestor/OTARequestor.cpp
${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
${chip_dir}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp
${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
)
Expand Down
6 changes: 5 additions & 1 deletion examples/lighting-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <lwip_netconf.h>

#if CONFIG_ENABLE_OTA_REQUESTOR
#include "app/clusters/ota-requestor/DefaultOTARequestorStorage.h"
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
Expand Down Expand Up @@ -76,6 +77,7 @@ static DeviceCallbacks EchoCallbacks;

#if CONFIG_ENABLE_OTA_REQUESTOR
OTARequestor gRequestorCore;
DefaultOTARequestorStorage gRequestorStorage;
GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
AmebaOTAImageProcessor gImageProcessor;
Expand All @@ -100,8 +102,10 @@ static void InitOTARequestor(void)
// Initialize and interconnect the Requestor and Image Processor objects -- START
SetRequestorInstance(&gRequestorCore);

gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());

// Set server instance used for session establishment
gRequestorCore.Init(&(chip::Server::GetInstance()), &gRequestorUser, &gDownloader);
gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);

// WARNING: this is probably not realistic to know such details of the image or to even have an OTADownloader instantiated at
// the beginning of program execution. We're using hardcoded values here for now since this is a reference application.
Expand Down
5 changes: 4 additions & 1 deletion examples/lighting-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "shell_extension/launch.h"
#include <app/clusters/network-commissioning/network-commissioning.h>
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <app/server/OnboardingCodesUtil.h>
Expand All @@ -44,6 +45,7 @@ using namespace ::chip::DeviceLayer;

#if CONFIG_ENABLE_OTA_REQUESTOR
OTARequestor gRequestorCore;
DefaultOTARequestorStorage gRequestorStorage;
GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
OTAImageProcessorImpl gImageProcessor;
Expand All @@ -64,7 +66,8 @@ static void InitOTARequestor(void)
{
#if CONFIG_ENABLE_OTA_REQUESTOR
SetRequestorInstance(&gRequestorCore);
gRequestorCore.Init(&Server::GetInstance(), &gRequestorUser, &gDownloader);
gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gImageProcessor.SetOTADownloader(&gDownloader);
gDownloader.SetImageProcessorDelegate(&gImageProcessor);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);
Expand Down
5 changes: 1 addition & 4 deletions examples/lighting-app/nrfconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ target_sources(app PRIVATE
${GEN_DIR}/lighting-app/zap-generated/callback-stub.cpp
${GEN_DIR}/lighting-app/zap-generated/IMClusterCommandHandler.cpp
${NRFCONNECT_COMMON}/util/LEDWidget.cpp
${NRFCONNECT_COMMON}/util/ThreadUtil.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/OTARequestor.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp
${CHIP_ROOT}/src/app/clusters/ota-requestor/BDXDownloader.cpp)
${NRFCONNECT_COMMON}/util/ThreadUtil.cpp)

chip_configure_data_model(app
INCLUDE_SERVER
Expand Down
5 changes: 4 additions & 1 deletion examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#if CONFIG_CHIP_OTA_REQUESTOR
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <platform/nrfconnect/OTAImageProcessorImpl.h>
Expand Down Expand Up @@ -85,6 +86,7 @@ bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;

#if CONFIG_CHIP_OTA_REQUESTOR
DefaultOTARequestorStorage sRequestorStorage;
GenericOTARequestorDriver sOTARequestorDriver;
OTAImageProcessorImpl sOTAImageProcessor;
chip::BDXDownloader sBDXDownloader;
Expand Down Expand Up @@ -203,7 +205,8 @@ void AppTask::InitOTARequestor()
sOTAImageProcessor.SetOTADownloader(&sBDXDownloader);
sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor);
sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor);
sOTARequestor.Init(&chip::Server::GetInstance(), &sOTARequestorDriver, &sBDXDownloader);
sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader);
chip::SetRequestorInstance(&sOTARequestor);
#endif
}
Expand Down
7 changes: 5 additions & 2 deletions examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "OTAImageProcessorImpl.h"
#include "OtaSupport.h"
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>

Expand Down Expand Up @@ -85,7 +86,8 @@ AppTask AppTask::sAppTask;

/* OTA related variables */
static OTARequestor gRequestorCore;
DeviceLayer::GenericOTARequestorDriver gRequestorUser;
static DefaultOTARequestorStorage gRequestorStorage;
static DeviceLayer::GenericOTARequestorDriver gRequestorUser;
static BDXDownloader gDownloader;
static OTAImageProcessorImpl gImageProcessor;

Expand Down Expand Up @@ -121,7 +123,8 @@ CHIP_ERROR AppTask::Init()
// Initialize and interconnect the Requestor and Image Processor objects -- START
SetRequestorInstance(&gRequestorCore);

gRequestorCore.Init(&(chip::Server::GetInstance()), &gRequestorUser, &gDownloader);
gRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);

// WARNING: this is probably not realistic to know such details of the image or to even have an OTADownloader instantiated at
Expand Down
5 changes: 4 additions & 1 deletion examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <platform/CHIPDeviceLayer.h>

#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <lib/support/CHIPMem.h>
Expand Down Expand Up @@ -63,6 +64,7 @@ static Button_Handle sAppRightHandle;
AppTask AppTask::sAppTask;

static OTARequestor sRequestorCore;
static DefaultOTARequestorStorage sRequestorStorage;
static GenericOTARequestorDriver sRequestorUser;
static BDXDownloader sDownloader;
static OTAImageProcessorImpl sImageProcessor;
Expand All @@ -72,7 +74,8 @@ void InitializeOTARequestor(void)
// Initialize and interconnect the Requestor and Image Processor objects
SetRequestorInstance(&sRequestorCore);

sRequestorCore.Init(&Server::GetInstance(), &sRequestorUser, &sDownloader);
sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
sRequestorCore.Init(Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
sImageProcessor.SetOTADownloader(&sDownloader);
sDownloader.SetImageProcessorDelegate(&sImageProcessor);
sRequestorUser.Init(&sRequestorCore, &sImageProcessor);
Expand Down
5 changes: 4 additions & 1 deletion examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#if CONFIG_CHIP_OTA_REQUESTOR
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <platform/nrfconnect/OTAImageProcessorImpl.h>
Expand Down Expand Up @@ -74,6 +75,7 @@ bool sIsThreadEnabled = false;
bool sHaveBLEConnections = false;

#if CONFIG_CHIP_OTA_REQUESTOR
DefaultOTARequestorStorage sRequestorStorage;
GenericOTARequestorDriver sOTARequestorDriver;
OTAImageProcessorImpl sOTAImageProcessor;
chip::BDXDownloader sBDXDownloader;
Expand Down Expand Up @@ -184,7 +186,8 @@ void AppTask::InitOTARequestor()
sOTAImageProcessor.SetOTADownloader(&sBDXDownloader);
sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor);
sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor);
sOTARequestor.Init(&chip::Server::GetInstance(), &sOTARequestorDriver, &sBDXDownloader);
sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage());
sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader);
chip::SetRequestorInstance(&sOTARequestor);
#endif
}
Expand Down
1 change: 1 addition & 0 deletions examples/ota-requestor-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ list(

${chip_dir}/src/app/clusters/ota-requestor/BDXDownloader.cpp
${chip_dir}/src/app/clusters/ota-requestor/OTARequestor.cpp
${chip_dir}/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp
${chip_dir}/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp
${chip_dir}/src/app/clusters/ota-requestor/ota-requestor-server.cpp
)
Expand Down
6 changes: 5 additions & 1 deletion examples/ota-requestor-app/ameba/main/chipinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <support/CHIPMem.h>

#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <platform/Ameba/AmebaOTAImageProcessor.h>
Expand Down Expand Up @@ -78,6 +79,7 @@ void NetWorkCommissioningInstInit()
static DeviceCallbacks EchoCallbacks;

OTARequestor gRequestorCore;
DefaultOTARequestorStorage gRequestorStorage;
GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
AmebaOTAImageProcessor gImageProcessor;
Expand All @@ -100,8 +102,10 @@ static void InitOTARequestor(void)
// Initialize and interconnect the Requestor and Image Processor objects -- START
SetRequestorInstance(&gRequestorCore);

gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());

// Set server instance used for session establishment
gRequestorCore.Init(&(chip::Server::GetInstance()), &gRequestorUser, &gDownloader);
gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);

// WARNING: this is probably not realistic to know such details of the image or to even have an OTADownloader instantiated at
// the beginning of program execution. We're using hardcoded values here for now since this is a reference application.
Expand Down
3 changes: 3 additions & 0 deletions examples/ota-requestor-app/cyw30739/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ cyw30739_sdk_target = get_label_info(":sdk", "label_no_toolchain")

chip_openthread_ftd = true

# Disable progress logging to fit in flash
chip_progress_logging = false

declare_args() {
chip_enable_ota_requestor = true
}
5 changes: 4 additions & 1 deletion examples/ota-requestor-app/cyw30739/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
#include <ChipShellCollection.h>
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <app/server/Server.h>
Expand All @@ -42,6 +43,7 @@ using namespace chip::Shell;
static void InitApp(intptr_t args);

OTARequestor gRequestorCore;
DefaultOTARequestorStorage gRequestorStorage;
DeviceLayer::GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
OTAImageProcessorImpl gImageProcessor;
Expand Down Expand Up @@ -129,7 +131,8 @@ void InitApp(intptr_t args)
// Initialize and interconnect the Requestor and Image Processor objects -- START
SetRequestorInstance(&gRequestorCore);

gRequestorCore.Init(&(chip::Server::GetInstance()), &gRequestorUser, &gDownloader);
gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);
gRequestorUser.Init(&gRequestorCore, &gImageProcessor);

gImageProcessor.SetOTADownloader(&gDownloader);
Expand Down
5 changes: 4 additions & 1 deletion examples/ota-requestor-app/efr32/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <app/util/attribute-storage.h>

#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <platform/EFR32/OTAImageProcessorImpl.h>
Expand Down Expand Up @@ -98,6 +99,7 @@ using namespace ::chip::DeviceLayer;

// Global OTA objects
OTARequestor gRequestorCore;
DefaultOTARequestorStorage gRequestorStorage;
DeviceLayer::GenericOTARequestorDriver gRequestorUser;
BDXDownloader gDownloader;
OTAImageProcessorImpl gImageProcessor;
Expand Down Expand Up @@ -535,7 +537,8 @@ void AppTask::InitOTARequestor()
// Initialize and interconnect the Requestor and Image Processor objects -- START
SetRequestorInstance(&gRequestorCore);

gRequestorCore.Init(&(chip::Server::GetInstance()), &gRequestorUser, &gDownloader);
gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader);

gRequestorUser.Init(&gRequestorCore, &gImageProcessor);

Expand Down
Loading

0 comments on commit 1826852

Please sign in to comment.