mirror of
https://github.com/espressif/openthread.git
synced 2026-08-30 05:49:54 +00:00
Cli: update 'keysequence' to make keyswithguardtime configurable (#815)
* Cli: update 'keysequence' to make keyswithguardtime configurable
This commit is contained in:
+26
-6
@@ -804,22 +804,42 @@ Stop the Joiner role.
|
||||
Done
|
||||
```
|
||||
|
||||
### keysequence
|
||||
### keysequence counter
|
||||
|
||||
Get the Thread Key Sequence.
|
||||
Get the Thread Key Sequence Counter.
|
||||
|
||||
```bash
|
||||
> keysequence
|
||||
> keysequence counter
|
||||
10
|
||||
Done
|
||||
```
|
||||
|
||||
### keysequence \<keysequence\>
|
||||
### keysequence counter \<counter\>
|
||||
|
||||
Set the Thread Key Sequence.
|
||||
Set the Thread Key Sequence Counter.
|
||||
|
||||
```bash
|
||||
> keysequence 10
|
||||
> keysequence counter 10
|
||||
Done
|
||||
```
|
||||
|
||||
### keysequence guardtime
|
||||
|
||||
Get Thread Key Switch Guard Time (in hours)
|
||||
|
||||
```bash
|
||||
> keysequence guardtime
|
||||
0
|
||||
Done
|
||||
```
|
||||
|
||||
### keysequence guardtime \<guardtime\>
|
||||
|
||||
Set Thread Key Switch Guard Time (in hours)
|
||||
0 means Thread Key Switch imediately if key index match
|
||||
|
||||
```bash
|
||||
> keysequence guardtime 0
|
||||
Done
|
||||
```
|
||||
|
||||
|
||||
+22
-5
@@ -765,14 +765,31 @@ void Interpreter::ProcessKeySequence(int argc, char *argv[])
|
||||
ThreadError error = kThreadError_None;
|
||||
long value;
|
||||
|
||||
if (argc == 0)
|
||||
VerifyOrExit(argc == 1 || argc == 2, error = kThreadError_Parse);
|
||||
|
||||
if (strcmp(argv[0], "counter") == 0)
|
||||
{
|
||||
sServer->OutputFormat("%d\r\n", otGetKeySequenceCounter(mInstance));
|
||||
if (argc == 1)
|
||||
{
|
||||
sServer->OutputFormat("%d\r\n", otGetKeySequenceCounter(mInstance));
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[1], value));
|
||||
otSetKeySequenceCounter(mInstance, static_cast<uint32_t>(value));
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (strcmp(argv[0], "guardtime") == 0)
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[0], value));
|
||||
otSetKeySequenceCounter(mInstance, static_cast<uint32_t>(value));
|
||||
if (argc == 1)
|
||||
{
|
||||
sServer->OutputFormat("%d\r\n", otGetKeySwitchGuardTime(mInstance));
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[1], value));
|
||||
otSetKeySwitchGuardTime(mInstance, static_cast<uint32_t>(value));
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
Reference in New Issue
Block a user