Commissioner joiner list. (#729)

This commit is contained in:
Jonathan Hui
2016-10-03 08:54:54 -07:00
committed by GitHub
parent 95d2e8cdec
commit cb04fe8391
12 changed files with 343 additions and 40 deletions
+34 -3
View File
@@ -213,17 +213,16 @@ Set the Thread Child Timeout value.
Done
```
### commissioner start \<psdk\> \<provisioningUrl\>
### commissioner start \<provisioningUrl\>
Start the Commissioner role.
* pskd: Pre-Shared Key for the Joiner.
* provisioningUrl: Provisioning URL for the Joiner (optional).
This command will cause the device to send LEAD_PET and LEAD_KA messages.
```bash
> commissioner start PSK
> commissioner start
Done
```
@@ -238,6 +237,38 @@ This command will cause the device to send LEAD_KA[Reject] messages.
Done
```
### commissioner joiner add \<hashmacaddr\> \<psdk\>
Add a Joiner entry.
* hashmacaddr: The Extended Address of the Joiner or '*' to match any Joiner.
* pskd: Pre-Shared Key for the Joiner.
```bash
> commissioner joiner add d45e64fa83f81cf7 PSK
Done
```
### commissioner joiner remove \<hashmacaddr\>
Remove a Joiner entry.
* hashmacaddr: The Extended Address of the Joiner or '*' to match any Joiner.
```bash
> commissioner joiner remove d45e64fa83f81cf7
Done
```
### commissioner provisioningurl \<provisioningUrl\>
Set the Provisioning URL.
```bash
> commissioner provisioningurl http://github.com/openthread/openthread
Done
```
### commissioner energy \<mask\> \<count\> \<period\> \<scanDuration\> \<destination\>
Send a MGMT_ED_SCAN message.
+33 -5
View File
@@ -1992,14 +1992,42 @@ void Interpreter::ProcessCommissioner(int argc, char *argv[])
if (strcmp(argv[0], "start") == 0)
{
const char *provisioningUrl;
VerifyOrExit(argc > 1, error = kThreadError_Parse);
provisioningUrl = argc > 2 ? argv[2] : NULL;
otCommissionerStart(mInstance, argv[1], provisioningUrl);
SuccessOrExit(error = otCommissionerStart(mInstance));
}
else if (strcmp(argv[0], "stop") == 0)
{
otCommissionerStop(mInstance);
SuccessOrExit(error = otCommissionerStop(mInstance));
}
else if (strcmp(argv[0], "joiner") == 0)
{
otExtAddress addr;
const otExtAddress *addrPtr;
VerifyOrExit(argc > 2, error = kThreadError_Parse);
if (strcmp(argv[2], "*") == 0)
{
addrPtr = NULL;
}
else
{
VerifyOrExit(Hex2Bin(argv[2], addr.m8, sizeof(addr)) == sizeof(addr), error = kThreadError_Parse);
addrPtr = &addr;
}
if (strcmp(argv[1], "add") == 0)
{
VerifyOrExit(argc > 3, error = kThreadError_Parse);
SuccessOrExit(error = otCommissionerAddJoiner(mInstance, addrPtr, argv[3]));
}
else if (strcmp(argv[1], "remove") == 0)
{
SuccessOrExit(error = otCommissionerRemoveJoiner(mInstance, addrPtr));
}
}
else if (strcmp(argv[0], "provisioningurl") == 0)
{
SuccessOrExit(error = otCommissionerSetProvisioningUrl(mInstance, (argc > 1) ? argv[1] : NULL));
}
else if (strcmp(argv[0], "energy") == 0)
{