[meshcop] use IEEE EUI-64 rather than Joiner ID on user input (#2311)

This commit is contained in:
Jonathan Hui
2017-11-07 09:41:46 -08:00
committed by GitHub
parent 27a30c7209
commit 74b3160f9d
40 changed files with 337 additions and 219 deletions
@@ -1146,23 +1146,6 @@ OTNODEAPI uint16_t OTCALL otNodeGetAddr16(otNode* aNode)
return result;
}
OTNODEAPI const char* OTCALL otNodeGetHashMacAddress(otNode* aNode)
{
otLogFuncEntryMsg("[%d]", aNode->mId);
otExtAddress aHashMacAddress = {};
otLinkGetJoinerId(aNode->mInstance, &aHashMacAddress);
char* str = (char*)malloc(18);
if (str != nullptr)
{
aNode->mMemoryToFree.push_back(str);
for (int i = 0; i < 8; i++)
sprintf_s(str + i * 2, 18 - (2 * i), "%02x", aHashMacAddress.m8[i]);
printf("%d: hashmacaddr\r\n%s\r\n", aNode->mId, str);
}
otLogFuncExit();
return str;
}
OTNODEAPI const char* OTCALL otNodeGetAddr64(otNode* aNode)
{
otLogFuncEntryMsg("[%d]", aNode->mId);
@@ -1180,6 +1163,40 @@ OTNODEAPI const char* OTCALL otNodeGetAddr64(otNode* aNode)
return str;
}
OTNODEAPI const char* OTCALL otNodeGetEui64(otNode* aNode)
{
otLogFuncEntryMsg("[%d]", aNode->mId);
otExtAddress aEui64 = {};
otLinkGetFactoryAssignedIeeeEui64(aNode->mInstance, &aEui64);
char* str = (char*)malloc(18);
if (str != nullptr)
{
aNode->mMemoryToFree.push_back(str);
for (int i = 0; i < 8; i++)
sprintf_s(str + i * 2, 18 - (2 * i), "%02x", aEui64.m8[i]);
printf("%d: eui64\r\n%s\r\n", aNode->mId, str);
}
otLogFuncExit();
return str;
}
OTNODEAPI const char* OTCALL otNodeGetJoinerId(otNode* aNode)
{
otLogFuncEntryMsg("[%d]", aNode->mId);
otExtAddress aJoinerId = {};
otJoinerGetId(aNode->mInstance, &aJoinerId);
char* str = (char*)malloc(18);
if (str != nullptr)
{
aNode->mMemoryToFree.push_back(str);
for (int i = 0; i < 8; i++)
sprintf_s(str + i * 2, 18 - (2 * i), "%02x", aJoinerId.m8[i]);
printf("%d: joinerid\r\n%s\r\n", aNode->mId, str);
}
otLogFuncExit();
return str;
}
OTNODEAPI int32_t OTCALL otNodeSetChannel(otNode* aNode, uint8_t aChannel)
{
otLogFuncEntryMsg("[%d]", aNode->mId);