Add API to retrieve EID cache diag information. (#229)

This commit is contained in:
Jonathan Hui
2016-07-01 13:27:50 -07:00
committed by GitHub
parent 51e5609456
commit 4b487f1aa6
8 changed files with 108 additions and 9 deletions
+12
View File
@@ -12,6 +12,7 @@ OpenThread test scripts use the CLI to execute test cases.
* [childtimeout](#childtimeout)
* [contextreusedelay](#contextreusedelay)
* [counter](#counter)
* [eidcache](#eidcache)
* [extaddr](#extaddr)
* [extpanid](#extpanid)
* [ipaddr](#ipaddr)
@@ -166,6 +167,17 @@ RxTotal: 11
RxErrOther: 0
```
### eidcache
Print the EID-to-RLOC cache entries.
```bash
> eidcache
fdde:ad00:beef:0:bb1:ebd6:ad10:f33 ac00
fdde:ad00:beef:0:110a:e041:8399:17cd 6000
Done
```
### extaddr
Get the IEEE 802.15.4 Extended Address.
+30
View File
@@ -55,6 +55,7 @@ const struct Command Interpreter::sCommands[] =
{ "childtimeout", &ProcessChildTimeout },
{ "contextreusedelay", &ProcessContextIdReuseDelay },
{ "counter", &ProcessCounters },
{ "eidcache", &ProcessEidCache },
{ "extaddr", &ProcessExtAddress },
{ "extpanid", &ProcessExtPanId },
{ "ipaddr", &ProcessIpAddr },
@@ -346,6 +347,35 @@ void Interpreter::ProcessCounters(int argc, char *argv[])
}
}
void Interpreter::ProcessEidCache(int argc, char *argv[])
{
otEidCacheEntry entry;
for (int i = 0; ; i++)
{
SuccessOrExit(otGetEidCacheEntry(i, &entry));
if (entry.mValid == false)
{
continue;
}
sServer->OutputFormat("%x:%x:%x:%x:%x:%x:%x:%x %04x\r\n",
HostSwap16(entry.mTarget.mFields.m16[0]),
HostSwap16(entry.mTarget.mFields.m16[1]),
HostSwap16(entry.mTarget.mFields.m16[2]),
HostSwap16(entry.mTarget.mFields.m16[3]),
HostSwap16(entry.mTarget.mFields.m16[4]),
HostSwap16(entry.mTarget.mFields.m16[5]),
HostSwap16(entry.mTarget.mFields.m16[6]),
HostSwap16(entry.mTarget.mFields.m16[7]),
entry.mRloc16);
}
exit:
AppendResult(kThreadError_None);
}
void Interpreter::ProcessExtAddress(int argc, char *argv[])
{
OutputBytes(otGetExtendedAddress(), OT_EXT_ADDRESS_SIZE);
+1
View File
@@ -93,6 +93,7 @@ private:
static void ProcessChildTimeout(int argc, char *argv[]);
static void ProcessContextIdReuseDelay(int argc, char *argv[]);
static void ProcessCounters(int argc, char *argv[]);
static void ProcessEidCache(int argc, char *argv[]);
static void ProcessExtAddress(int argc, char *argv[]);
static void ProcessExtPanId(int argc, char *argv[]);
static void ProcessIpAddr(int argc, char *argv[]);