Add Joiner UDP Port feature (#676)

* Add Joiner UDP Port feature

  - Add 'joinerport' cli for configuration

  - Include Joiner UDP Port TLV in discovery response message

  - Joiner use it as destination port during commissioning process
This commit is contained in:
Shu Chen
2016-09-25 20:50:28 -07:00
committed by Jonathan Hui
parent dc2dcbd282
commit d71939d331
11 changed files with 119 additions and 20 deletions
+20
View File
@@ -95,6 +95,7 @@ const struct Command Interpreter::sCommands[] =
#if OPENTHREAD_ENABLE_JOINER
{ "joiner", &Interpreter::ProcessJoiner },
#endif
{ "joinerport", &Interpreter::ProcessJoinerPort },
{ "keysequence", &Interpreter::ProcessKeySequence },
{ "leaderdata", &Interpreter::ProcessLeaderData },
{ "leaderpartitionid", &Interpreter::ProcessLeaderPartitionId },
@@ -2206,6 +2207,25 @@ exit:
#endif // OPENTHREAD_ENABLE_JOINER
void Interpreter::ProcessJoinerPort(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
long value;
if (argc == 0)
{
sServer->OutputFormat("%d\r\n", otGetJoinerUdpPort(mInstance));
}
else
{
SuccessOrExit(error = ParseLong(argv[0], value));
error = otSetJoinerUdpPort(mInstance, static_cast<uint16_t>(value));
}
exit:
AppendResult(error);
}
void Interpreter::ProcessWhitelist(int argc, char *argv[])
{
ThreadError error = kThreadError_None;