18
18
19
19
#include " OTAConfig.h"
20
20
#include < app/server/Server.h>
21
+ #include " silabs_utils.h"
21
22
22
23
#ifndef SIWX_917
23
24
@@ -81,7 +82,6 @@ chip::DefaultOTARequestor gRequestorCore;
81
82
chip::DefaultOTARequestorStorage gRequestorStorage ;
82
83
chip::DeviceLayer::DefaultOTARequestorDriver gRequestorUser ;
83
84
chip::BDXDownloader gDownloader ;
84
- chip::OTAImageProcessorImpl gImageProcessor ;
85
85
86
86
void OTAConfig::Init ()
87
87
{
@@ -93,12 +93,18 @@ void OTAConfig::Init()
93
93
94
94
// Periodic query timeout must be set prior to requestor being initialized
95
95
gRequestorUser .SetPeriodicQueryTimeout (OTA_PERIODIC_TIMEOUT);
96
- gRequestorUser .Init (&gRequestorCore , &gImageProcessor );
97
96
98
- gImageProcessor .SetOTAImageFile (" test.txt" );
99
- gImageProcessor .SetOTADownloader (&gDownloader );
97
+ auto & imageProcessor = chip::OTAImageProcessorImpl::GetDefaultInstance ();
98
+ gRequestorUser .Init (&gRequestorCore , &imageProcessor);
99
+
100
+ CHIP_ERROR err = imageProcessor.Init (&gDownloader );
101
+ if (err != CHIP_NO_ERROR)
102
+ {
103
+ SILABS_LOG (" Image processor init failed" );
104
+ assert (err == CHIP_NO_ERROR);
105
+ }
100
106
101
107
// Connect the Downloader and Image Processor objects
102
- gDownloader .SetImageProcessorDelegate (&gImageProcessor );
108
+ gDownloader .SetImageProcessorDelegate (&imageProcessor );
103
109
// Initialize and interconnect the Requestor and Image Processor objects -- END
104
110
}
0 commit comments