Add Hash MAC address get cli (#611)

- move Hash Mac address calculation from joiner.cpp to mac.cpp

- add hashmacaddr cli
This commit is contained in:
Shu Chen
2016-09-16 05:43:44 -07:00
committed by Jonathan Hui
parent c100be7ccb
commit 0d54e51ebe
8 changed files with 84 additions and 10 deletions
+22
View File
@@ -17,8 +17,10 @@ OpenThread test scripts use the CLI to execute test cases.
* [dataset](#dataset)
* [discover](#discover)
* [eidcache](#eidcache)
* [eui64](#eui64)
* [extaddr](#extaddr)
* [extpanid](#extpanid)
* [hashmacaddr](#hashmacaddr)
* [ifconfig](#ifconfig)
* [ipaddr](#ipaddr)
* [keysequence](#keysequence)
@@ -552,6 +554,16 @@ fdde:ad00:beef:0:110a:e041:8399:17cd 6000
Done
```
### eui64
Get the factory-assigned IEEE EUI-64.
```bash
> eui64
0615aae900124b00
Done
```
### extaddr
Get the IEEE 802.15.4 Extended Address.
@@ -591,6 +603,16 @@ Set the Thread Extended PAN ID value.
Done
```
### hashmacaddr
Get the HashMac address.
```bash
> hashmacaddr
e0b220eb7d8dda7e
Done
```
### ifconfig up
Bring up the IPv6 interface.
+17
View File
@@ -89,6 +89,7 @@ const struct Command Interpreter::sCommands[] =
#endif
{ "extaddr", &Interpreter::ProcessExtAddress },
{ "extpanid", &Interpreter::ProcessExtPanId },
{ "hashmacaddr", &Interpreter::ProcessHashMacAddress },
{ "ifconfig", &Interpreter::ProcessIfconfig },
{ "ipaddr", &Interpreter::ProcessIpAddr },
#if OPENTHREAD_ENABLE_JOINER
@@ -617,6 +618,22 @@ exit:
AppendResult(error);
}
void Interpreter::ProcessHashMacAddress(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
otExtAddress hashMacAddress;
VerifyOrExit(argc == 0, error = kThreadError_Parse);
otGetHashMacAddress(mInstance, &hashMacAddress);
OutputBytes(hashMacAddress.m8, OT_EXT_ADDRESS_SIZE);
sServer->OutputFormat("\r\n");
exit:
(void)argv;
AppendResult(error);
}
void Interpreter::ProcessIfconfig(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
+1
View File
@@ -159,6 +159,7 @@ private:
#endif
void ProcessExtAddress(int argc, char *argv[]);
void ProcessExtPanId(int argc, char *argv[]);
void ProcessHashMacAddress(int argc, char *argv[]);
void ProcessIfconfig(int argc, char *argv[]);
void ProcessIpAddr(int argc, char *argv[]);
ThreadError ProcessIpAddrAdd(int argc, char *argv[]);