File tree 3 files changed +21
-0
lines changed
3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -586,8 +586,22 @@ void Server::GenerateShutDownEvent()
586
586
PlatformMgr ().ScheduleWork ([](intptr_t ) { PlatformMgr ().HandleServerShuttingDown (); });
587
587
}
588
588
589
+ void Server::PostFactoryResetEvent ()
590
+ {
591
+ DeviceLayer::ChipDeviceEvent event;
592
+ event.Type = DeviceLayer::DeviceEventType::kFactoryReset ;
593
+
594
+ CHIP_ERROR error = DeviceLayer::PlatformMgr ().PostEvent (&event);
595
+ if (error != CHIP_NO_ERROR)
596
+ {
597
+ ChipLogError (Discovery, " Posting kFactoryReset event failed with %" CHIP_ERROR_FORMAT, error.Format ());
598
+ }
599
+ }
600
+
589
601
void Server::ScheduleFactoryReset ()
590
602
{
603
+ PostFactoryResetEvent ();
604
+
591
605
PlatformMgr ().ScheduleWork ([](intptr_t ) {
592
606
// Delete all fabrics and emit Leave event.
593
607
GetInstance ().GetFabricTable ().DeleteAllFabrics ();
Original file line number Diff line number Diff line change @@ -456,6 +456,8 @@ class Server
456
456
void OnPlatformEvent (const DeviceLayer::ChipDeviceEvent & event);
457
457
void CheckServerReadyEvent ();
458
458
459
+ void PostFactoryResetEvent ();
460
+
459
461
static void OnPlatformEventWrapper (const DeviceLayer::ChipDeviceEvent * event, intptr_t );
460
462
461
463
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS
Original file line number Diff line number Diff line change @@ -255,6 +255,11 @@ enum PublicEventTypes
255
255
* Signals that secure session is established.
256
256
*/
257
257
kSecureSessionEstablished ,
258
+
259
+ /* *
260
+ * Signals that factory reset has started.
261
+ */
262
+ kFactoryReset ,
258
263
};
259
264
260
265
/* *
You can’t perform that action at this time.
0 commit comments