mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 21:30:24 +00:00
Implement PAN ID Query/Conflict. (#556)
This commit is contained in:
@@ -1860,11 +1860,42 @@ void Interpreter::ProcessCommissioner(int argc, char *argv[])
|
||||
{
|
||||
otCommissionerStop(mInstance);
|
||||
}
|
||||
else if (strcmp(argv[0], "panid") == 0)
|
||||
{
|
||||
long panid;
|
||||
long mask;
|
||||
otIp6Address address;
|
||||
|
||||
VerifyOrExit(argc > 3, error = kThreadError_Parse);
|
||||
|
||||
// panid
|
||||
SuccessOrExit(error = ParseLong(argv[1], panid));
|
||||
|
||||
// mask
|
||||
SuccessOrExit(error = ParseLong(argv[2], mask));
|
||||
|
||||
// destination
|
||||
SuccessOrExit(error = otIp6AddressFromString(argv[3], &address));
|
||||
|
||||
SuccessOrExit(error = otCommissionerPanIdQuery(mInstance, static_cast<uint16_t>(panid),
|
||||
static_cast<uint32_t>(mask),
|
||||
&address, Interpreter::s_HandlePanIdConflict, this));
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
void Interpreter::s_HandlePanIdConflict(uint16_t aPanId, uint32_t aChannelMask, void *aContext)
|
||||
{
|
||||
static_cast<Interpreter *>(aContext)->HandlePanIdConflict(aPanId, aChannelMask);
|
||||
}
|
||||
|
||||
void Interpreter::HandlePanIdConflict(uint16_t aPanId, uint32_t aChannelMask)
|
||||
{
|
||||
sServer->OutputFormat("Conflict: %04x, %08x\r\n", aPanId, aChannelMask);
|
||||
}
|
||||
|
||||
#endif // OPENTHREAD_ENABLE_COMMISSIONER
|
||||
|
||||
#if OPENTHREAD_ENABLE_JOINER
|
||||
|
||||
Reference in New Issue
Block a user