File tree 3 files changed +33
-4
lines changed
examples/darwin-framework-tool/commands
3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ class CHIPCommandBridge : public Command
95
95
96
96
static std::set<CHIPCommandBridge *> sDeferredCleanups ;
97
97
98
+ void StopCommissioners ();
99
+
98
100
void RestartCommissioners ();
99
101
100
102
private:
Original file line number Diff line number Diff line change 136
136
137
137
MTRDeviceController * CHIPCommandBridge::GetCommissioner (const char * identity) { return mControllers [identity]; }
138
138
139
- void CHIPCommandBridge::RestartCommissioners ()
139
+ void CHIPCommandBridge::StopCommissioners ()
140
140
{
141
141
for (auto & pair : mControllers ) {
142
142
[pair.second shutdown ];
143
143
}
144
+ }
145
+
146
+ void CHIPCommandBridge::RestartCommissioners ()
147
+ {
148
+ StopCommissioners ();
144
149
145
150
auto factory = [MTRControllerFactory sharedInstance ];
146
151
NSData * ipk = [gNocSigner getIPK ];
159
164
void CHIPCommandBridge::ShutdownCommissioner ()
160
165
{
161
166
ChipLogProgress (chipTool, " Shutting down controller" );
162
- for (auto & pair : mControllers ) {
163
- [pair.second shutdown ];
164
- }
167
+ StopCommissioners ();
165
168
mControllers .clear ();
166
169
mCurrentController = nil ;
167
170
Original file line number Diff line number Diff line change @@ -47,6 +47,22 @@ CHIP_ERROR RunCommand() override
47
47
chip::System::Clock::Timeout GetWaitDuration () const override { return chip::System::Clock::Seconds16 (0 ); }
48
48
};
49
49
50
+ class StopCommand : public CHIPCommandBridge {
51
+ public:
52
+ StopCommand ()
53
+ : CHIPCommandBridge(" stop" )
54
+ {
55
+ }
56
+
57
+ CHIP_ERROR RunCommand () override
58
+ {
59
+ StopCommissioners ();
60
+ return CHIP_NO_ERROR;
61
+ }
62
+
63
+ chip::System::Clock::Timeout GetWaitDuration () const override { return chip::System::Clock::Seconds16 (0 ); }
64
+ };
65
+
50
66
void ClearLine ()
51
67
{
52
68
printf (" \r\x1B [0J" ); // Move cursor to the beginning of the line and clear from cursor to end of the screen
@@ -85,6 +101,13 @@ el_status_t RestartFunction()
85
101
return CSstay;
86
102
}
87
103
104
+ el_status_t StopFunction ()
105
+ {
106
+ StopCommand cmd;
107
+ cmd.RunCommand ();
108
+ return CSstay;
109
+ }
110
+
88
111
CHIP_ERROR InteractiveStartCommand::RunCommand ()
89
112
{
90
113
read_history (kInteractiveModeHistoryFilePath );
@@ -94,6 +117,7 @@ el_status_t RestartFunction()
94
117
chip::Logging::SetLogRedirectCallback (LoggingCallback);
95
118
96
119
el_bind_key (CTL (' ^' ), RestartFunction);
120
+ el_bind_key (CTL (' _' ), StopFunction);
97
121
98
122
char * command = nullptr ;
99
123
while (YES ) {
You can’t perform that action at this time.
0 commit comments