From 9dd3f2005b9d46d70433b06d2cff036acf7860ad Mon Sep 17 00:00:00 2001 From: gavinmcgovern <81183035+gavinmcgovern@users.noreply.github.com> Date: Wed, 23 Aug 2023 10:48:27 -0700 Subject: [PATCH] [docs] cli cmd doc updates (locate - log level) (#9354) --- include/openthread/instance.h | 2 +- include/openthread/radio_stats.h | 3 ++ src/cli/cli.cpp | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/include/openthread/instance.h b/include/openthread/instance.h index 337a8b46c..d791a3fc1 100644 --- a/include/openthread/instance.h +++ b/include/openthread/instance.h @@ -53,7 +53,7 @@ extern "C" { * @note This number versions both OpenThread platform and user APIs. * */ -#define OPENTHREAD_API_VERSION (351) +#define OPENTHREAD_API_VERSION (352) /** * @addtogroup api-instance diff --git a/include/openthread/radio_stats.h b/include/openthread/radio_stats.h index f6877a902..2db394d72 100644 --- a/include/openthread/radio_stats.h +++ b/include/openthread/radio_stats.h @@ -47,6 +47,9 @@ extern "C" { /** * @addtogroup api-radio * + * @brief + * This module includes functions for radio statistics. + * * @{ * */ diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index dcc87e801..4b89a56a5 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -2743,6 +2743,17 @@ template <> otError Interpreter::Process(Arg aArgs[]) { otError error = OT_ERROR_NONE; + /** + * @cli log level + * @code + * log level + * 1 + * Done + * @endcode + * @par + * Get the log level. + * @sa otLoggingGetLevel + */ if (aArgs[0] == "level") { if (aArgs[1].IsEmpty()) @@ -2754,6 +2765,16 @@ template <> otError Interpreter::Process(Arg aArgs[]) #if OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE uint8_t level; + /** + * @cli log level (set) + * @code + * log level 4 + * Done + * @endcode + * @par api_copy + * #otLoggingSetLevel + * @cparam log level @ca{level} + */ VerifyOrExit(aArgs[2].IsEmpty(), error = OT_ERROR_INVALID_ARGS); SuccessOrExit(error = aArgs[1].ParseAsUint8(level)); error = otLoggingSetLevel(static_cast(level)); @@ -2763,6 +2784,18 @@ template <> otError Interpreter::Process(Arg aArgs[]) } } #if (OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART) && OPENTHREAD_POSIX + /** + * @cli log filename + * @par + * Specifies filename to capture `otPlatLog()` messages, useful when debugging + * automated test scripts on Linux when logging disrupts the automated test scripts. + * @par + * Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART` + * and `OPENTHREAD_POSIX`. + * @par api_copy + * #otPlatDebugUart_logfile + * @cparam log filename @ca{filename} + */ else if (aArgs[0] == "filename") { VerifyOrExit(!aArgs[1].IsEmpty(), error = OT_ERROR_INVALID_ARGS); @@ -4046,12 +4079,51 @@ template <> otError Interpreter::Process(Arg aArgs[]) otError error = OT_ERROR_INVALID_ARGS; otIp6Address anycastAddress; + /** + * @cli locate + * @code + * locate + * Idle + * Done + * @endcode + * @code + * locate fdde:ad00:beef:0:0:ff:fe00:fc10 + * @endcode + * @code + * locate + * In Progress + * Done + * @endcode + * @par + * Gets the current state (`In Progress` or `Idle`) of anycast locator. + * @par + * Available when `OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is enabled. + * @sa otThreadIsAnycastLocateInProgress + */ if (aArgs[0].IsEmpty()) { OutputLine(otThreadIsAnycastLocateInProgress(GetInstancePtr()) ? "In Progress" : "Idle"); ExitNow(error = OT_ERROR_NONE); } + /** + * @cli locate (set) + * @code + * locate fdde:ad00:beef:0:0:ff:fe00:fc00 + * fdde:ad00:beef:0:d9d3:9000:16b:d03b 0xc800 + * Done + * @endcode + * @par + * Locate the closest destination of an anycast address (i.e., find the + * destination's mesh local EID and RLOC16). + * @par + * The closest destination is determined based on the the current routing + * table and path costs within the Thread mesh. + * @par + * Available when `OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is enabled. + * @sa otThreadLocateAnycastDestination + * @cparam locate @ca{anycastaddr} + */ SuccessOrExit(error = aArgs[0].ParseAsIp6Address(anycastAddress)); SuccessOrExit(error = otThreadLocateAnycastDestination(GetInstancePtr(), &anycastAddress, HandleLocateResult, this));