30
30
constexpr char kInteractiveModeInstruction [] = " ╔══════════════════════════════════════════════════════════════════╗\n "
31
31
" ║ Interactive Mode ║\n "
32
32
" ╠══════════════════════════════════════════════════════════════════╣\n "
33
- " ║ Stop and restart stack: [Ctrl+_] & [Ctrl+^ ] ║\n "
34
- " ║ Trigger exit(0) : [Ctrl+@] ║\n "
35
- " ║ Quit Interactive : 'quit()' or `quit` ║\n "
33
+ " ║ Stop and restart stack : [Ctrl+_] & [Ctrl+^ ] ║\n "
34
+ " ║ Suspend/Resume controllers: [Ctrl+Z] ║\n "
35
+ " ║ Trigger exit(0) : [Ctrl+@] ║\n "
36
+ " ║ Quit Interactive : 'quit()' or `quit` ║\n "
36
37
" ╚══════════════════════════════════════════════════════════════════╝\n " ;
37
38
constexpr char kInteractiveModePrompt [] = " >>> " ;
38
39
constexpr char kInteractiveModeHistoryFilePath [] = " /tmp/darwin_framework_tool_history" ;
@@ -76,6 +77,22 @@ CHIP_ERROR RunCommand() override
76
77
chip::System::Clock::Timeout GetWaitDuration () const override { return chip::System::Clock::Seconds16 (0 ); }
77
78
};
78
79
80
+ class SuspendOrResumeCommand : public CHIPCommandBridge {
81
+ public:
82
+ SuspendOrResumeCommand ()
83
+ : CHIPCommandBridge(" suspend" )
84
+ {
85
+ }
86
+
87
+ CHIP_ERROR RunCommand () override
88
+ {
89
+ SuspendOrResumeCommissioners ();
90
+ return CHIP_NO_ERROR;
91
+ }
92
+
93
+ chip::System::Clock::Timeout GetWaitDuration () const override { return chip::System::Clock::Seconds16 (0 ); }
94
+ };
95
+
79
96
void ClearLine ()
80
97
{
81
98
printf (" \r\x1B [0J" ); // Move cursor to the beginning of the line and clear from cursor to end of the screen
@@ -312,6 +329,13 @@ el_status_t StopFunction()
312
329
return CSstay;
313
330
}
314
331
332
+ el_status_t SuspendOrResumeFunction ()
333
+ {
334
+ SuspendOrResumeCommand cmd;
335
+ cmd.RunCommand ();
336
+ return CSstay;
337
+ }
338
+
315
339
el_status_t ExitFunction ()
316
340
{
317
341
exit (0 );
@@ -333,6 +357,7 @@ el_status_t ExitFunction()
333
357
el_bind_key (CTL (' ^' ), RestartFunction);
334
358
el_bind_key (CTL (' _' ), StopFunction);
335
359
el_bind_key (CTL (' @' ), ExitFunction);
360
+ el_bind_key (CTL (' Z' ), SuspendOrResumeFunction);
336
361
337
362
char * command = nullptr ;
338
363
int status;
0 commit comments