From 01ebc18f97687dc5fbe57db04c11488b0ef3570a Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 12 Jul 2019 15:21:49 -0700 Subject: [PATCH] [config] channel monitor (#4020) --- .travis/script.sh | 10 +- configure.ac | 33 ------- examples/common-switches.mk | 2 +- include/openthread-config-android.h | 2 +- include/openthread/channel_monitor.h | 4 +- src/cli/cli.cpp | 4 +- src/core/Makefile.am | 1 + src/core/api/channel_monitor_api.cpp | 4 +- src/core/common/instance.cpp | 2 +- src/core/common/instance.hpp | 6 +- src/core/config/channel_manager.h | 2 +- src/core/config/channel_monitor.h | 95 +++++++++++++++++++ .../config/openthread-core-default-config.h | 47 --------- src/core/openthread-core-config.h | 1 + src/core/thread/thread_netif.cpp | 4 +- src/core/utils/channel_manager.cpp | 6 +- src/core/utils/channel_manager.hpp | 2 +- src/core/utils/channel_monitor.cpp | 4 +- src/core/utils/channel_monitor.hpp | 4 +- src/ncp/ncp_base.cpp | 2 +- src/ncp/ncp_base_dispatcher.cpp | 2 +- src/ncp/ncp_base_mtd.cpp | 6 +- tests/toranj/build.sh | 1 - tests/toranj/openthread-core-toranj-config.h | 8 ++ 24 files changed, 137 insertions(+), 115 deletions(-) create mode 100644 src/core/config/channel_monitor.h diff --git a/.travis/script.sh b/.travis/script.sh index 5b3a38375..089e8edb6 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -58,14 +58,14 @@ python --version || die export CPPFLAGS="${CPPFLAGS} \ -DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 \ -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1" + -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1" scan-build ./configure \ --enable-application-coap \ --enable-application-coap-secure \ --enable-builtin-mbedtls=no \ --enable-cert-log \ - --enable-channel-monitor \ --enable-child-supervision \ --enable-cli \ --enable-commissioner \ @@ -99,8 +99,6 @@ python --version || die --enable-application-coap-secure \ --enable-builtin-mbedtls=no \ --enable-cert-log \ - --enable-channel-manager \ - --enable-channel-monitor \ --enable-child-supervision \ --enable-cli \ --enable-commissioner \ @@ -364,7 +362,8 @@ build_samr21() { export CPPFLAGS=" \ -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ - -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1" + -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1" git checkout -- . || die git clean -xfd || die @@ -381,7 +380,6 @@ build_samr21() { --enable-legacy \ --enable-mac-filter \ --enable-service \ - --enable-channel-monitor \ --disable-docs \ --disable-tests \ --with-vendor-extension=./src/core/common/extension_example.cpp || die diff --git a/configure.ac b/configure.ac index 2fed35115..1c90cc0db 100644 --- a/configure.ac +++ b/configure.ac @@ -1024,38 +1024,6 @@ AC_SUBST(OPENTHREAD_ENABLE_JAM_DETECTION) AM_CONDITIONAL([OPENTHREAD_ENABLE_JAM_DETECTION], [test "${enable_jam_detection}" = "yes"]) AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_JAM_DETECTION],[${OPENTHREAD_ENABLE_JAM_DETECTION}],[Define to 1 if you want to use jam detection feature]) -# -# Channel Monitor -# - -AC_ARG_ENABLE(channel_monitor, - [AS_HELP_STRING([--enable-channel-monitor],[Enable Channel Monitor support @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_channel_monitor=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_channel_monitor} for --enable-channel-monitor]) - ;; - esac - ], - [enable_channel_monitor=no]) - -if test "$enable_channel_monitor" = "yes"; then - OPENTHREAD_ENABLE_CHANNEL_MONITOR=1 -else - OPENTHREAD_ENABLE_CHANNEL_MONITOR=0 -fi - -AC_MSG_CHECKING([whether to enable channel monitor]) -AC_MSG_RESULT(${enable_channel_monitor}) -AC_SUBST(OPENTHREAD_ENABLE_CHANNEL_MONITOR) -AM_CONDITIONAL([OPENTHREAD_ENABLE_CHANNEL_MONITOR], [test "${enable_channel_monitor}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_CHANNEL_MONITOR],[${OPENTHREAD_ENABLE_CHANNEL_MONITOR}],[Define to 1 if you want to use channel monitor feature]) - # # MAC Filter (include AddressFilter and RssInFilter) # @@ -1941,7 +1909,6 @@ AC_MSG_NOTICE([ OpenThread Commissioner support : ${enable_commissioner} OpenThread Joiner support : ${enable_joiner} OpenThread Jam Detection support : ${enable_jam_detection} - OpenThread Channel Monitor support : ${enable_channel_monitor} OpenThread MAC Filter support : ${enable_mac_filter} OpenThread Factory Diagnostics support : ${enable_diag} OpenThread Child Supervision support : ${enable_child_supervision} diff --git a/examples/common-switches.mk b/examples/common-switches.mk index 9004cc9a2..dc278c49d 100644 --- a/examples/common-switches.mk +++ b/examples/common-switches.mk @@ -95,7 +95,7 @@ COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 endif ifeq ($(CHANNEL_MONITOR),1) -configure_OPTIONS += --enable-channel-monitor +COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1 endif ifeq ($(CHILD_SUPERVISION),1) diff --git a/include/openthread-config-android.h b/include/openthread-config-android.h index 27c16ec7d..b76010289 100644 --- a/include/openthread-config-android.h +++ b/include/openthread-config-android.h @@ -36,7 +36,7 @@ #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 0 /* Define to 1 if you want to use channel monitor feature */ -#define OPENTHREAD_ENABLE_CHANNEL_MONITOR 0 +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 0 /* Define to 1 if you want to use child supervision feature */ #define OPENTHREAD_ENABLE_CHILD_SUPERVISION 1 diff --git a/include/openthread/channel_monitor.h b/include/openthread/channel_monitor.h index b503f177e..0c8929c0d 100644 --- a/include/openthread/channel_monitor.h +++ b/include/openthread/channel_monitor.h @@ -47,8 +47,8 @@ extern "C" { * @brief * This module includes functions for channel monitoring feature. * - * The functions in this module are available when channel monitor feature (`OPENTHREAD_ENABLE_CHANNEL_MONITOR`) - * is enabled. + * The functions in this module are available when channel monitor feature + * (`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE`) is enabled. * * Channel monitoring will periodically monitor all channels to help determine the cleaner channels (channels * with less interference). diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 953135d1b..0f982142d 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -72,7 +72,7 @@ #include #endif -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE #include #endif @@ -447,7 +447,7 @@ void Interpreter::ProcessChannel(int argc, char *argv[]) { mServer->OutputFormat("%d\r\n", otLinkGetChannel(mInstance)); } -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE else if (strcmp(argv[0], "monitor") == 0) { if (argc == 1) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index c35faf8e6..8f3f0e8b7 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -321,6 +321,7 @@ HEADERS_COMMON = \ config/announce_sender.h \ config/border_router.h \ config/channel_manager.h \ + config/channel_monitor.h \ config/openthread-core-config-check.h \ config/openthread-core-default-config.h \ crypto/aes_ccm.hpp \ diff --git a/src/core/api/channel_monitor_api.cpp b/src/core/api/channel_monitor_api.cpp index 7c43ed0d5..19ccfe7d1 100644 --- a/src/core/api/channel_monitor_api.cpp +++ b/src/core/api/channel_monitor_api.cpp @@ -39,7 +39,7 @@ using namespace ot; -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE otError otChannelMonitorSetEnabled(otInstance *aInstance, bool aEnabled) { @@ -90,4 +90,4 @@ uint16_t otChannelMonitorGetChannelOccupancy(otInstance *aInstance, uint8_t aCha return instance.Get().GetChannelOccupancy(aChannel); } -#endif // OPENTHREAD_ENABLE_CHANNEL_MONITOR +#endif // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE diff --git a/src/core/common/instance.cpp b/src/core/common/instance.cpp index 0bd507973..7156f7bd8 100644 --- a/src/core/common/instance.cpp +++ b/src/core/common/instance.cpp @@ -77,7 +77,7 @@ Instance::Instance(void) #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE , mApplicationCoapSecure(*this, /* aLayerTwoSecurity */ true) #endif -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE , mChannelMonitor(*this) #endif #if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index f2f4176d9..5537bf9c0 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -67,7 +67,7 @@ #if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE #include "utils/channel_manager.hpp" #endif -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE #include "utils/channel_monitor.hpp" #endif #endif // OPENTHREAD_FTD || OPENTHREAD_MTD @@ -347,7 +347,7 @@ private: Coap::CoapSecure mApplicationCoapSecure; #endif -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE Utils::ChannelMonitor mChannelMonitor; #endif @@ -643,7 +643,7 @@ template <> inline Utils::SupervisionListener &Instance::Get(void) return mThreadNetif.mSupervisionListener; } -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE template <> inline Utils::ChannelMonitor &Instance::Get(void) { return mChannelMonitor; diff --git a/src/core/config/channel_manager.h b/src/core/config/channel_manager.h index f1561f531..1de67075a 100644 --- a/src/core/config/channel_manager.h +++ b/src/core/config/channel_manager.h @@ -67,7 +67,7 @@ * by the Channel Manager module to (auto) select a better channel. * * Applicable only if Channel Manager and Channel Monitoring features are both enabled (i.e., - * `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_ENABLE_CHANNEL_MONITOR` are set). + * `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are set). * */ #ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT diff --git a/src/core/config/channel_monitor.h b/src/core/config/channel_monitor.h new file mode 100644 index 000000000..92b263e61 --- /dev/null +++ b/src/core/config/channel_monitor.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * This file includes compile-time configurations for Channel Monitor. + * + */ + +#ifndef CONFIG_CHANNEL_MONITOR_H_ +#define CONFIG_CHANNEL_MONITOR_H_ + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE + * + * Define to 1 to enable Channel Monitor support. + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_INTERVAL + * + * The sample interval in milliseconds used by Channel Monitoring feature. + + * When enabled, a zero-duration Energy Scan is performed, collecting a single RSSI sample per channel during each + * interval. + * + * Applicable only if Channel Monitoring feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_INTERVAL +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_INTERVAL 41000 +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_RSSI_THRESHOLD + * + * The RSSI threshold in dBm used by Channel Monitoring feature. + * + * The RSSI samples are compared with the given threshold. Channel monitoring reports the average rate of RSSI samples + * that are above this threshold within an observation window (per channel). + * + * It is recommended that this value is set to same value as the CCA threshold used by radio. + * + * Applicable only if Channel Monitoring feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_RSSI_THRESHOLD +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_RSSI_THRESHOLD -75 +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_WINDOW + * + * The averaging sample window length (in units of channel sample interval) used by Channel Monitoring feature. + * + * Channel monitoring will sample all channels every sample interval. It maintains the average rate of RSSI samples + * that are above the RSSI threshold within (approximately) this sample window. + * + * Applicable only if Channel Monitoring feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_WINDOW +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_WINDOW 960 +#endif + +#endif // CONFIG_CHANNEL_MONITOR_H_ diff --git a/src/core/config/openthread-core-default-config.h b/src/core/config/openthread-core-default-config.h index 6ceda2298..66c607b32 100644 --- a/src/core/config/openthread-core-default-config.h +++ b/src/core/config/openthread-core-default-config.h @@ -1197,53 +1197,6 @@ #define OPENTHREAD_CONFIG_IPV6_TX_ERR_RATE_AVERAGING_WINDOW 128 #endif -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_INTERVAL - * - * The sample interval in milliseconds used by Channel Monitoring feature. - - * When enabled, a zero-duration Energy Scan is performed, collecting a single RSSI sample per channel during each - * interval. - * - * Applicable only if Channel Monitoring feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MONITOR` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_INTERVAL -#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_INTERVAL 41000 -#endif - -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_RSSI_THRESHOLD - * - * The RSSI threshold in dBm used by Channel Monitoring feature. - * - * The RSSI samples are compared with the given threshold. Channel monitoring reports the average rate of RSSI samples - * that are above this threshold within an observation window (per channel). - * - * It is recommended that this value is set to same value as the CCA threshold used by radio. - * - * Applicable only if Channel Monitoring feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MONITOR` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_RSSI_THRESHOLD -#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_RSSI_THRESHOLD -75 -#endif - -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_WINDOW - * - * The averaging sample window length (in units of channel sample interval) used by Channel Monitoring feature. - * - * Channel monitoring will sample all channels every sample interval. It maintains the average rate of RSSI samples - * that are above the RSSI threshold within (approximately) this sample window. - * - * Applicable only if Channel Monitoring feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MONITOR` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_WINDOW -#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_WINDOW 960 -#endif - /** * @def OPENTHREAD_CONFIG_CHILD_SUPERVISION_INTERVAL * diff --git a/src/core/openthread-core-config.h b/src/core/openthread-core-config.h index 306b5ab95..ea007d1f8 100644 --- a/src/core/openthread-core-config.h +++ b/src/core/openthread-core-config.h @@ -47,6 +47,7 @@ #include "config/announce_sender.h" #include "config/border_router.h" #include "config/channel_manager.h" +#include "config/channel_monitor.h" #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \ OPENTHREAD_ENABLE_COMMISSIONER || OPENTHREAD_ENABLE_JOINER diff --git a/src/core/thread/thread_netif.cpp b/src/core/thread/thread_netif.cpp index 6dc4988a4..696995b7b 100644 --- a/src/core/thread/thread_netif.cpp +++ b/src/core/thread/thread_netif.cpp @@ -118,7 +118,7 @@ void ThreadNetif::Up(void) // Enable the MAC just in case it was disabled while the Interface was down. Get().SetEnabled(true); -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE Get().Start(); #endif Get().Start(); @@ -162,7 +162,7 @@ void ThreadNetif::Down(void) mIsUp = false; Get().Stop(); -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE Get().Stop(); #endif Get().Signal(OT_CHANGED_THREAD_NETIF_STATE); diff --git a/src/core/utils/channel_manager.cpp b/src/core/utils/channel_manager.cpp index 2138cb21c..369db848d 100644 --- a/src/core/utils/channel_manager.cpp +++ b/src/core/utils/channel_manager.cpp @@ -271,7 +271,7 @@ exit: return; } -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE otError ChannelManager::FindBetterChannel(uint8_t &aNewChannel, uint16_t &aOccupancy) { @@ -386,7 +386,7 @@ exit: return error; } -#else // OPENTHREAD_ENABLE_CHANNEL_MONITOR +#else // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE otError ChannelManager::RequestChannelSelect(bool) { @@ -394,7 +394,7 @@ otError ChannelManager::RequestChannelSelect(bool) return OT_ERROR_DISABLED_FEATURE; } -#endif // OPENTHREAD_ENABLE_CHANNEL_MONITOR +#endif // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE void ChannelManager::StartAutoSelectTimer(void) { diff --git a/src/core/utils/channel_manager.hpp b/src/core/utils/channel_manager.hpp index df84361b0..28a84c8ac 100644 --- a/src/core/utils/channel_manager.hpp +++ b/src/core/utils/channel_manager.hpp @@ -277,7 +277,7 @@ private: void PreparePendingDataset(void); void StartAutoSelectTimer(void); -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE otError FindBetterChannel(uint8_t &aNewChannel, uint16_t &aOccupancy); bool ShouldAttemptChannelChange(void); #endif diff --git a/src/core/utils/channel_monitor.cpp b/src/core/utils/channel_monitor.cpp index 367904851..a6048af6c 100644 --- a/src/core/utils/channel_monitor.cpp +++ b/src/core/utils/channel_monitor.cpp @@ -38,7 +38,7 @@ #include "common/logging.hpp" #include "common/random.hpp" -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE namespace ot { namespace Utils { @@ -235,4 +235,4 @@ Mac::ChannelMask ChannelMonitor::FindBestChannels(const Mac::ChannelMask &aMask, } // namespace Utils } // namespace ot -#endif // #if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#endif // #if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE diff --git a/src/core/utils/channel_monitor.hpp b/src/core/utils/channel_monitor.hpp index 487837f40..aba9cb127 100644 --- a/src/core/utils/channel_monitor.hpp +++ b/src/core/utils/channel_monitor.hpp @@ -55,7 +55,7 @@ namespace Utils { * @{ */ -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE /** * This class implements the channel monitoring logic. @@ -212,7 +212,7 @@ private: TimerMilli mTimer; }; -#endif // OPENTHREAD_ENABLE_CHANNEL_MONITOR +#endif // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE /** * @} diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 8330220d7..68e97af68 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -1769,7 +1769,7 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CHILD_SUPERVISION)); #endif -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CHANNEL_MONITOR)); #endif diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index dac898b73..988ff8d25 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -333,7 +333,7 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertyGet; break; #endif -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE case SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_INTERVAL: handler = &NcpBase::HandlePropertyGet; break; diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index c2f8782dd..bc8701df3 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -37,7 +37,7 @@ #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #include #endif -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE #include #endif #if OPENTHREAD_ENABLE_CHILD_SUPERVISION @@ -2119,7 +2119,7 @@ exit: #endif // OPENTHREAD_ENABLE_CHILD_SUPERVISION -#if OPENTHREAD_ENABLE_CHANNEL_MONITOR +#if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE template <> otError NcpBase::HandlePropertyGet(void) { @@ -2166,7 +2166,7 @@ exit: return error; } -#endif // OPENTHREAD_ENABLE_CHANNEL_MONITOR +#endif // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE template <> otError NcpBase::HandlePropertyGet(void) { diff --git a/tests/toranj/build.sh b/tests/toranj/build.sh index 3bfe011d5..2ba49b8f9 100755 --- a/tests/toranj/build.sh +++ b/tests/toranj/build.sh @@ -77,7 +77,6 @@ build_config=$1 configure_options=" \ --disable-docs \ --disable-tests \ - --enable-channel-monitor \ --enable-child-supervision \ --enable-commissioner \ --enable-coverage=$coverage \ diff --git a/tests/toranj/openthread-core-toranj-config.h b/tests/toranj/openthread-core-toranj-config.h index 69be795c7..6d674985d 100644 --- a/tests/toranj/openthread-core-toranj-config.h +++ b/tests/toranj/openthread-core-toranj-config.h @@ -229,6 +229,14 @@ */ #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 1 +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE + * + * Define as 1 to enable Channel Monitor support. + * + */ +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 1 + /** * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY *