mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 05:37:46 +00:00
[link-metrics] add cli command to show link metrics manager state (#10046)
This commit is contained in:
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (408)
|
||||
#define OPENTHREAD_API_VERSION (409)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -247,6 +247,17 @@ otError otLinkMetricsSendLinkProbe(otInstance *aInstance,
|
||||
uint8_t aSeriesId,
|
||||
uint8_t aLength);
|
||||
|
||||
/**
|
||||
* If Link Metrics Manager is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval TRUE Link Metrics Manager is enabled.
|
||||
* @retval FALSE Link Metrics Manager is not enabled.
|
||||
*
|
||||
*/
|
||||
bool otLinkMetricsManagerIsEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable or disable Link Metrics Manager.
|
||||
*
|
||||
|
||||
+1
-4
@@ -3812,8 +3812,6 @@ template <> otError Interpreter::Process<Cmd("linkmetricsmgr")>(Arg aArgs[])
|
||||
{
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
VerifyOrExit(!aArgs[0].IsEmpty(), error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
/**
|
||||
* @cli linkmetricsmgr (enable,disable)
|
||||
* @code
|
||||
@@ -3829,7 +3827,7 @@ template <> otError Interpreter::Process<Cmd("linkmetricsmgr")>(Arg aArgs[])
|
||||
* #otLinkMetricsManagerSetEnabled
|
||||
*
|
||||
*/
|
||||
if (ProcessEnableDisable(aArgs, otLinkMetricsManagerSetEnabled) == OT_ERROR_NONE)
|
||||
if (ProcessEnableDisable(aArgs, otLinkMetricsManagerIsEnabled, otLinkMetricsManagerSetEnabled) == OT_ERROR_NONE)
|
||||
{
|
||||
}
|
||||
/**
|
||||
@@ -3868,7 +3866,6 @@ template <> otError Interpreter::Process<Cmd("linkmetricsmgr")>(Arg aArgs[])
|
||||
error = OT_ERROR_INVALID_COMMAND;
|
||||
}
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE
|
||||
|
||||
@@ -99,6 +99,11 @@ otError otLinkMetricsSendLinkProbe(otInstance *aInstance,
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_LINK_METRICS_MANAGER_ENABLE
|
||||
bool otLinkMetricsManagerIsEnabled(otInstance *aInstance)
|
||||
{
|
||||
return AsCoreType(aInstance).Get<Utils::LinkMetricsManager>().IsEnabled();
|
||||
}
|
||||
|
||||
void otLinkMetricsManagerSetEnabled(otInstance *aInstance, bool aEnable)
|
||||
{
|
||||
AsCoreType(aInstance).Get<Utils::LinkMetricsManager>().SetEnabled(aEnable);
|
||||
|
||||
@@ -151,6 +151,15 @@ public:
|
||||
*/
|
||||
explicit LinkMetricsManager(Instance &aInstance);
|
||||
|
||||
/**
|
||||
* Is the LinkMetricsManager feature enabled.
|
||||
*
|
||||
* @retval TRUE Link Metrics Manager is enabled.
|
||||
* @retval FALSE Link Metrics Manager is not enabled.
|
||||
*
|
||||
*/
|
||||
bool IsEnabled(void) { return mEnabled; }
|
||||
|
||||
/**
|
||||
* Enable/Disable the LinkMetricsManager feature.
|
||||
*
|
||||
|
||||
@@ -35,6 +35,9 @@ setup_two_nodes
|
||||
switch_node 1
|
||||
send "linkmetricsmgr enable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr\n"
|
||||
expect_line "Enabled"
|
||||
expect_line "Done"
|
||||
|
||||
sleep 10
|
||||
|
||||
@@ -52,6 +55,9 @@ sleep 5
|
||||
|
||||
send "linkmetricsmgr disable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr\n"
|
||||
expect_line "Disabled"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr show\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr xxx\n"
|
||||
@@ -64,6 +70,9 @@ send "linkmetricsmgr enable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr enable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr\n"
|
||||
expect_line "Enabled"
|
||||
expect_line "Done"
|
||||
|
||||
send "ping $addr\n"
|
||||
expect "16 bytes from $addr: icmp_seq="
|
||||
@@ -84,6 +93,9 @@ send "linkmetricsmgr disable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr disable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr\n"
|
||||
expect_line "Disabled"
|
||||
expect_line "Done"
|
||||
|
||||
send "ping $addr\n"
|
||||
expect "16 bytes from $addr: icmp_seq="
|
||||
@@ -103,6 +115,9 @@ send "linkmetricsmgr disable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr enable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr\n"
|
||||
expect_line "Enabled"
|
||||
expect_line "Done"
|
||||
|
||||
send "ping $addr\n"
|
||||
expect "16 bytes from $addr: icmp_seq="
|
||||
@@ -122,6 +137,9 @@ send "linkmetricsmgr enable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr disable\n"
|
||||
expect_line "Done"
|
||||
send "linkmetricsmgr\n"
|
||||
expect_line "Disabled"
|
||||
expect_line "Done"
|
||||
|
||||
send "ping $addr\n"
|
||||
expect "16 bytes from $addr: icmp_seq="
|
||||
|
||||
Reference in New Issue
Block a user