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:
Nick Banks
2017-02-20 17:29:20 -08:00
committed by Jonathan Hui
parent 500dada64c
commit 64f5ab43fc
11 changed files with 230 additions and 13 deletions
+29
View File
@@ -7,6 +7,7 @@ OpenThread test scripts use the CLI to execute test cases.
## OpenThread Command List
* [autostart](#autostart)
* [blacklist](#blacklist)
* [channel](#channel)
* [child](#child-list)
@@ -63,6 +64,34 @@ OpenThread test scripts use the CLI to execute test cases.
## OpenThread Command Details
### autostart true
Automatically start Thread on initialization.
```bash
> autostart true
Done
```
### autostart false
Don't automatically start Thread on initialization.
```bash
> autostart false
Done
```
### autostart
Show the status of automatically starting Thread on initialization.
```bash
> autostart
false
Done
```
### blacklist
List the blacklist entries.
+32
View File
@@ -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;
+1
View File
@@ -141,6 +141,7 @@ private:
void OutputBytes(const uint8_t *aBytes, uint8_t aLength);
void ProcessHelp(int argc, char *argv[]);
void ProcessAutoStart(int argc, char *argv[]);
void ProcessBufferInfo(int argc, char *argv[]);
void ProcessBlacklist(int argc, char *argv[]);
void ProcessChannel(int argc, char *argv[]);