@@ -44,7 +44,9 @@ extern "C" {
4444uint8_t flag = RPS_HEADER;
4545static chip::OTAImageProcessorImpl gImageProcessor ;
4646
47+ using namespace chip ::DeviceLayer;
4748using namespace chip ::DeviceLayer::Silabs;
49+ using namespace chip ::DeviceLayer::Internal;
4850
4951namespace chip {
5052
@@ -66,24 +68,24 @@ CHIP_ERROR OTAImageProcessorImpl::Init(OTADownloader * downloader)
6668
6769CHIP_ERROR OTAImageProcessorImpl::PrepareDownload ()
6870{
69- DeviceLayer:: PlatformMgr ().ScheduleWork (HandlePrepareDownload, reinterpret_cast <intptr_t >(this ));
71+ PlatformMgr ().ScheduleWork (HandlePrepareDownload, reinterpret_cast <intptr_t >(this ));
7072 return CHIP_NO_ERROR;
7173}
7274
7375CHIP_ERROR OTAImageProcessorImpl::Finalize ()
7476{
75- DeviceLayer:: PlatformMgr ().ScheduleWork (HandleFinalize, reinterpret_cast <intptr_t >(this ));
77+ PlatformMgr ().ScheduleWork (HandleFinalize, reinterpret_cast <intptr_t >(this ));
7678 return CHIP_NO_ERROR;
7779}
7880CHIP_ERROR OTAImageProcessorImpl::Apply ()
7981{
80- DeviceLayer:: PlatformMgr ().ScheduleWork (HandleApply, reinterpret_cast <intptr_t >(this ));
82+ PlatformMgr ().ScheduleWork (HandleApply, reinterpret_cast <intptr_t >(this ));
8183 return CHIP_NO_ERROR;
8284}
8385
8486CHIP_ERROR OTAImageProcessorImpl::Abort ()
8587{
86- DeviceLayer:: PlatformMgr ().ScheduleWork (HandleAbort, reinterpret_cast <intptr_t >(this ));
88+ PlatformMgr ().ScheduleWork (HandleAbort, reinterpret_cast <intptr_t >(this ));
8789 return CHIP_NO_ERROR;
8890}
8991
@@ -101,7 +103,7 @@ CHIP_ERROR OTAImageProcessorImpl::ProcessBlock(ByteSpan & block)
101103 ChipLogError (SoftwareUpdate, " Cannot set block data: %" CHIP_ERROR_FORMAT, err.Format ());
102104 }
103105
104- DeviceLayer:: PlatformMgr ().ScheduleWork (HandleProcessBlock, reinterpret_cast <intptr_t >(this ));
106+ PlatformMgr ().ScheduleWork (HandleProcessBlock, reinterpret_cast <intptr_t >(this ));
105107 return CHIP_NO_ERROR;
106108}
107109
@@ -127,7 +129,7 @@ CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage()
127129
128130 uint32_t currentVersion;
129131 uint32_t targetVersion = requestor->GetTargetVersion ();
130- ReturnErrorOnFailure (DeviceLayer:: ConfigurationMgr ().GetSoftwareVersion (currentVersion));
132+ ReturnErrorOnFailure (ConfigurationMgr ().GetSoftwareVersion (currentVersion));
131133 if (currentVersion != targetVersion)
132134 {
133135 ChipLogError (SoftwareUpdate, " Current software version = %" PRIu32 " , expected software version = %" PRIu32, currentVersion,
@@ -165,7 +167,7 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context)
165167
166168#if CHIP_CONFIG_ENABLE_ICD_SERVER
167169 // Setting the device in high performance - no-sleep mode during OTA tranfer
168- DeviceLayer::Silabs:: WifiSleepManager::GetInstance ().RequestHighPerformanceWithTransition ();
170+ WifiSleepManager::GetInstance ().RequestHighPerformanceWithTransition ();
169171#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/
170172
171173 imageProcessor->mDownloader ->OnPreparedForDownload (CHIP_NO_ERROR);
@@ -204,7 +206,7 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context)
204206
205207#if CHIP_CONFIG_ENABLE_ICD_SERVER
206208 // Setting the device back to power save mode when transfer is completed successfully
207- DeviceLayer::Silabs:: WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
209+ WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
208210#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/
209211
210212 ChipLogProgress (SoftwareUpdate, " OTA image downloaded successfully" );
@@ -215,21 +217,22 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context)
215217 ChipLogProgress (SoftwareUpdate, " OTAImageProcessorImpl::HandleApply()" );
216218
217219 // Force KVS to store pending keys such as data from StoreCurrentUpdateInfo()
218- chip::DeviceLayer:: PersistedStorage::KeyValueStoreMgrImpl ().ForceKeyMapSave ();
220+ PersistedStorage::KeyValueStoreMgrImpl ().ForceKeyMapSave ();
219221
220222 ChipLogProgress (SoftwareUpdate, " OTA image downloaded successfully in HandleApply" );
221223
222224#if CHIP_CONFIG_ENABLE_ICD_SERVER
223225 // Setting the device is in high performace - no-sleepy mode before soft reset as soft reset is not happening in sleep mode
224- DeviceLayer::Silabs:: WifiSleepManager::GetInstance ().RequestHighPerformanceWithTransition ();
226+ WifiSleepManager::GetInstance ().RequestHighPerformanceWithTransition ();
225227#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/
226228
227229 if (mReset )
228230 {
229231 ChipLogProgress (SoftwareUpdate, " M4 Firmware update complete" );
230232 // send system reset request to reset the MCU and upgrade the m4 image
231233 ChipLogProgress (SoftwareUpdate, " SoC Soft Reset initiated!" );
232- // Reboots the device
234+ // Write that we are rebooting after a software update and reboot the device
235+ SilabsConfig::WriteConfigValue (SilabsConfig::kConfigKey_MatterUpdateReboot , true );
233236 GetPlatform ().SoftwareReset ();
234237 }
235238}
@@ -244,7 +247,7 @@ void OTAImageProcessorImpl::HandleAbort(intptr_t context)
244247
245248#if CHIP_CONFIG_ENABLE_ICD_SERVER
246249 // Setting the device back to power save mode when transfer is aborted in the middle
247- DeviceLayer::Silabs:: WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
250+ WifiSleepManager::GetInstance ().RemoveHighPerformanceRequest ();
248251#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/
249252
250253 // Not clearing the image storage area as it is done during each write
0 commit comments