diff --git a/.travis/script.sh b/.travis/script.sh index dc77d0512..5b3a38375 100755 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -57,14 +57,14 @@ python --version || die # UART transport export CPPFLAGS="${CPPFLAGS} \ -DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 \ - -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1" + -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1" scan-build ./configure \ --enable-application-coap \ --enable-application-coap-secure \ --enable-builtin-mbedtls=no \ --enable-cert-log \ - --enable-channel-manager \ --enable-channel-monitor \ --enable-child-supervision \ --enable-cli \ @@ -363,7 +363,8 @@ build_samr21() { CPPFLAGS=-DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG make -f examples/Makefile-posix || die export CPPFLAGS=" \ - -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1" + -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 \ + -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1" git checkout -- . || die git clean -xfd || die @@ -380,7 +381,6 @@ build_samr21() { --enable-legacy \ --enable-mac-filter \ --enable-service \ - --enable-channel-manager \ --enable-channel-monitor \ --disable-docs \ --disable-tests \ diff --git a/configure.ac b/configure.ac index e0e5ae859..2fed35115 100644 --- a/configure.ac +++ b/configure.ac @@ -1056,38 +1056,6 @@ 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]) -# -# Channel Manager -# - -AC_ARG_ENABLE(channel_manager, - [AS_HELP_STRING([--enable-channel-manager],[Enable Channel Manager support @<:@default=no@:>@.])], - [ - case "${enableval}" in - - no|yes) - enable_channel_manager=${enableval} - ;; - - *) - AC_MSG_ERROR([Invalid value ${enable_channel_manager} for --enable-channel-manager]) - ;; - esac - ], - [enable_channel_manager=no]) - -if test "$enable_channel_manager" = "yes"; then - OPENTHREAD_ENABLE_CHANNEL_MANAGER=1 -else - OPENTHREAD_ENABLE_CHANNEL_MANAGER=0 -fi - -AC_MSG_CHECKING([whether to enable channel manager]) -AC_MSG_RESULT(${enable_channel_manager}) -AC_SUBST(OPENTHREAD_ENABLE_CHANNEL_MANAGER) -AM_CONDITIONAL([OPENTHREAD_ENABLE_CHANNEL_MANAGER], [test "${enable_channel_manager}" = "yes"]) -AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_CHANNEL_MANAGER],[${OPENTHREAD_ENABLE_CHANNEL_MANAGER}],[Define to 1 if you want to enable channel manager feature]) - # # MAC Filter (include AddressFilter and RssInFilter) # @@ -1974,7 +1942,6 @@ AC_MSG_NOTICE([ OpenThread Joiner support : ${enable_joiner} OpenThread Jam Detection support : ${enable_jam_detection} OpenThread Channel Monitor support : ${enable_channel_monitor} - OpenThread Channel Manager support : ${enable_channel_manager} 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 f2fdbf906..9004cc9a2 100644 --- a/examples/common-switches.mk +++ b/examples/common-switches.mk @@ -91,7 +91,7 @@ configure_OPTIONS += --enable-coverage endif ifeq ($(CHANNEL_MANAGER),1) -configure_OPTIONS += --enable-channel-manager +COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 endif ifeq ($(CHANNEL_MONITOR),1) diff --git a/include/openthread-config-android.h b/include/openthread-config-android.h index deb8e5609..27c16ec7d 100644 --- a/include/openthread-config-android.h +++ b/include/openthread-config-android.h @@ -33,7 +33,7 @@ #define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1 /* Define to 1 if you want to enable channel manager feature */ -#define OPENTHREAD_ENABLE_CHANNEL_MANAGER 0 +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 0 /* Define to 1 if you want to use channel monitor feature */ #define OPENTHREAD_ENABLE_CHANNEL_MONITOR 0 diff --git a/include/openthread/channel_manager.h b/include/openthread/channel_manager.h index 09c8e03b9..56342c179 100644 --- a/include/openthread/channel_manager.h +++ b/include/openthread/channel_manager.h @@ -47,8 +47,8 @@ extern "C" { * @brief * This module includes functions for Channel Manager. * - * The functions in this module are available when Channel Manager feature (`OPENTHREAD_ENABLE_CHANNEL_MANAGER`) - * is enabled. Channel Manager is available only on an FTD build. + * The functions in this module are available when Channel Manager feature + * (`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE`) is enabled. Channel Manager is available only on an FTD build. * * @{ * diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 1a6525314..953135d1b 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -68,7 +68,7 @@ #include "cli_dataset.hpp" -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER && OPENTHREAD_FTD +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE && OPENTHREAD_FTD #include #endif @@ -496,7 +496,7 @@ void Interpreter::ProcessChannel(int argc, char *argv[]) } } #endif -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER && OPENTHREAD_FTD +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE && OPENTHREAD_FTD else if (strcmp(argv[0], "manager") == 0) { if (argc == 1) diff --git a/src/core/Makefile.am b/src/core/Makefile.am index c3cce7f80..c35faf8e6 100644 --- a/src/core/Makefile.am +++ b/src/core/Makefile.am @@ -320,6 +320,7 @@ HEADERS_COMMON = \ common/trickle_timer.hpp \ config/announce_sender.h \ config/border_router.h \ + config/channel_manager.h \ config/openthread-core-config-check.h \ config/openthread-core-default-config.h \ crypto/aes_ccm.hpp \ diff --git a/src/core/api/channel_manager_api.cpp b/src/core/api/channel_manager_api.cpp index a9835e20a..5d2b503a4 100644 --- a/src/core/api/channel_manager_api.cpp +++ b/src/core/api/channel_manager_api.cpp @@ -40,7 +40,7 @@ using namespace ot; -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER && OPENTHREAD_FTD +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE && OPENTHREAD_FTD void otChannelManagerRequestChannelChange(otInstance *aInstance, uint8_t aChannel) { @@ -133,4 +133,4 @@ void otChannelManagerSetFavoredChannels(otInstance *aInstance, uint32_t aChannel return instance.Get().SetFavoredChannels(aChannelMask); } -#endif // OPENTHREAD_ENABLE_CHANNEL_MANAGER && OPENTHREAD_FTD +#endif // OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE && OPENTHREAD_FTD diff --git a/src/core/common/instance.cpp b/src/core/common/instance.cpp index e156d3807..0bd507973 100644 --- a/src/core/common/instance.cpp +++ b/src/core/common/instance.cpp @@ -80,7 +80,7 @@ Instance::Instance(void) #if OPENTHREAD_ENABLE_CHANNEL_MONITOR , mChannelMonitor(*this) #endif -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE , mChannelManager(*this) #endif #if OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE diff --git a/src/core/common/instance.hpp b/src/core/common/instance.hpp index 89e2f0f0c..f2f4176d9 100644 --- a/src/core/common/instance.hpp +++ b/src/core/common/instance.hpp @@ -64,7 +64,7 @@ #include "thread/announce_sender.hpp" #include "thread/link_quality.hpp" #include "thread/thread_netif.hpp" -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE #include "utils/channel_manager.hpp" #endif #if OPENTHREAD_ENABLE_CHANNEL_MONITOR @@ -351,7 +351,7 @@ private: Utils::ChannelMonitor mChannelMonitor; #endif -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE Utils::ChannelManager mChannelManager; #endif @@ -650,7 +650,7 @@ template <> inline Utils::ChannelMonitor &Instance::Get(void) } #endif -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE template <> inline Utils::ChannelManager &Instance::Get(void) { return mChannelManager; diff --git a/src/core/config/channel_manager.h b/src/core/config/channel_manager.h new file mode 100644 index 000000000..f1561f531 --- /dev/null +++ b/src/core/config/channel_manager.h @@ -0,0 +1,138 @@ +/* + * 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 Manager. + * + */ + +#ifndef CONFIG_CHANNEL_MANAGER_H_ +#define CONFIG_CHANNEL_MANAGER_H_ + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE + * + * Define as 1 to enable Channel Manager support. + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 0 +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY + * + * The minimum delay (in seconds) used by Channel Manager module for performing a channel change. + * + * The minimum delay should preferably be longer than maximum data poll interval used by all sleepy-end-devices within + * the Thread network. + * + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY 120 +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT + * + * The minimum number of RSSI samples per channel by Channel Monitoring feature before the collected data can be used + * 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). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT 500 +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED + * + * This threshold specifies the minimum occupancy rate difference between two channels for the Channel Manager to + * prefer an unfavored channel over the best favored one. This is used when (auto) selecting a channel based on the + * collected channel quality data by "channel monitor" feature. + * + * The difference is based on the `ChannelMonitor::GetChannelOccupancy()` definition which provides the average + * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than + * a threshold). Value 0 maps to 0% and 0xffff maps to 100%. + * + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED (0xffff * 7 / 100) +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL + * + * This threshold specifies the minimum occupancy rate difference required between the current channel and a newly + * selected channel for Channel Manager to allow channel change to the new channel. + * + * The difference is based on the `ChannelMonitor::GetChannelOccupancy()` definition which provides the average + * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than + * a threshold). Value 0 maps to 0% rate and 0xffff maps to 100%. + * + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL (0xffff * 10 / 100) +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL + * + * The default time interval (in seconds) used by Channel Manager for auto-channel-selection functionality. + * + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL (3 * 60 * 60) +#endif + +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD + * + * Minimum CCA failure rate threshold on current channel before Channel Manager starts channel selection attempt. + * + * Value 0 maps to 0% and 0xffff maps to 100%. + * + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). + * + */ +#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD (0xffff * 14 / 100) +#endif + +#endif // CONFIG_CHANNEL_MANAGER_H_ diff --git a/src/core/config/openthread-core-default-config.h b/src/core/config/openthread-core-default-config.h index 93f28decb..6ceda2298 100644 --- a/src/core/config/openthread-core-default-config.h +++ b/src/core/config/openthread-core-default-config.h @@ -1244,96 +1244,6 @@ #define OPENTHREAD_CONFIG_CHANNEL_MONITOR_SAMPLE_WINDOW 960 #endif -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY - * - * The minimum delay (in seconds) used by Channel Manager module for performing a channel change. - * - * The minimum delay should preferably be longer than maximum data poll interval used by all sleepy-end-devices within - * the Thread network. - * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY -#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY 120 -#endif - -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT - * - * The minimum number of RSSI samples per channel by Channel Monitoring feature before the collected data can be used - * 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_ENABLE_CHANNEL_MANAGER` and `OPENTHREAD_ENABLE_CHANNEL_MONITOR` are set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT -#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_MONITOR_SAMPLE_COUNT 500 -#endif - -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED - * - * This threshold specifies the minimum occupancy rate difference between two channels for the Channel Manager to - * prefer an unfavored channel over the best favored one. This is used when (auto) selecting a channel based on the - * collected channel quality data by "channel monitor" feature. - * - * The difference is based on the `ChannelMonitor::GetChannelOccupancy()` definition which provides the average - * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than - * a threshold). Value 0 maps to 0% and 0xffff maps to 100%. - * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED -#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED (0xffff * 7 / 100) -#endif - -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL - * - * This threshold specifies the minimum occupancy rate difference required between the current channel and a newly - * selected channel for Channel Manager to allow channel change to the new channel. - * - * The difference is based on the `ChannelMonitor::GetChannelOccupancy()` definition which provides the average - * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than - * a threshold). Value 0 maps to 0% rate and 0xffff maps to 100%. - * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL -#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL (0xffff * 10 / 100) -#endif - -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL - * - * The default time interval (in seconds) used by Channel Manager for auto-channel-selection functionality. - * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL -#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_DEFAULT_AUTO_SELECT_INTERVAL (3 * 60 * 60) -#endif - -/** - * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD - * - * Minimum CCA failure rate threshold on current channel before Channel Manager starts channel selection attempt. - * - * Value 0 maps to 0% and 0xffff maps to 100%. - * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). - * - */ -#ifndef OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD -#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_CCA_FAILURE_THRESHOLD (0xffff * 14 / 100) -#endif - /** * @def OPENTHREAD_CONFIG_CHILD_SUPERVISION_INTERVAL * diff --git a/src/core/openthread-core-config.h b/src/core/openthread-core-config.h index d0242f035..306b5ab95 100644 --- a/src/core/openthread-core-config.h +++ b/src/core/openthread-core-config.h @@ -46,6 +46,7 @@ #include "config/announce_sender.h" #include "config/border_router.h" +#include "config/channel_manager.h" #if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE || OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE || \ OPENTHREAD_ENABLE_COMMISSIONER || OPENTHREAD_ENABLE_JOINER diff --git a/src/core/utils/channel_manager.cpp b/src/core/utils/channel_manager.cpp index ef26ec2f6..2138cb21c 100644 --- a/src/core/utils/channel_manager.cpp +++ b/src/core/utils/channel_manager.cpp @@ -41,7 +41,7 @@ #include "common/random.hpp" #include "phy/phy.hpp" -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER && OPENTHREAD_FTD +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE && OPENTHREAD_FTD namespace ot { namespace Utils { @@ -459,4 +459,4 @@ void ChannelManager::SetFavoredChannels(uint32_t aChannelMask) } // namespace Utils } // namespace ot -#endif // #if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#endif // #if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE diff --git a/src/core/utils/channel_manager.hpp b/src/core/utils/channel_manager.hpp index 42325115f..df84361b0 100644 --- a/src/core/utils/channel_manager.hpp +++ b/src/core/utils/channel_manager.hpp @@ -55,7 +55,7 @@ namespace Utils { * @{ */ -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE #if OPENTHREAD_FTD @@ -304,7 +304,7 @@ public: #endif // OPENTHREAD_FTD -#endif // OPENTHREAD_ENABLE_CHANNEL_MANAGER +#endif // OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE /** * @} * diff --git a/src/ncp/changed_props_set.cpp b/src/ncp/changed_props_set.cpp index a9280387f..205cd6b26 100644 --- a/src/ncp/changed_props_set.cpp +++ b/src/ncp/changed_props_set.cpp @@ -82,7 +82,7 @@ const ChangedPropsSet::Entry ChangedPropsSet::mSupportedProps[] = { {SPINEL_PROP_NET_MASTER_KEY, SPINEL_STATUS_OK, true}, {SPINEL_PROP_NET_PSKC, SPINEL_STATUS_OK, true}, {SPINEL_PROP_PHY_CHAN_SUPPORTED, SPINEL_STATUS_OK, true}, -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE {SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL, SPINEL_STATUS_OK, true}, #endif #if OPENTHREAD_ENABLE_JOINER diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index b766ef149..8330220d7 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -1773,7 +1773,7 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CHANNEL_MONITOR)); #endif -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER && OPENTHREAD_FTD +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE && OPENTHREAD_FTD SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CHANNEL_MANAGER)); #endif diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index f27221bd2..dac898b73 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -613,7 +613,7 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertyGet; break; #endif -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE case SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL: handler = &NcpBase::HandlePropertyGet; break; @@ -951,7 +951,7 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) handler = &NcpBase::HandlePropertySet; break; #endif -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE case SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL: handler = &NcpBase::HandlePropertySet; break; diff --git a/src/ncp/ncp_base_ftd.cpp b/src/ncp/ncp_base_ftd.cpp index 1fefe94e3..c261982fa 100644 --- a/src/ncp/ncp_base_ftd.cpp +++ b/src/ncp/ncp_base_ftd.cpp @@ -33,7 +33,7 @@ #include "ncp_base.hpp" #include -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE #include #endif #if OPENTHREAD_ENABLE_CHILD_SUPERVISION @@ -924,7 +924,7 @@ exit: #endif // OPENTHREAD_ENABLE_CHILD_SUPERVISION -#if OPENTHREAD_ENABLE_CHANNEL_MANAGER +#if OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE template <> otError NcpBase::HandlePropertyGet(void) { @@ -1047,7 +1047,7 @@ exit: return error; } -#endif // OPENTHREAD_ENABLE_CHANNEL_MANAGER +#endif // OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE #if OPENTHREAD_CONFIG_ENABLE_TIME_SYNC template <> otError NcpBase::HandlePropertyGet(void) diff --git a/tests/toranj/build.sh b/tests/toranj/build.sh index dffa43fd5..3bfe011d5 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-manager \ --enable-channel-monitor \ --enable-child-supervision \ --enable-commissioner \ diff --git a/tests/toranj/openthread-core-toranj-config.h b/tests/toranj/openthread-core-toranj-config.h index a6ebb9d03..69be795c7 100644 --- a/tests/toranj/openthread-core-toranj-config.h +++ b/tests/toranj/openthread-core-toranj-config.h @@ -221,6 +221,14 @@ */ #define OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT 1 +/** + * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE + * + * Define as 1 to enable Channel Manager support. + * + */ +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 1 + /** * @def OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY * @@ -229,7 +237,7 @@ * The minimum delay should preferably be longer than maximum data poll interval used by all sleepy-end-devices within * the Thread network. * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). * */ #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_MINIMUM_DELAY 2 @@ -245,7 +253,7 @@ * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than * a threshold). Value 0 maps to 0% and 0xffff maps to 100%. * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). * */ #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_SKIP_FAVORED (0xffff * 7 / 100) @@ -260,7 +268,7 @@ * percentage of RSSI samples (within a time window) indicating that channel was busy (i.e., RSSI value higher than * a threshold). Value 0 maps to 0% rate and 0xffff maps to 100%. * - * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_ENABLE_CHANNEL_MANAGER` is set). + * Applicable only if Channel Manager feature is enabled (i.e., `OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is set). * */ #define OPENTHREAD_CONFIG_CHANNEL_MANAGER_THRESHOLD_TO_CHANGE_CHANNEL (0xffff * 10 / 100)