[cli] expose otLinkSetEnabled (#9193)

This commit is contained in:
Eduardo Montoya
2023-06-21 04:33:49 +02:00
committed by GitHub
parent 88cc6c8ef3
commit e1bfbe80a3
2 changed files with 41 additions and 3 deletions
+19 -1
View File
@@ -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.
+22 -2
View File
@@ -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<Cmd("radio")>(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<Cmd("radio")>(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<Cmd("radio")>(Arg aArgs[])
otRadioTimeStatsReset(GetInstancePtr());
}
}
#endif // OPENTHREAD_CONFIG_RADIO_STATS_ENABLE
else
{
error = OT_ERROR_INVALID_COMMAND;
@@ -5923,7 +5944,6 @@ template <> otError Interpreter::Process<Cmd("radio")>(Arg aArgs[])
return error;
}
#endif // OPENTHREAD_CONFIG_RADIO_STATS_ENABLE
template <> otError Interpreter::Process<Cmd("rcp")>(Arg aArgs[])
{