Add ping stop command. (#1925)

This commit is contained in:
Łukasz Duda
2017-06-22 09:04:24 +02:00
committed by Jonathan Hui
parent 844482a52b
commit 70775bdb9a
2 changed files with 24 additions and 0 deletions
+15
View File
@@ -1623,6 +1623,21 @@ void Interpreter::ProcessPing(int argc, char *argv[])
long value;
VerifyOrExit(argc > 0, error = OT_ERROR_PARSE);
if (strcmp(argv[0], "stop") == 0)
{
if (!mPingTimer.IsRunning())
{
error = OT_ERROR_INVALID_STATE;
}
else
{
mPingTimer.Stop();
}
ExitNow();
}
VerifyOrExit(!mPingTimer.IsRunning(), error = OT_ERROR_BUSY);
memset(&mMessageInfo, 0, sizeof(mMessageInfo));