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 20:43:44 +08:00
committed by Jonathan Hui
parent c100be7ccb
commit 0d54e51ebe
8 changed files with 84 additions and 10 deletions
+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;