1 /* 2 * Copyright (c) 2019, The OpenThread Authors. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * 3. Neither the name of the copyright holder nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 * POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /** 30 * @file 31 * This file includes compile-time configurations for Parent Search. 32 * 33 */ 34 35 #ifndef CONFIG_PARENT_SEARCH_H_ 36 #define CONFIG_PARENT_SEARCH_H_ 37 38 /** 39 * @def OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 40 * 41 * Define as 1 to enable periodic parent search feature. 42 * 43 * When this feature is enabled an end-device/child (while staying attached) will periodically search for a possible 44 * better parent and will switch parent if a better one is found. 45 * 46 * The child will periodically check the average RSS value for the current parent, and only if it is below a specific 47 * threshold, a parent search is performed. The `OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL` specifies the 48 * check interval (in seconds) and `OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD` gives the RSS threshold. 49 * 50 * Since the parent search process can be power consuming (child needs to stays in RX mode to collect parent response) 51 * and to limit its impact on battery-powered devices, after a parent search is triggered, the child will not trigger 52 * another one before a specified backoff interval specified by `OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL`. 53 * 54 */ 55 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 56 #define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 0 57 #endif 58 59 /** 60 * @def OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL 61 * 62 * Specifies the interval in seconds for a child to check the trigger condition to perform a parent search. 63 * 64 * Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`). 65 * 66 */ 67 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL 68 #define OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL (9 * 60) 69 #endif 70 71 /** 72 * @def OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL 73 * 74 * Specifies the backoff interval in seconds for a child to not perform a parent search after triggering one. 75 * 76 * Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`). 77 * 78 * 79 */ 80 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL 81 #define OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL (10 * 60 * 60) 82 #endif 83 84 /** 85 * @def OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD 86 * 87 * Specifies the RSS threshold used to trigger a parent search. 88 * 89 * Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`). 90 * 91 */ 92 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD 93 #define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -65 94 #endif 95 96 #endif // CONFIG_PARENT_SEARCH_H_ 97