mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 17:17:45 +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:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[]);
|
||||
|
||||
Reference in New Issue
Block a user