Dynamic Max Children (#462)

* Add support for dynamically adjusting the maximum number of allowed children.
* Update cli to support max number of children.
This commit is contained in:
Nick Banks
2016-08-26 08:42:06 -07:00
committed by Jonathan Hui
parent 3d04344cc9
commit 62f3188081
8 changed files with 123 additions and 17 deletions
+20
View File
@@ -10,6 +10,7 @@ OpenThread test scripts use the CLI to execute test cases.
* [channel](#channel)
* [blacklist](#blacklist)
* [child](#child)
* [childmax](#childmax)
* [childtimeout](#childtimeout)
* [contextreusedelay](#contextreusedelay)
* [counter](#counter)
@@ -154,6 +155,25 @@ RSSI: -20
Done
```
### childmax
Get the Thread maximum number of allowed children.
```bash
> childmax
5
Done
```
### childmax \<count\>
Set the Thread maximum number of allowed children.
```bash
> childmax 2
Done
```
### childtimeout
Get the Thread Child Timeout value.
+20
View File
@@ -57,6 +57,7 @@ const struct Command Interpreter::sCommands[] =
{ "blacklist", &ProcessBlacklist },
{ "channel", &ProcessChannel },
{ "child", &ProcessChild },
{ "childmax", &ProcessChildMax },
{ "childtimeout", &ProcessChildTimeout },
{ "contextreusedelay", &ProcessContextIdReuseDelay },
{ "counter", &ProcessCounters },
@@ -380,6 +381,25 @@ exit:
AppendResult(error);
}
void Interpreter::ProcessChildMax(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
long value;
if (argc == 0)
{
sServer->OutputFormat("%d\r\n", otGetMaxAllowedChildren());
}
else
{
SuccessOrExit(error = ParseLong(argv[0], value));
SuccessOrExit(error = otSetMaxAllowedChildren(static_cast<uint8_t>(value)));
}
exit:
AppendResult(error);
}
void Interpreter::ProcessChildTimeout(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
+1
View File
@@ -134,6 +134,7 @@ private:
static void ProcessChannel(int argc, char *argv[]);
static void ProcessChild(int argc, char *argv[]);
static void ProcessChildTimeout(int argc, char *argv[]);
static void ProcessChildMax(int argc, char *argv[]);
static void ProcessContextIdReuseDelay(int argc, char *argv[]);
static void ProcessCounters(int argc, char *argv[]);
static void ProcessDataset(int argc, char *argv[]);