Skip to content

Commit b31c8bc

Browse files
committed
Revert "[nrf fromtree] Add factory reset event (#37993)"
This reverts commit f2bba3a.
1 parent c78f093 commit b31c8bc

File tree

7 files changed

+5
-149
lines changed

7 files changed

+5
-149
lines changed

src/app/server/Server.cpp

-14
Original file line numberDiff line numberDiff line change
@@ -586,22 +586,8 @@ void Server::GenerateShutDownEvent()
586586
PlatformMgr().ScheduleWork([](intptr_t) { PlatformMgr().HandleServerShuttingDown(); });
587587
}
588588

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(AppServer, "Posting kFactoryReset event failed with %" CHIP_ERROR_FORMAT, error.Format());
598-
}
599-
}
600-
601589
void Server::ScheduleFactoryReset()
602590
{
603-
PostFactoryResetEvent();
604-
605591
PlatformMgr().ScheduleWork([](intptr_t) {
606592
// Delete all fabrics and emit Leave event.
607593
GetInstance().GetFabricTable().DeleteAllFabrics();

src/app/server/Server.h

-2
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ class Server
456456
void OnPlatformEvent(const DeviceLayer::ChipDeviceEvent & event);
457457
void CheckServerReadyEvent();
458458

459-
void PostFactoryResetEvent();
460-
461459
static void OnPlatformEventWrapper(const DeviceLayer::ChipDeviceEvent * event, intptr_t);
462460

463461
#if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS

src/app/tests/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ chip_test_suite("tests") {
217217
"TestReadInteraction.cpp",
218218
"TestReportScheduler.cpp",
219219
"TestReportingEngine.cpp",
220-
"TestServer.cpp",
221220
"TestStatusIB.cpp",
222221
"TestStatusResponseMessage.cpp",
223222
"TestTestEventTriggerDelegate.cpp",

src/app/tests/TestServer.cpp

-74
This file was deleted.

src/include/platform/CHIPDeviceEvent.h

-5
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,6 @@ enum PublicEventTypes
255255
* Signals that secure session is established.
256256
*/
257257
kSecureSessionEstablished,
258-
259-
/**
260-
* Signals that factory reset has started.
261-
*/
262-
kFactoryReset,
263258
};
264259

265260
/**

src/platform/fake/PlatformManagerImpl.h

+5-49
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222

2323
#pragma once
2424

25-
#include <platform/CHIPDeviceLayer.h>
25+
#include <platform/PlatformManager.h>
2626

27-
#include <algorithm>
28-
#include <list>
2927
#include <queue>
3028

3129
namespace chip {
@@ -46,34 +44,11 @@ class PlatformManagerImpl final : public PlatformManager
4644
private:
4745
// ===== Methods that implement the PlatformManager abstract interface.
4846

49-
struct EventHandler
50-
{
51-
PlatformManager::EventHandlerFunct Handler;
52-
intptr_t Arg;
53-
54-
bool operator==(const EventHandler & other) const { return Handler == other.Handler && Arg == other.Arg; }
55-
};
56-
5747
CHIP_ERROR _InitChipStack() { return CHIP_NO_ERROR; }
5848
void _Shutdown() {}
5949

60-
CHIP_ERROR _AddEventHandler(EventHandlerFunct handler, intptr_t arg = 0)
61-
{
62-
EventHandler eventHandler = { .Handler = handler, .Arg = arg };
63-
if (std::find(mEventHandlers.begin(), mEventHandlers.end(), eventHandler) == mEventHandlers.end())
64-
{
65-
mEventHandlers.push_back(eventHandler);
66-
}
67-
68-
return CHIP_NO_ERROR;
69-
}
70-
71-
void _RemoveEventHandler(EventHandlerFunct handler, intptr_t arg = 0)
72-
{
73-
EventHandler eventHandler = { .Handler = handler, .Arg = arg };
74-
mEventHandlers.remove(eventHandler);
75-
}
76-
50+
CHIP_ERROR _AddEventHandler(EventHandlerFunct handler, intptr_t arg = 0) { return CHIP_ERROR_NOT_IMPLEMENTED; }
51+
void _RemoveEventHandler(EventHandlerFunct handler, intptr_t arg = 0) {}
7752
void _HandleServerStarted() {}
7853
void _HandleServerShuttingDown() {}
7954

@@ -133,26 +108,8 @@ class PlatformManagerImpl final : public PlatformManager
133108
event->CallWorkFunct.WorkFunct(event->CallWorkFunct.Arg);
134109
break;
135110

136-
default: {
137-
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
138-
BLEMgr().OnPlatformEvent(event);
139-
#endif
140-
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
141-
ThreadStackMgr().OnPlatformEvent(event);
142-
#endif
143-
ConnectivityMgr().OnPlatformEvent(event);
144-
145-
if (!event->IsInternal())
146-
{
147-
// iterate over local copy in case handler unregisters itself
148-
auto handlers = mEventHandlers;
149-
for (auto & handler : handlers)
150-
{
151-
handler.Handler(event, handler.Arg);
152-
}
153-
}
154-
}
155-
break;
111+
default:
112+
break;
156113
}
157114
}
158115

@@ -178,7 +135,6 @@ class PlatformManagerImpl final : public PlatformManager
178135

179136
bool mShouldRunEventLoop = true;
180137
std::queue<ChipDeviceEvent> mQueue;
181-
std::list<EventHandler> mEventHandlers;
182138
};
183139

184140
/**

src/test_driver/nrfconnect/prj.conf

-4
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,3 @@ CONFIG_CHIP_ENABLE_READ_CLIENT=y
8585
CONFIG_CHIP_DEVICE_VENDOR_ID=65521
8686
CONFIG_CHIP_DEVICE_PRODUCT_ID=32768
8787
CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h"
88-
89-
# Don't erase all settings as it deinitializes NVS/ZMS and causes issues with
90-
# testing Server::ScheduleFactoryReset
91-
CONFIG_CHIP_FACTORY_RESET_ERASE_SETTINGS=n

0 commit comments

Comments
 (0)