mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[channel-monitor] allow configuring startup behavior (#11164)
Allow the Channel Monitor feature to be compiled in but optionally be disabled by default, allowing it to be started on-demand.
This commit is contained in:
@@ -183,6 +183,7 @@ ot_option(OT_BORDER_ROUTING_COUNTERS OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE "b
|
||||
ot_option(OT_CHANNEL_MANAGER OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE "channel manager")
|
||||
ot_option(OT_CHANNEL_MANAGER_CSL OPENTHREAD_CONFIG_CHANNEL_MANAGER_CSL_CHANNEL_SELECT_ENABLE "channel manager for csl channel")
|
||||
ot_option(OT_CHANNEL_MONITOR OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE "channel monitor")
|
||||
ot_option(OT_CHANNEL_MONITOR_AUTO_START OPENTHREAD_CONFIG_CHANNEL_MONITOR_AUTO_START_ENABLE "start channel monitor with interface")
|
||||
ot_option(OT_COAP OPENTHREAD_CONFIG_COAP_API_ENABLE "coap api")
|
||||
ot_option(OT_COAP_BLOCK OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE "coap block-wise transfer (RFC7959)")
|
||||
ot_option(OT_COAP_OBSERVE OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE "coap observe (RFC7641)")
|
||||
|
||||
@@ -52,6 +52,20 @@
|
||||
#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_AUTO_START_ENABLE
|
||||
*
|
||||
* Define to 0 to require the Channel Monitor to be manually started.
|
||||
*
|
||||
* If enabled, the Channel Monitor will start and stop automatically when the Thread network interface is brought up
|
||||
* and down.
|
||||
*
|
||||
* Applicable only if Channel Monitoring feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is set).
|
||||
*/
|
||||
#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_AUTO_START_ENABLE
|
||||
#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_AUTO_START_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_INTERVAL
|
||||
*
|
||||
|
||||
@@ -49,7 +49,7 @@ void ThreadNetif::Up(void)
|
||||
|
||||
// Enable the MAC just in case it was disabled while the Interface was down.
|
||||
Get<Mac::Mac>().SetEnabled(true);
|
||||
#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
|
||||
#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE && OPENTHREAD_CONFIG_CHANNEL_MONITOR_AUTO_START_ENABLE
|
||||
IgnoreError(Get<Utils::ChannelMonitor>().Start());
|
||||
#endif
|
||||
Get<MeshForwarder>().Start();
|
||||
@@ -96,7 +96,7 @@ void ThreadNetif::Down(void)
|
||||
|
||||
mIsUp = false;
|
||||
Get<MeshForwarder>().Stop();
|
||||
#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE
|
||||
#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE && OPENTHREAD_CONFIG_CHANNEL_MONITOR_AUTO_START_ENABLE
|
||||
IgnoreError(Get<Utils::ChannelMonitor>().Stop());
|
||||
#endif
|
||||
Get<Notifier>().Signal(kEventThreadNetifStateChanged);
|
||||
|
||||
Reference in New Issue
Block a user