mirror of
https://github.com/espressif/openthread.git
synced 2026-10-04 23:07:37 +00:00
Make all devices could receive and response to MGMT_ACTIVE_GET.req and MGMT_PENDING_GET.req (#917)
* Add Coap Resources ACTIVE_GET and PENDING_GET to all devices * Add 'address' parameter to dataset mgmtgetcommand CLI * Use the specified destination address when sending MGMT_ACTIVR_GET.req and MGMT_PENDING_GET.req, default to use Leader ALOC if the destination is not specified * THCI update to take the destination address as a parameter in mgmtget API
This commit is contained in:
+4
-4
@@ -531,12 +531,12 @@ Set mesh local prefix.
|
||||
Done
|
||||
```
|
||||
|
||||
### dataset mgmtgetcommand active \[TLVs list\] \[binary\]
|
||||
### dataset mgmtgetcommand active \[address \<destination\>\] \[TLVs list\] \[binary\]
|
||||
|
||||
Send MGMT_ACTIVE_GET.
|
||||
|
||||
```bash
|
||||
> dataset mgmtgetcommand active activetimestamp 123 binary 0001
|
||||
> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp 123 binary 0001
|
||||
Done
|
||||
```
|
||||
|
||||
@@ -549,12 +549,12 @@ Send MGMT_ACTIVE_SET.
|
||||
Done
|
||||
```
|
||||
|
||||
### dataset mgmtgetcommand pending \[TLVs list\] \[binary\]
|
||||
### dataset mgmtgetcommand pending \[address \<destination\>\] \[TLVs list\] \[binary\]
|
||||
|
||||
Send MGMT_PENDING_GET.
|
||||
|
||||
```bash
|
||||
> dataset mgmtgetcommand pending activetimestamp binary 0001
|
||||
> dataset mgmtgetcommand pending address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp binary 0001
|
||||
Done
|
||||
```
|
||||
|
||||
|
||||
+12
-2
@@ -574,6 +574,8 @@ ThreadError Dataset::ProcessMgmtGetCommand(otInstance *aInstance, int argc, char
|
||||
uint8_t tlvs[32];
|
||||
long value;
|
||||
int length = 0;
|
||||
bool destAddrSpecified = false;
|
||||
otIp6Address address;
|
||||
|
||||
VerifyOrExit(argc > 0, error = kThreadError_Parse);
|
||||
|
||||
@@ -628,6 +630,12 @@ ThreadError Dataset::ProcessMgmtGetCommand(otInstance *aInstance, int argc, char
|
||||
error = kThreadError_Parse);
|
||||
length += value;
|
||||
}
|
||||
else if (strcmp(argv[index], "address") == 0)
|
||||
{
|
||||
VerifyOrExit(index < argc, error = kThreadError_Parse);
|
||||
SuccessOrExit(error = otIp6AddressFromString(argv[++index], &address));
|
||||
destAddrSpecified = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExitNow(error = kThreadError_Parse);
|
||||
@@ -636,11 +644,13 @@ ThreadError Dataset::ProcessMgmtGetCommand(otInstance *aInstance, int argc, char
|
||||
|
||||
if (strcmp(argv[0], "active") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otSendActiveGet(aInstance, tlvs, static_cast<uint8_t>(length)));
|
||||
SuccessOrExit(error = otSendActiveGet(aInstance, tlvs, static_cast<uint8_t>(length),
|
||||
destAddrSpecified ? &address : NULL));
|
||||
}
|
||||
else if (strcmp(argv[0], "pending") == 0)
|
||||
{
|
||||
SuccessOrExit(error = otSendPendingGet(aInstance, tlvs, static_cast<uint8_t>(length)));
|
||||
SuccessOrExit(error = otSendPendingGet(aInstance, tlvs, static_cast<uint8_t>(length),
|
||||
destAddrSpecified ? &address : NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user