mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 13:20:25 +00:00
Add Thread Auto Start Support (#1268)
* Add Thread Auto Start Support * Add compile-time option * Return error in Windows API
This commit is contained in:
@@ -67,6 +67,7 @@ namespace Cli {
|
||||
const struct Command Interpreter::sCommands[] =
|
||||
{
|
||||
{ "help", &Interpreter::ProcessHelp },
|
||||
{ "autostart", &Interpreter::ProcessAutoStart },
|
||||
{ "blacklist", &Interpreter::ProcessBlacklist },
|
||||
{ "bufferinfo", &Interpreter::ProcessBufferInfo },
|
||||
{ "channel", &Interpreter::ProcessChannel },
|
||||
@@ -247,6 +248,37 @@ void Interpreter::ProcessHelp(int argc, char *argv[])
|
||||
(void)argv;
|
||||
}
|
||||
|
||||
void Interpreter::ProcessAutoStart(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
if (otThreadGetAutoStart(mInstance))
|
||||
{
|
||||
sServer->OutputFormat("true\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
sServer->OutputFormat("false\r\n");
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[0], "true") == 0)
|
||||
{
|
||||
error = otThreadSetAutoStart(mInstance, true);
|
||||
}
|
||||
else if (strcmp(argv[0], "false") == 0)
|
||||
{
|
||||
error = otThreadSetAutoStart(mInstance, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = kThreadError_InvalidArgs;
|
||||
}
|
||||
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::ProcessBlacklist(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
Reference in New Issue
Block a user