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  * @addtogroup config-parent-search
40  *
41  * @brief
42  *   This module includes configuration variables for Parent Search.
43  *
44  * @{
45  *
46  */
47 
48 /**
49  * @def OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
50  *
51  * Define as 1 to enable periodic parent search feature.
52  *
53  * When this feature is enabled an end-device/child (while staying attached) will periodically search for a possible
54  * better parent and will switch parent if a better one is found.
55  *
56  * The child will periodically check the average RSS value for the current parent, and only if it is below a specific
57  * threshold, a parent search is performed. The `OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL` specifies the
58  * check interval (in seconds) and `OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD` gives the RSS threshold.
59  *
60  * Since the parent search process can be power consuming (child needs to stays in RX mode to collect parent response)
61  * and to limit its impact on battery-powered devices, after a parent search is triggered, the child will not trigger
62  * another one before a specified backoff interval specified by `OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL`.
63  *
64  */
65 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE
66 #define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 0
67 #endif
68 
69 /**
70  * @def OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
71  *
72  * Specifies the interval in seconds for a child to check the trigger condition to perform a parent search.
73  *
74  * Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
75  *
76  */
77 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL
78 #define OPENTHREAD_CONFIG_PARENT_SEARCH_CHECK_INTERVAL (9 * 60)
79 #endif
80 
81 /**
82  * @def OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
83  *
84  * Specifies the backoff interval in seconds for a child to not perform a parent search after triggering one.
85  *
86  * Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
87  *
88  *
89  */
90 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL
91 #define OPENTHREAD_CONFIG_PARENT_SEARCH_BACKOFF_INTERVAL (10 * 60 * 60)
92 #endif
93 
94 /**
95  * @def OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
96  *
97  * Specifies the RSS threshold used to trigger a parent search.
98  *
99  * Applicable only if periodic parent search feature is enabled (see `OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE`).
100  *
101  */
102 #ifndef OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD
103 #define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -65
104 #endif
105 
106 /**
107  * @}
108  *
109  */
110 
111 #endif // CONFIG_PARENT_SEARCH_H_
112