diff --git a/src/cli/README.md b/src/cli/README.md index 5c3da43d9..7778fc619 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -95,7 +95,7 @@ Done - [promiscuous](#promiscuous) - [pskc](#pskc) - [pskcref](#pskcref) -- [radio](#radio-stats) +- [radio](#radio-enable) - [radiofilter](#radiofilter) - [rcp](#rcp) - [region](#region) @@ -2787,6 +2787,24 @@ Disable radio promiscuous operation. Done ``` +### radio enable + +Enable radio. + +```bash +> radio enable +Done +``` + +### radio disable + +Disable radio. + +```bash +> radio disable +Done +``` + ### radio stats `OPENTHREAD_CONFIG_RADIO_STATS_ENABLE` is required. This feature is only available on FTD and MTD. diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 0167128bf..6c0d6bab5 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -5856,11 +5856,31 @@ void Interpreter::OutputRadioStatsTime(const char *aTimeName, uint64_t aTimeUs, OutputLine("%s Time: %lu.%06lus (%lu.%02lu%%)", aTimeName, UsToSInt(aTimeUs), UsToSDec(aTimeUs), ToUlong(timePercentInt), ToUlong(timePercentDec)); } +#endif // OPENTHREAD_CONFIG_RADIO_STATS_ENABLE template <> otError Interpreter::Process(Arg aArgs[]) { otError error = OT_ERROR_NONE; + /** + * @cli radio (enable,disable) + * @code + * radio enable + * Done + * @endcode + * @code + * radio disable + * Done + * @endcode + * @cparam radio [@ca{enable|disable}] + * @sa otLinkSetEnabled + * @par + * Enables or disables the radio. + */ + if (ProcessEnableDisable(aArgs, otLinkSetEnabled) == OT_ERROR_NONE) + { + } +#if OPENTHREAD_CONFIG_RADIO_STATS_ENABLE /** * @cli radio stats * @code @@ -5876,7 +5896,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) * @par api_copy * #otRadioTimeStatsGet */ - if (aArgs[0] == "stats") + else if (aArgs[0] == "stats") { if (aArgs[1].IsEmpty()) { @@ -5916,6 +5936,7 @@ template <> otError Interpreter::Process(Arg aArgs[]) otRadioTimeStatsReset(GetInstancePtr()); } } +#endif // OPENTHREAD_CONFIG_RADIO_STATS_ENABLE else { error = OT_ERROR_INVALID_COMMAND; @@ -5923,7 +5944,6 @@ template <> otError Interpreter::Process(Arg aArgs[]) return error; } -#endif // OPENTHREAD_CONFIG_RADIO_STATS_ENABLE template <> otError Interpreter::Process(Arg aArgs[]) {