mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 21:30:24 +00:00
Support network diagnostic feature. (#652)
* support network diagnostic * add network diagnostic THCI implementation
This commit is contained in:
@@ -103,6 +103,7 @@ const struct Command Interpreter::sCommands[] =
|
||||
{ "masterkey", &Interpreter::ProcessMasterKey },
|
||||
{ "mode", &Interpreter::ProcessMode },
|
||||
{ "netdataregister", &Interpreter::ProcessNetworkDataRegister },
|
||||
{ "networkdiagnostic", &Interpreter::ProcessNetworkDiagnostic },
|
||||
{ "networkidtimeout", &Interpreter::ProcessNetworkIdTimeout },
|
||||
{ "networkname", &Interpreter::ProcessNetworkName },
|
||||
{ "panid", &Interpreter::ProcessPanId },
|
||||
@@ -2449,5 +2450,38 @@ exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void Interpreter::ProcessNetworkDiagnostic(int argc, char *argv[])
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
struct otIp6Address address;
|
||||
uint8_t index = 2;
|
||||
uint8_t tlvTypes[OT_NUM_NETDIAG_TLV_TYPES];
|
||||
uint8_t count = 0;
|
||||
|
||||
VerifyOrExit(argc > 1 + 1, error = kThreadError_Parse);
|
||||
|
||||
SuccessOrExit(error = otIp6AddressFromString(argv[1], &address));
|
||||
|
||||
while (index < argc && count < sizeof(tlvTypes))
|
||||
{
|
||||
long value;
|
||||
SuccessOrExit(error = ParseLong(argv[index], value));
|
||||
tlvTypes[count++] = static_cast<uint8_t>(value);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (strcmp(argv[0], "get") == 0)
|
||||
{
|
||||
otSendDiagnosticGet(mInstance, &address, tlvTypes, count);
|
||||
}
|
||||
else if (strcmp(argv[0], "reset") == 0)
|
||||
{
|
||||
otSendDiagnosticReset(mInstance, &address, tlvTypes, count);
|
||||
}
|
||||
|
||||
exit:
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
} // namespace Cli
|
||||
} // namespace Thread
|
||||
|
||||
Reference in New Issue
Block a user