diff --git a/src/cli/README.md b/src/cli/README.md index a8969c4ae..21440a3aa 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -1272,6 +1272,15 @@ Send an ICMPv6 Echo Request. 16 bytes from fdde:ad00:beef:0:558:f56b:d688:799: icmp_seq=1 hlim=64 time=28ms ``` +### ping stop + +Stop sending ICMPv6 Echo Requests. + +```bash +> ping stop +Done +``` + ### pollperiod Get the customized data poll period of sleepy end device (seconds). Only for certification test diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 98c0da094..45a5fae74 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -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));