From e8b34a46a7abd4aab96794d513f25eb4ff2c603a Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Wed, 7 Dec 2022 05:23:55 +0800 Subject: [PATCH] [cli] add `platform` command which returns current platform (#8444) Sometime we need to identify which platform we are currently using, especially in a test cases, where a unified interface is provided to control devices, the test cases have no idea about current platform. --- src/cli/README.md | 11 +++++++++++ src/cli/cli.cpp | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/cli/README.md b/src/cli/README.md index e616de7c2..988715adb 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -85,6 +85,7 @@ Done - [parentpriority](#parentpriority) - [partitionid](#partitionid) - [ping](#ping-async--i-source-ipaddr-size-count-interval-hoplimit-timeout) +- [platform](#platform) - [pollperiod](#pollperiod-pollperiod) - [preferrouterid](#preferrouterid-routerid) - [prefix](#prefix) @@ -2336,6 +2337,16 @@ Stop sending ICMPv6 Echo Requests. Done ``` +### platform + +Print the current platform + +```bash +> platform +NRF52840 +Done +``` + ### pollperiod Get the customized data poll period of sleepy end device (milliseconds). Only for certification test diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 130f347cf..a375bf6e0 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -5477,6 +5477,13 @@ exit: #endif // OPENTHREAD_CONFIG_PING_SENDER_ENABLE +template <> otError Interpreter::Process(Arg aArgs[]) +{ + OT_UNUSED_VARIABLE(aArgs); + OutputLine("%s", OPENTHREAD_CONFIG_PLATFORM_INFO); + return OT_ERROR_NONE; +} + template <> otError Interpreter::Process(Arg aArgs[]) { return ProcessGetSet(aArgs, otLinkGetPollPeriod, otLinkSetPollPeriod); @@ -7335,6 +7342,7 @@ otError Interpreter::ProcessCommand(Arg aArgs[]) #if OPENTHREAD_CONFIG_PING_SENDER_ENABLE CmdEntry("ping"), #endif + CmdEntry("platform"), CmdEntry("pollperiod"), #if OPENTHREAD_FTD CmdEntry("preferrouterid"),