1if BLE_MESH
2
3    config BLE_MESH_HCI_5_0
4        bool "Support sending 20ms non-connectable adv packets"
5        default y
6        help
7            It is a temporary solution and needs further modifications.
8
9    config BLE_MESH_USE_DUPLICATE_SCAN
10        bool "Support Duplicate Scan in BLE Mesh"
11        depends on BT_BLUEDROID_ENABLED
12        select BTDM_BLE_SCAN_DUPL if IDF_TARGET_ESP32
13        select BTDM_BLE_MESH_SCAN_DUPL_EN if IDF_TARGET_ESP32
14        select BT_CTRL_BLE_SCAN_DUPL if IDF_TARGET_ESP32C3
15        select BT_CTRL_BLE_MESH_SCAN_DUPL_EN if IDF_TARGET_ESP32C3
16        select BT_LE_SCAN_DUPL if IDF_TARGET_ESP32C6
17        select BT_LE_SCAN_DUPL if IDF_TARGET_ESP32H2
18        default y
19        help
20            Enable this option to allow using specific duplicate scan filter
21            in BLE Mesh, and Scan Duplicate Type must be set by choosing the
22            option in the Bluetooth Controller section in menuconfig, which is
23            "Scan Duplicate By Device Address and Advertising Data".
24
25    choice BLE_MESH_MEM_ALLOC_MODE
26        prompt "Memory allocation strategy"
27        default BLE_MESH_MEM_ALLOC_MODE_INTERNAL
28        help
29            Allocation strategy for BLE Mesh stack, essentially provides ability to
30            allocate all required dynamic allocations from,
31
32            - Internal DRAM memory only
33            - External SPIRAM memory only
34            - Either internal or external memory based on default malloc()
35              behavior in ESP-IDF
36            - Internal IRAM memory wherever applicable else internal DRAM
37
38            Recommended mode here is always internal (*), since that is most preferred
39            from security perspective. But if application requirement does not
40            allow sufficient free internal memory then alternate mode can be
41            selected.
42
43            (*) In case of ESP32-S2/ESP32-S3, hardware allows encryption of external
44            SPIRAM contents provided hardware flash encryption feature is enabled.
45            In that case, using external SPIRAM allocation strategy is also safe choice
46            from security perspective.
47
48        config BLE_MESH_MEM_ALLOC_MODE_INTERNAL
49            bool "Internal DRAM"
50
51        config BLE_MESH_MEM_ALLOC_MODE_EXTERNAL
52            bool "External SPIRAM"
53            depends on SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC
54
55        config BLE_MESH_MEM_ALLOC_MODE_DEFAULT
56            bool "Default alloc mode"
57            help
58                Enable this option to use the default memory allocation strategy when
59                external SPIRAM is enabled. See the SPIRAM options for more details.
60
61        config BLE_MESH_MEM_ALLOC_MODE_IRAM_8BIT
62            bool "Internal IRAM"
63            depends on ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY
64            help
65                Allows to use IRAM memory region as 8bit accessible region. Every
66                unaligned (8bit or 16bit) access will result in an exception and
67                incur penalty of certain clock cycles per unaligned read/write.
68
69    endchoice # BLE_MESH_MEM_ALLOC_MODE
70
71    config BLE_MESH_FREERTOS_STATIC_ALLOC
72        bool "Enable FreeRTOS static allocation"
73        depends on FREERTOS_SUPPORT_STATIC_ALLOCATION && ((IDF_TARGET_ESP32 && SPIRAM) || ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY) # NOERROR
74        default n
75        help
76            Enable this option to use FreeRTOS static allocation APIs for BLE Mesh,
77            which provides the ability to use different dynamic memory (i.e. SPIRAM
78            or IRAM) for FreeRTOS objects.
79            If this option is disabled, the FreeRTOS static allocation APIs will not
80            be used, and internal DRAM will be allocated for FreeRTOS objects.
81
82    choice BLE_MESH_FREERTOS_STATIC_ALLOC_MODE
83        prompt "Memory allocation for FreeRTOS objects"
84        depends on BLE_MESH_FREERTOS_STATIC_ALLOC
85        help
86            Choose the memory to be used for FreeRTOS objects.
87
88        config BLE_MESH_FREERTOS_STATIC_ALLOC_EXTERNAL
89            bool "External SPIRAM"
90            depends on IDF_TARGET_ESP32 && SPIRAM
91            help
92                If enabled, BLE Mesh allocates dynamic memory from external SPIRAM for
93                FreeRTOS objects, i.e. mutex, queue, and task stack. External SPIRAM
94                can only be used for task stack when SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY
95                is enabled. See the SPIRAM options for more details.
96
97        config BLE_MESH_FREERTOS_STATIC_ALLOC_IRAM_8BIT
98            bool "Internal IRAM"
99            depends on ESP32_IRAM_AS_8BIT_ACCESSIBLE_MEMORY
100            help
101                If enabled, BLE Mesh allocates dynamic memory from internal IRAM for
102                FreeRTOS objects, i.e. mutex, queue. Note: IRAM region cannot be used
103                as task stack.
104
105    endchoice # BLE_MESH_FREERTOS_STATIC_ALLOC_MODE
106
107    config BLE_MESH_DEINIT
108        bool "Support de-initialize BLE Mesh stack"
109        default y
110        help
111            If enabled, users can use the function esp_ble_mesh_deinit() to de-initialize
112            the whole BLE Mesh stack.
113
114    menu "BLE Mesh and BLE coexistence support"
115
116        config BLE_MESH_SUPPORT_BLE_ADV
117            bool "Support sending normal BLE advertising packets"
118            default n
119            help
120                When selected, users can send normal BLE advertising packets
121                with specific API.
122
123        if BLE_MESH_SUPPORT_BLE_ADV
124
125            config BLE_MESH_BLE_ADV_BUF_COUNT
126                int "Number of advertising buffers for BLE advertising packets"
127                default 3
128                range 1 255
129                help
130                    Number of advertising buffers for BLE packets available.
131
132        endif # BLE_MESH_SUPPORT_BLE_ADV
133
134        config BLE_MESH_SUPPORT_BLE_SCAN
135            bool "Support scanning normal BLE advertising packets"
136            default n
137            help
138                When selected, users can register a callback and receive normal BLE
139                advertising packets in the application layer.
140
141    endmenu # BLE Mesh and BLE coexistence support
142
143    config BLE_MESH_FAST_PROV
144        bool "Enable BLE Mesh Fast Provisioning"
145        select BLE_MESH_NODE
146        select BLE_MESH_PROVISIONER
147        select BLE_MESH_PB_ADV
148        default n
149        help
150            Enable this option to allow BLE Mesh fast provisioning solution to be used.
151            When there are multiple unprovisioned devices around, fast provisioning can
152            greatly reduce the time consumption of the whole provisioning process.
153            When this option is enabled, and after an unprovisioned device is provisioned
154            into a node successfully, it can be changed to a temporary Provisioner.
155
156    config BLE_MESH_NODE
157        bool "Support for BLE Mesh Node"
158        help
159            Enable the device to be provisioned into a node. This option should be
160            enabled when an unprovisioned device is going to be provisioned into a
161            node and communicate with other nodes in the BLE Mesh network.
162
163    config BLE_MESH_PROVISIONER
164        bool "Support for BLE Mesh Provisioner"
165        help
166            Enable the device to be a Provisioner. The option should be enabled when
167            a device is going to act as a Provisioner and provision unprovisioned
168            devices into the BLE Mesh network.
169
170    if BLE_MESH_PROVISIONER
171
172        config BLE_MESH_WAIT_FOR_PROV_MAX_DEV_NUM
173            int "Maximum number of unprovisioned devices that can be added to device queue"
174            default 10
175            range 1 100
176            help
177                This option specifies how many unprovisioned devices can be added to device
178                queue for provisioning. Users can use this option to define the size of the
179                queue in the bottom layer which is used to store unprovisioned device
180                information (e.g. Device UUID, address).
181
182        config BLE_MESH_MAX_PROV_NODES
183            int "Maximum number of devices that can be provisioned by Provisioner"
184            default 10
185            range 1 1000
186            help
187                This option specifies how many devices can be provisioned by a Provisioner.
188                This value indicates the maximum number of unprovisioned devices which can be
189                provisioned by a Provisioner. For instance, if the value is 6, it means the
190                Provisioner can provision up to 6 unprovisioned devices.
191                Theoretically a Provisioner without the limitation of its memory can provision
192                up to 32766 unprovisioned devices, here we limit the maximum number to 100
193                just to limit the memory used by a Provisioner. The bigger the value is, the
194                more memory it will cost by a Provisioner to store the information of nodes.
195
196        if BLE_MESH_PB_ADV
197            config BLE_MESH_PBA_SAME_TIME
198                int "Maximum number of PB-ADV running at the same time by Provisioner"
199                default 2
200                range 1 10
201                help
202                    This option specifies how many devices can be provisioned at the same time
203                    using PB-ADV. For examples, if the value is 2, it means a Provisioner can
204                    provision two unprovisioned devices with PB-ADV at the same time.
205
206        endif # BLE_MESH_PB_ADV
207
208        if BLE_MESH_PB_GATT
209            config BLE_MESH_PBG_SAME_TIME
210                int "Maximum number of PB-GATT running at the same time by Provisioner"
211                default 1
212                range 1 5
213                help
214                    This option specifies how many devices can be provisioned at the same
215                    time using PB-GATT. For example, if the value is 2, it means a Provisioner
216                    can provision two unprovisioned devices with PB-GATT at the same time.
217
218        endif # BLE_MESH_PB_GATT
219
220        config BLE_MESH_PROVISIONER_SUBNET_COUNT
221            int "Maximum number of mesh subnets that can be created by Provisioner"
222            default 3
223            range 1 4096
224            help
225                This option specifies how many subnets per network a Provisioner can create.
226                Indeed, this value decides the number of network keys which can be added by a Provisioner.
227
228        config BLE_MESH_PROVISIONER_APP_KEY_COUNT
229            int "Maximum number of application keys that can be owned by Provisioner"
230            default 3
231            range 1 4096
232            help
233                This option specifies how many application keys the Provisioner can have.
234                Indeed, this value decides the number of the application keys which can be added by a Provisioner.
235
236        config BLE_MESH_PROVISIONER_RECV_HB
237            bool "Support receiving Heartbeat messages"
238            default n
239            help
240                When this option is enabled, Provisioner can call specific functions to enable
241                or disable receiving Heartbeat messages and notify them to the application layer.
242
243        if BLE_MESH_PROVISIONER_RECV_HB
244
245            config BLE_MESH_PROVISIONER_RECV_HB_FILTER_SIZE
246                int "Maximum number of filter entries for receiving Heartbeat messages"
247                default 3
248                range 1 1000
249                help
250                    This option specifies how many heartbeat filter entries Provisioner supports.
251                    The heartbeat filter (acceptlist or rejectlist) entries are used to store a
252                    list of SRC and DST which can be used to decide if a heartbeat message will
253                    be processed and notified to the application layer by Provisioner.
254                    Note: The filter is an empty rejectlist by default.
255
256        endif # BLE_MESH_PROVISIONER_RECV_HB
257
258    endif # BLE_MESH_PROVISIONER
259
260    # Virtual option enabled whenever Generic Provisioning layer is needed
261    config BLE_MESH_PROV
262        bool "BLE Mesh Provisioning support"
263        default y
264        help
265            Enable this option to support BLE Mesh Provisioning functionality. For
266            BLE Mesh, this option should be always enabled.
267
268    config BLE_MESH_PB_ADV
269        bool "Provisioning support using the advertising bearer (PB-ADV)"
270        select BLE_MESH_PROV
271        default y
272        help
273            Enable this option to allow the device to be provisioned over the
274            advertising bearer. This option should be enabled if PB-ADV is
275            going to be used during provisioning procedure.
276
277    config BLE_MESH_UNPROVISIONED_BEACON_INTERVAL
278        int "Interval between two consecutive Unprovisioned Device Beacon"
279        depends on BLE_MESH_NODE && BLE_MESH_PB_ADV
280        default 5
281        default 3 if BLE_MESH_FAST_PROV
282        range 1 100
283        help
284            This option specifies the interval of sending two consecutive unprovisioned
285            device beacon, users can use this option to change the frequency of sending
286            unprovisioned device beacon. For example, if the value is 5, it means the
287            unprovisioned device beacon will send every 5 seconds. When the option of
288            BLE_MESH_FAST_PROV is selected, the value is better to be 3 seconds, or less.
289
290    config BLE_MESH_PB_GATT
291        bool "Provisioning support using GATT (PB-GATT)"
292        select BLE_MESH_PROXY
293        select BLE_MESH_PROV
294        help
295            Enable this option to allow the device to be provisioned over GATT.
296            This option should be enabled if PB-GATT is going to be used during
297            provisioning procedure.
298
299            # Virtual option enabled whenever any Proxy protocol is needed
300    config BLE_MESH_PROXY
301        bool "BLE Mesh Proxy protocol support"
302        default y
303        help
304            Enable this option to support BLE Mesh Proxy protocol used by PB-GATT
305            and other proxy pdu transmission.
306
307    config BLE_MESH_GATT_PROXY_SERVER
308        bool "BLE Mesh GATT Proxy Server"
309        select BLE_MESH_PROXY
310        depends on BLE_MESH_NODE
311        default y
312        help
313            This option enables support for Mesh GATT Proxy Service, i.e. the
314            ability to act as a proxy between a Mesh GATT Client and a Mesh network.
315            This option should be enabled if a node is going to be a Proxy Server.
316
317    config BLE_MESH_NODE_ID_TIMEOUT
318        int "Node Identity advertising timeout"
319        depends on BLE_MESH_GATT_PROXY_SERVER
320        range 1 60
321        default 60
322        help
323            This option determines for how long the local node advertises using
324            Node Identity. The given value is in seconds. The specification limits
325            this to 60 seconds and lists it as the recommended value as well.
326            So leaving the default value is the safest option.
327            When an unprovisioned device is provisioned successfully and becomes a
328            node, it will start to advertise using Node Identity during the time
329            set by this option. And after that, Network ID will be advertised.
330
331    config BLE_MESH_PROXY_FILTER_SIZE
332        int "Maximum number of filter entries per Proxy Client"
333        depends on BLE_MESH_GATT_PROXY_SERVER
334        default 4
335        range 1 32767
336        help
337            This option specifies how many Proxy Filter entries the local node supports.
338            The entries of Proxy filter (whitelist or blacklist) are used to store a
339            list of addresses which can be used to decide which messages will be forwarded
340            to the Proxy Client by the Proxy Server.
341
342    config BLE_MESH_GATT_PROXY_CLIENT
343        bool "BLE Mesh GATT Proxy Client"
344        select BLE_MESH_PROXY
345        default n
346        help
347            This option enables support for Mesh GATT Proxy Client. The Proxy Client
348            can use the GATT bearer to send mesh messages to a node that supports the
349            advertising bearer.
350
351    config BLE_MESH_NET_BUF_POOL_USAGE
352        bool
353        default y
354        help
355            Enable BLE Mesh net buffer pool tracking. This option is used to introduce another
356            variable in the bottom layer to record the usage of advertising buffers of BLE Mesh
357            devices. Recommend to enable this option as default.
358
359    config BLE_MESH_SETTINGS
360        bool "Store BLE Mesh configuration persistently"
361        default n
362        help
363            When selected, the BLE Mesh stack will take care of storing/restoring the BLE
364            Mesh configuration persistently in flash.
365            If the device is a BLE Mesh node, when this option is enabled, the configuration
366            of the device will be stored persistently, including unicast address, NetKey,
367            AppKey, etc.
368            And if the device is a BLE Mesh Provisioner, the information of the device will
369            be stored persistently, including the information of provisioned nodes, NetKey,
370            AppKey, etc.
371
372    if BLE_MESH_SETTINGS
373
374        config BLE_MESH_STORE_TIMEOUT
375            int "Delay (in seconds) before storing anything persistently"
376            range 0 1000000
377            default 0
378            help
379                This value defines in seconds how soon any pending changes are actually
380                written into persistent storage (flash) after a change occurs.
381                The option allows nodes to delay a certain period of time to save proper
382                information to flash. The default value is 0, which means information
383                will be stored immediately once there are updates.
384
385        config BLE_MESH_SEQ_STORE_RATE
386            int "How often the sequence number gets updated in storage"
387            range 0 1000000
388            default 0
389            help
390                This value defines how often the local sequence number gets updated in
391                persistent storage (i.e. flash). e.g. a value of 100 means that the
392                sequence number will be stored to flash on every 100th increment.
393                If the node sends messages very frequently a higher value makes more
394                sense, whereas if the node sends infrequently a value as low as 0
395                (update storage for every increment) can make sense. When the stack
396                gets initialized it will add sequence number to the last stored one,
397                so that it starts off with a value that's guaranteed to be larger than
398                the last one used before power off.
399
400        config BLE_MESH_RPL_STORE_TIMEOUT
401            int "Minimum frequency that the RPL gets updated in storage"
402            range 0 1000000
403            default 0
404            help
405                This value defines in seconds how soon the RPL (Replay Protection List)
406                gets written to persistent storage after a change occurs. If the node
407                receives messages frequently, then a large value is recommended. If the
408                node receives messages rarely, then the value can be as low as 0 (which
409                means the RPL is written into the storage immediately).
410                Note that if the node operates in a security-sensitive case, and there is
411                a risk of sudden power-off, then a value of 0 is strongly recommended.
412                Otherwise, a power loss before RPL being written into the storage may
413                introduce message replay attacks and system security will be in a
414                vulnerable state.
415
416        config BLE_MESH_SETTINGS_BACKWARD_COMPATIBILITY
417            bool "A specific option for settings backward compatibility"
418            depends on BLE_MESH_NODE
419            default n
420            help
421                This option is created to solve the issue of failure in recovering
422                node information after mesh stack updates. In the old version mesh
423                stack, there is no key of "mesh/role" in nvs. In the new version
424                mesh stack, key of "mesh/role" is added in nvs, recovering node
425                information needs to check "mesh/role" key in nvs and implements
426                selective recovery of mesh node information. Therefore, there may
427                be failure in recovering node information during node restarting
428                after OTA.
429
430                The new version mesh stack adds the option of "mesh/role" because
431                we have added the support of storing Provisioner information, while
432                the old version only supports storing node information.
433
434                If users are updating their nodes from old version to new version,
435                we recommend enabling this option, so that system could set the flag
436                in advance before recovering node information and make sure the node
437                information recovering could work as expected.
438
439        config BLE_MESH_SPECIFIC_PARTITION
440            bool "Use a specific NVS partition for BLE Mesh"
441            default n
442            help
443                When selected, the mesh stack will use a specified NVS partition instead of
444                default NVS partition. Note that the specified partition must be registered
445                with NVS using nvs_flash_init_partition() API, and the partition must exists
446                in the csv file.
447                When Provisioner needs to store a large amount of nodes' information in the
448                flash (e.g. more than 20), this option is recommended to be enabled.
449
450        config BLE_MESH_PARTITION_NAME
451            string "Name of the NVS partition for BLE Mesh"
452            depends on BLE_MESH_SPECIFIC_PARTITION
453            default "ble_mesh"
454            help
455                This value defines the name of the specified NVS partition used by the
456                mesh stack.
457
458        config BLE_MESH_USE_MULTIPLE_NAMESPACE
459            bool "Support using multiple NVS namespaces by Provisioner"
460            depends on BLE_MESH_PROVISIONER
461            default n
462            help
463                When selected, Provisioner can use different NVS namespaces to store
464                different instances of mesh information.
465                For example, if in the first room, Provisioner uses NetKey A, AppKey
466                A and provisions three devices, these information will be treated as
467                mesh information instance A. When the Provisioner moves to the second
468                room, it uses NetKey B, AppKey B and provisions two devices, then the
469                information will be treated as mesh information instance B.
470                Here instance A and instance B will be stored in different namespaces.
471                With this option enabled, Provisioner needs to use specific functions
472                to open the corresponding NVS namespace, restore the mesh information,
473                release the mesh information or erase the mesh information.
474
475        config BLE_MESH_MAX_NVS_NAMESPACE
476            int "Maximum number of NVS namespaces"
477            depends on BLE_MESH_USE_MULTIPLE_NAMESPACE
478            default 2
479            range 1 255
480            help
481                This option specifies the maximum NVS namespaces supported by Provisioner.
482
483    endif  # if BLE_MESH_SETTINGS
484
485    config BLE_MESH_SUBNET_COUNT
486        int "Maximum number of mesh subnets per network"
487        default 3
488        range 1 4096
489        help
490            This option specifies how many subnets a Mesh network can have at the same time.
491            Indeed, this value decides the number of the network keys which can be owned by a node.
492
493    config BLE_MESH_APP_KEY_COUNT
494        int "Maximum number of application keys per network"
495        default 3
496        range 1 4096
497        help
498            This option specifies how many application keys the device can store per network.
499            Indeed, this value decides the number of the application keys which can be owned by a node.
500
501    config BLE_MESH_MODEL_KEY_COUNT
502        int "Maximum number of application keys per model"
503        default 3
504        range 1 4096
505        help
506            This option specifies the maximum number of application keys to which each model
507            can be bound.
508
509    config BLE_MESH_MODEL_GROUP_COUNT
510        int "Maximum number of group address subscriptions per model"
511        default 3
512        range 1 4096
513        help
514            This option specifies the maximum number of addresses to which each model can
515            be subscribed.
516
517    config BLE_MESH_LABEL_COUNT
518        int "Maximum number of Label UUIDs used for Virtual Addresses"
519        default 3
520        range 0 4096
521        help
522            This option specifies how many Label UUIDs can be stored.
523            Indeed, this value decides the number of the Virtual Addresses can be supported by a node.
524
525    config BLE_MESH_CRPL
526        int "Maximum capacity of the replay protection list"
527        default 10
528        range 2 65535
529        help
530            This option specifies the maximum capacity of the replay protection list.
531            It is similar to Network message cache size, but has a different purpose.
532            The replay protection list is used to prevent a node from replay attack,
533            which will store the source address and sequence number of the received
534            mesh messages.
535            For Provisioner, the replay protection list size should not be smaller than
536            the maximum number of nodes whose information can be stored. And the element
537            number of each node should also be taken into consideration. For example, if
538            Provisioner can provision up to 20 nodes and each node contains two elements,
539            then the replay protection list size of Provisioner should be at least 40.
540
541    config BLE_MESH_MSG_CACHE_SIZE
542        int "Network message cache size"
543        default 10
544        range 2 65535
545        help
546            Number of messages that are cached for the network. This helps prevent
547            unnecessary decryption operations and unnecessary relays. This option
548            is similar to Replay protection list, but has a different purpose.
549            A node is not required to cache the entire Network PDU and may cache
550            only part of it for tracking, such as values for SRC/SEQ or others.
551
552    config BLE_MESH_ADV_BUF_COUNT
553        int "Number of advertising buffers"
554        default 60
555        range 6 256
556        help
557            Number of advertising buffers available. The transport layer reserves
558            ADV_BUF_COUNT - 3 buffers for outgoing segments. The maximum outgoing
559            SDU size is 12 times this value (out of which 4 or 8 bytes are used
560            for the Transport Layer MIC). For example, 5 segments means the maximum
561            SDU size is 60 bytes, which leaves 56 bytes for application layer data
562            using a 4-byte MIC, or 52 bytes using an 8-byte MIC.
563
564    config BLE_MESH_IVU_DIVIDER
565        int "Divider for IV Update state refresh timer"
566        default 4
567        range 2 96
568        help
569            When the IV Update state enters Normal operation or IV Update
570            in Progress, we need to keep track of how many hours has passed
571            in the state, since the specification requires us to remain in
572            the state at least for 96 hours (Update in Progress has an
573            additional upper limit of 144 hours).
574
575            In order to fulfill the above requirement, even if the node might
576            be powered off once in a while, we need to store persistently
577            how many hours the node has been in the state. This doesn't
578            necessarily need to happen every hour (thanks to the flexible
579            duration range). The exact cadence will depend a lot on the
580            ways that the node will be used and what kind of power source it
581            has.
582
583            Since there is no single optimal answer, this configuration
584            option allows specifying a divider, i.e. how many intervals
585            the 96 hour minimum gets split into. After each interval the
586            duration that the node has been in the current state gets
587            stored to flash. E.g. the default value of 4 means that the
588            state is saved every 24 hours (96 / 4).
589
590    config BLE_MESH_IVU_RECOVERY_IVI
591        bool "Recovery the IV index when the latest whole IV update procedure is missed"
592        default n
593        help
594            According to Section 3.10.5 of Mesh Specification v1.0.1.
595            If a node in Normal Operation receives a Secure Network beacon with an IV index
596            equal to the last known IV index+1 and the IV Update Flag set to 0, the node may
597            update its IV without going to the IV Update in Progress state, or it may initiate
598            an IV Index Recovery procedure (Section 3.10.6), or it may ignore the Secure
599            Network beacon. The node makes the choice depending on the time since last IV
600            update and the likelihood that the node has missed the Secure Network beacons
601            with the IV update Flag.
602            When the above situation is encountered, this option can be used to decide whether
603            to perform the IV index recovery procedure.
604
605    config BLE_MESH_TX_SEG_MSG_COUNT
606        int "Maximum number of simultaneous outgoing segmented messages"
607        default 1
608        range 1 BLE_MESH_ADV_BUF_COUNT
609        help
610            Maximum number of simultaneous outgoing multi-segment and/or reliable messages.
611            The default value is 1, which means the device can only send one segmented
612            message at a time. And if another segmented message is going to be sent, it
613            should wait for the completion of the previous one.
614            If users are going to send multiple segmented messages at the same time, this
615            value should be configured properly.
616
617    config BLE_MESH_RX_SEG_MSG_COUNT
618        int "Maximum number of simultaneous incoming segmented messages"
619        default 1
620        range 1 255
621        help
622            Maximum number of simultaneous incoming multi-segment and/or reliable messages.
623            The default value is 1, which means the device can only receive one segmented
624            message at a time. And if another segmented message is going to be received,
625            it should wait for the completion of the previous one.
626            If users are going to receive multiple segmented messages at the same time, this
627            value should be configured properly.
628
629    config BLE_MESH_RX_SDU_MAX
630        int "Maximum incoming Upper Transport Access PDU length"
631        default 384
632        range 36 384
633        help
634            Maximum incoming Upper Transport Access PDU length. Leave this to the default
635            value, unless you really need to optimize memory usage.
636
637    config BLE_MESH_TX_SEG_MAX
638        int "Maximum number of segments in outgoing messages"
639        default 32
640        range 2 32
641        help
642            Maximum number of segments supported for outgoing messages.
643            This value should typically be fine-tuned based on what
644            models the local node supports, i.e. what's the largest
645            message payload that the node needs to be able to send.
646            This value affects memory and call stack consumption, which
647            is why the default is lower than the maximum that the
648            specification would allow (32 segments).
649
650            The maximum outgoing SDU size is 12 times this number (out of
651            which 4 or 8 bytes is used for the Transport Layer MIC). For
652            example, 5 segments means the maximum SDU size is 60 bytes,
653            which leaves 56 bytes for application layer data using a
654            4-byte MIC and 52 bytes using an 8-byte MIC.
655
656            Be sure to specify a sufficient number of advertising buffers
657            when setting this option to a higher value. There must be at
658            least three more advertising buffers (BLE_MESH_ADV_BUF_COUNT)
659            as there are outgoing segments.
660
661    config BLE_MESH_RELAY
662        bool "Relay support"
663        depends on BLE_MESH_NODE
664        default y
665        help
666            Support for acting as a Mesh Relay Node. Enabling this option will allow
667            a node to support the Relay feature, and the Relay feature can still
668            be enabled or disabled by proper configuration messages. Disabling this
669            option will let a node not support the Relay feature.
670
671    if BLE_MESH_RELAY
672
673        config BLE_MESH_RELAY_ADV_BUF
674            bool "Use separate advertising buffers for relay packets"
675            default n
676            help
677                When selected, self-send packets will be put in a high-priority
678                queue and relay packets will be put in a low-priority queue.
679
680        if BLE_MESH_RELAY_ADV_BUF
681
682            config BLE_MESH_RELAY_ADV_BUF_COUNT
683                int "Number of advertising buffers for relay packets"
684                default 60
685                range 6 256
686                help
687                    Number of advertising buffers for relay packets available.
688
689        endif # BLE_MESH_RELAY_ADV_BUF
690
691    endif # BLE_MESH_RELAY
692
693    config BLE_MESH_LOW_POWER
694        bool "Support for Low Power features"
695        depends on BLE_MESH_NODE
696        help
697            Enable this option to operate as a Low Power Node. If low power consumption
698            is required by a node, this option should be enabled. And once the node
699            enters the mesh network, it will try to find a Friend node and establish a
700            friendship.
701
702    if BLE_MESH_LOW_POWER
703
704        config BLE_MESH_LPN_ESTABLISHMENT
705            bool "Perform Friendship establishment using low power"
706            default n
707            help
708                Perform the Friendship establishment using low power with the help of a
709                reduced scan duty cycle. The downside of this is that the node may miss
710                out on messages intended for it until it has successfully set up Friendship
711                with a Friend node.
712                When this option is enabled, the node will stop scanning for a period of
713                time after a Friend Request or Friend Poll is sent, so as to reduce more
714                power consumption.
715
716        config BLE_MESH_LPN_AUTO
717            bool "Automatically start looking for Friend nodes once provisioned"
718            default n
719            help
720                Once provisioned, automatically enable LPN functionality and start looking
721                for Friend nodes. If this option is disabled LPN mode needs to be manually
722                enabled by calling bt_mesh_lpn_set(true).
723                When an unprovisioned device is provisioned successfully and becomes a node,
724                enabling this option will trigger the node starts to send Friend Request at
725                a certain period until it finds a proper Friend node.
726
727        config BLE_MESH_LPN_AUTO_TIMEOUT
728            int "Time from last received message before going to LPN mode"
729            default 15
730            range 0 3600
731            depends on BLE_MESH_LPN_AUTO
732            help
733                Time in seconds from the last received message, that the node waits out
734                before starting to look for Friend nodes.
735
736        config BLE_MESH_LPN_RETRY_TIMEOUT
737            int "Retry timeout for Friend requests"
738            default 6
739            range 1 3600
740            help
741                Time in seconds between Friend Requests, if a previous Friend Request did
742                not yield any acceptable Friend Offers.
743
744        config BLE_MESH_LPN_RSSI_FACTOR
745            int "RSSIFactor, used in Friend Offer Delay calculation"
746            range 0 3
747            default 0
748            help
749                The contribution of the RSSI, measured by the Friend node, used in Friend
750                Offer Delay calculations. 0 = 1, 1 = 1.5, 2 = 2, 3 = 2.5.
751                RSSIFactor, one of the parameters carried by Friend Request sent by Low Power
752                node, which is used to calculate the Friend Offer Delay.
753
754        config BLE_MESH_LPN_RECV_WIN_FACTOR
755            int "ReceiveWindowFactor, used in Friend Offer Delay calculation"
756            range 0 3
757            default 0
758            help
759                The contribution of the supported Receive Window used in Friend Offer
760                Delay calculations. 0 = 1, 1 = 1.5, 2 = 2, 3 = 2.5.
761                ReceiveWindowFactor, one of the parameters carried by Friend Request sent by
762                Low Power node, which is used to calculate the Friend Offer Delay.
763
764        config BLE_MESH_LPN_MIN_QUEUE_SIZE
765            int "Minimum size of the acceptable friend queue (MinQueueSizeLog)"
766            range 1 7
767            default 1
768            help
769                The MinQueueSizeLog field is defined as log_2(N), where N is the minimum
770                number of maximum size Lower Transport PDUs that the Friend node can store
771                in its Friend Queue. As an example, MinQueueSizeLog value 1 gives N = 2,
772                and value 7 gives N = 128.
773
774        config BLE_MESH_LPN_RECV_DELAY
775            int "Receive delay requested by the local node"
776            range 10 255
777            default 100
778            help
779                The ReceiveDelay is the time between the Low Power node sending a
780                request and listening for a response. This delay allows the Friend
781                node time to prepare the response. The value is in units of milliseconds.
782
783        config BLE_MESH_LPN_POLL_TIMEOUT
784            int "The value of the PollTimeout timer"
785            range 10 244735
786            default 300
787            help
788                PollTimeout timer is used to measure time between two consecutive
789                requests sent by a Low Power node. If no requests are received
790                the Friend node before the PollTimeout timer expires, then the
791                friendship is considered terminated. The value is in units of 100
792                milliseconds, so e.g. a value of 300 means 30 seconds.
793                The smaller the value, the faster the Low Power node tries to get
794                messages from corresponding Friend node and vice versa.
795
796        config BLE_MESH_LPN_INIT_POLL_TIMEOUT
797            int "The starting value of the PollTimeout timer"
798            range 10 BLE_MESH_LPN_POLL_TIMEOUT
799            default BLE_MESH_LPN_POLL_TIMEOUT
800            help
801                The initial value of the PollTimeout timer when Friendship is to be
802                established for the first time. After this, the timeout gradually
803                grows toward the actual PollTimeout, doubling in value for each iteration.
804                The value is in units of 100 milliseconds, so e.g. a value of 300 means
805                30 seconds.
806
807        config BLE_MESH_LPN_SCAN_LATENCY
808            int "Latency for enabling scanning"
809            range 0 50
810            default 10
811            help
812                Latency (in milliseconds) is the time it takes to enable scanning. In
813                practice, it means how much time in advance of the Receive Window, the
814                request to enable scanning is made.
815
816        config BLE_MESH_LPN_GROUPS
817            int "Number of groups the LPN can subscribe to"
818            range 0 16384
819            default 8
820            help
821                Maximum number of groups to which the LPN can subscribe.
822
823        config BLE_MESH_LPN_SUB_ALL_NODES_ADDR
824            bool "Automatically subscribe all nodes address"
825            default n
826            help
827                Automatically subscribe all nodes address when friendship
828                established.
829
830    endif # BLE_MESH_LOW_POWER
831
832    config BLE_MESH_FRIEND
833        bool "Support for Friend feature"
834        help
835            Enable this option to be able to act as a Friend Node.
836
837    if BLE_MESH_FRIEND
838
839        config BLE_MESH_FRIEND_RECV_WIN
840            int "Friend Receive Window"
841            range 1 255
842            default 255
843            help
844                Receive Window in milliseconds supported by the Friend node.
845
846        config BLE_MESH_FRIEND_QUEUE_SIZE
847            int "Minimum number of buffers supported per Friend Queue"
848            range 2 65536
849            default 16
850            help
851                Minimum number of buffers available to be stored for each local Friend Queue.
852                This option decides the size of each buffer which can be used by a Friend node
853                to store messages for each Low Power node.
854
855        config BLE_MESH_FRIEND_SUB_LIST_SIZE
856            int "Friend Subscription List Size"
857            range 0 1023
858            default 3
859            help
860                Size of the Subscription List that can be supported by a Friend node for a
861                Low Power node. And Low Power node can send Friend Subscription List Add or
862                Friend Subscription List Remove messages to the Friend node to add or remove
863                subscription addresses.
864
865        config BLE_MESH_FRIEND_LPN_COUNT
866            int "Number of supported LPN nodes"
867            range 1 1000
868            default 2
869            help
870                Number of Low Power Nodes with which a Friend can have Friendship simultaneously.
871                A Friend node can have friendship with multiple Low Power nodes at the same time,
872                while a Low Power node can only establish friendship with only one Friend node at
873                the same time.
874
875        config BLE_MESH_FRIEND_SEG_RX
876            int "Number of incomplete segment lists per LPN"
877            range 1 1000
878            default 1
879            help
880                Number of incomplete segment lists tracked for each Friends' LPN.
881                In other words, this determines from how many elements can segmented
882                messages destined for the Friend queue be received simultaneously.
883
884    endif # BLE_MESH_FRIEND
885
886    config BLE_MESH_NO_LOG
887        bool "Disable BLE Mesh debug logs (minimize bin size)"
888        depends on BLE_MESH
889        default n
890        help
891            Select this to save the BLE Mesh related rodata code size. Enabling this option
892            will disable the output of BLE Mesh debug log.
893
894    menu "BLE Mesh STACK DEBUG LOG LEVEL"
895        depends on BLE_MESH && !BLE_MESH_NO_LOG
896
897        choice BLE_MESH_STACK_TRACE_LEVEL
898            prompt "BLE_MESH_STACK"
899            default BLE_MESH_TRACE_LEVEL_WARNING
900            depends on BLE_MESH && !BLE_MESH_NO_LOG
901            help
902                Define BLE Mesh trace level for BLE Mesh stack.
903
904            config BLE_MESH_TRACE_LEVEL_NONE
905                bool "NONE"
906            config BLE_MESH_TRACE_LEVEL_ERROR
907                bool "ERROR"
908            config BLE_MESH_TRACE_LEVEL_WARNING
909                bool "WARNING"
910            config BLE_MESH_TRACE_LEVEL_INFO
911                bool "INFO"
912            config BLE_MESH_TRACE_LEVEL_DEBUG
913                bool "DEBUG"
914            config BLE_MESH_TRACE_LEVEL_VERBOSE
915                bool "VERBOSE"
916        endchoice
917
918        config BLE_MESH_STACK_TRACE_LEVEL
919            int
920            depends on BLE_MESH
921            default 0 if BLE_MESH_TRACE_LEVEL_NONE
922            default 1 if BLE_MESH_TRACE_LEVEL_ERROR
923            default 2 if BLE_MESH_TRACE_LEVEL_WARNING
924            default 3 if BLE_MESH_TRACE_LEVEL_INFO
925            default 4 if BLE_MESH_TRACE_LEVEL_DEBUG
926            default 5 if BLE_MESH_TRACE_LEVEL_VERBOSE
927            default 2
928
929    endmenu #BLE Mesh DEBUG LOG LEVEL
930
931    menu "BLE Mesh NET BUF DEBUG LOG LEVEL"
932        depends on BLE_MESH && !BLE_MESH_NO_LOG
933
934        choice BLE_MESH_NET_BUF_TRACE_LEVEL
935            prompt "BLE_MESH_NET_BUF"
936            default BLE_MESH_NET_BUF_TRACE_LEVEL_WARNING
937            depends on BLE_MESH && !BLE_MESH_NO_LOG
938            help
939                Define BLE Mesh trace level for BLE Mesh net buffer.
940
941            config BLE_MESH_NET_BUF_TRACE_LEVEL_NONE
942                bool "NONE"
943            config BLE_MESH_NET_BUF_TRACE_LEVEL_ERROR
944                bool "ERROR"
945            config BLE_MESH_NET_BUF_TRACE_LEVEL_WARNING
946                bool "WARNING"
947            config BLE_MESH_NET_BUF_TRACE_LEVEL_INFO
948                bool "INFO"
949            config BLE_MESH_NET_BUF_TRACE_LEVEL_DEBUG
950                bool "DEBUG"
951            config BLE_MESH_NET_BUF_TRACE_LEVEL_VERBOSE
952                bool "VERBOSE"
953        endchoice
954
955        config BLE_MESH_NET_BUF_TRACE_LEVEL
956            int
957            depends on BLE_MESH
958            default 0 if BLE_MESH_NET_BUF_TRACE_LEVEL_NONE
959            default 1 if BLE_MESH_NET_BUF_TRACE_LEVEL_ERROR
960            default 2 if BLE_MESH_NET_BUF_TRACE_LEVEL_WARNING
961            default 3 if BLE_MESH_NET_BUF_TRACE_LEVEL_INFO
962            default 4 if BLE_MESH_NET_BUF_TRACE_LEVEL_DEBUG
963            default 5 if BLE_MESH_NET_BUF_TRACE_LEVEL_VERBOSE
964            default 2
965
966    endmenu #BLE Mesh NET BUF DEBUG LOG LEVEL
967
968    config BLE_MESH_CLIENT_MSG_TIMEOUT
969        int "Timeout(ms) for client message response"
970        range 100 1200000
971        default 4000
972        help
973            Timeout value used by the node to get response of the acknowledged
974            message which is sent by the client model.
975            This value indicates the maximum time that a client model waits for
976            the response of the sent acknowledged messages. If a client model
977            uses 0 as the timeout value when sending acknowledged messages, then
978            the default value will be used which is four seconds.
979
980    menu "Support for BLE Mesh Foundation models"
981
982        config BLE_MESH_CFG_CLI
983            bool "Configuration Client model"
984            help
985                Enable support for Configuration Client model.
986
987        config BLE_MESH_HEALTH_CLI
988            bool "Health Client model"
989            help
990                Enable support for Health Client model.
991
992        config BLE_MESH_HEALTH_SRV
993            bool "Health Server model"
994            default y
995            help
996                Enable support for Health Server model.
997
998    endmenu #Support for BLE Mesh Foundation models
999
1000    menu "Support for BLE Mesh Client/Server models"
1001
1002        config BLE_MESH_GENERIC_ONOFF_CLI
1003            bool "Generic OnOff Client model"
1004            help
1005                Enable support for Generic OnOff Client model.
1006
1007        config BLE_MESH_GENERIC_LEVEL_CLI
1008            bool "Generic Level Client model"
1009            help
1010                Enable support for Generic Level Client model.
1011
1012        config BLE_MESH_GENERIC_DEF_TRANS_TIME_CLI
1013            bool "Generic Default Transition Time Client model"
1014            help
1015                Enable support for Generic Default Transition Time Client model.
1016
1017        config BLE_MESH_GENERIC_POWER_ONOFF_CLI
1018            bool "Generic Power OnOff Client model"
1019            help
1020                Enable support for Generic Power OnOff Client model.
1021
1022        config BLE_MESH_GENERIC_POWER_LEVEL_CLI
1023            bool "Generic Power Level Client model"
1024            help
1025                Enable support for Generic Power Level Client model.
1026
1027        config BLE_MESH_GENERIC_BATTERY_CLI
1028            bool "Generic Battery Client model"
1029            help
1030                Enable support for Generic Battery Client model.
1031
1032        config BLE_MESH_GENERIC_LOCATION_CLI
1033            bool "Generic Location Client model"
1034            help
1035                Enable support for Generic Location Client model.
1036
1037        config BLE_MESH_GENERIC_PROPERTY_CLI
1038            bool "Generic Property Client model"
1039            help
1040                Enable support for Generic Property Client model.
1041
1042        config BLE_MESH_SENSOR_CLI
1043            bool "Sensor Client model"
1044            help
1045                Enable support for Sensor Client model.
1046
1047        config BLE_MESH_TIME_CLI
1048            bool "Time Client model"
1049            help
1050                Enable support for Time Client model.
1051
1052        config BLE_MESH_SCENE_CLI
1053            bool "Scene Client model"
1054            help
1055                Enable support for Scene Client model.
1056
1057        config BLE_MESH_SCHEDULER_CLI
1058            bool "Scheduler Client model"
1059            help
1060                Enable support for Scheduler Client model.
1061
1062        config BLE_MESH_LIGHT_LIGHTNESS_CLI
1063            bool "Light Lightness Client model"
1064            help
1065                Enable support for Light Lightness Client model.
1066
1067        config BLE_MESH_LIGHT_CTL_CLI
1068            bool "Light CTL Client model"
1069            help
1070                Enable support for Light CTL Client model.
1071
1072        config BLE_MESH_LIGHT_HSL_CLI
1073            bool "Light HSL Client model"
1074            help
1075                Enable support for Light HSL Client model.
1076
1077        config BLE_MESH_LIGHT_XYL_CLI
1078            bool "Light XYL Client model"
1079            help
1080                Enable support for Light XYL Client model.
1081
1082        config BLE_MESH_LIGHT_LC_CLI
1083            bool "Light LC Client model"
1084            help
1085                Enable support for Light LC Client model.
1086
1087        config BLE_MESH_GENERIC_SERVER
1088            bool "Generic server models"
1089            default y
1090            help
1091                Enable support for Generic server models.
1092
1093        config BLE_MESH_SENSOR_SERVER
1094            bool "Sensor server models"
1095            default y
1096            help
1097                Enable support for Sensor server models.
1098
1099        config BLE_MESH_TIME_SCENE_SERVER
1100            bool "Time and Scenes server models"
1101            default y
1102            help
1103                Enable support for Time and Scenes server models.
1104
1105        config BLE_MESH_LIGHTING_SERVER
1106            bool "Lighting server models"
1107            default y
1108            help
1109                Enable support for Lighting server models.
1110
1111    endmenu #Support for BLE Mesh Client/Server models
1112
1113    config BLE_MESH_IV_UPDATE_TEST
1114        bool "Test the IV Update Procedure"
1115        default n
1116        help
1117            This option removes the 96 hour limit of the IV Update Procedure and
1118            lets the state to be changed at any time.
1119            If IV Update test mode is going to be used, this option should be enabled.
1120
1121    config BLE_MESH_DISCARD_OLD_SEQ_AUTH
1122        bool
1123        default y
1124        help
1125            This option is used to decide whether discarding the old SeqAuth when
1126            receiving a segmented message.
1127
1128    menu "BLE Mesh specific test option"
1129
1130        config BLE_MESH_SELF_TEST
1131            bool "Perform BLE Mesh self-tests"
1132            default n
1133            help
1134                This option adds extra self-tests which are run every time BLE Mesh
1135                networking is initialized.
1136
1137        config BLE_MESH_BQB_TEST
1138            bool "Enable BLE Mesh specific internal test"
1139            default n
1140            help
1141                This option is used to enable some internal functions for auto-pts test.
1142
1143        config BLE_MESH_BQB_TEST_LOG
1144            bool
1145            depends on BLE_MESH_BQB_TEST
1146            default y
1147            help
1148                This option is used to enable the log of auto-pts test.
1149
1150        if BLE_MESH_SELF_TEST
1151
1152            config BLE_MESH_TEST_AUTO_ENTER_NETWORK
1153                bool "Unprovisioned device enters mesh network automatically"
1154                default y
1155                help
1156                    With this option enabled, an unprovisioned device can automatically
1157                    enters mesh network using a specific test function without the pro-
1158                    visioning procedure. And on the Provisioner side, a test function
1159                    needs to be invoked to add the node information into the mesh stack.
1160
1161            config BLE_MESH_TEST_USE_WHITE_LIST
1162                bool "Use white list to filter mesh advertising packets"
1163                default n
1164                help
1165                    With this option enabled, users can use white list to filter mesh
1166                    advertising packets while scanning.
1167
1168        endif # BLE_MESH_SELF_TEST
1169
1170        config BLE_MESH_SHELL
1171            bool "Enable BLE Mesh shell"
1172            default n
1173            help
1174                Activate shell module that provides BLE Mesh commands to the console.
1175
1176        config BLE_MESH_DEBUG
1177            bool "Enable BLE Mesh debug logs"
1178            default n
1179            help
1180                Enable debug logs for the BLE Mesh functionality.
1181
1182        if BLE_MESH_DEBUG
1183
1184            config BLE_MESH_DEBUG_NET
1185                bool "Network layer debug"
1186                help
1187                    Enable Network layer debug logs for the BLE Mesh functionality.
1188
1189            config BLE_MESH_DEBUG_TRANS
1190                bool "Transport layer debug"
1191                help
1192                    Enable Transport layer debug logs for the BLE Mesh functionality.
1193
1194            config BLE_MESH_DEBUG_BEACON
1195                bool "Beacon debug"
1196                help
1197                    Enable Beacon-related debug logs for the BLE Mesh functionality.
1198
1199            config BLE_MESH_DEBUG_CRYPTO
1200                bool "Crypto debug"
1201                help
1202                    Enable cryptographic debug logs for the BLE Mesh functionality.
1203
1204            config BLE_MESH_DEBUG_PROV
1205                bool "Provisioning debug"
1206                help
1207                    Enable Provisioning debug logs for the BLE Mesh functionality.
1208
1209            config BLE_MESH_DEBUG_ACCESS
1210                bool "Access layer debug"
1211                help
1212                    Enable Access layer debug logs for the BLE Mesh functionality.
1213
1214            config BLE_MESH_DEBUG_MODEL
1215                bool "Foundation model debug"
1216                help
1217                    Enable Foundation Models debug logs for the BLE Mesh functionality.
1218
1219            config BLE_MESH_DEBUG_ADV
1220                bool "Advertising debug"
1221                help
1222                    Enable advertising debug logs for the BLE Mesh functionality.
1223
1224            config BLE_MESH_DEBUG_LOW_POWER
1225                bool "Low Power debug"
1226                help
1227                    Enable Low Power debug logs for the BLE Mesh functionality.
1228
1229            config BLE_MESH_DEBUG_FRIEND
1230                bool "Friend debug"
1231                help
1232                    Enable Friend debug logs for the BLE Mesh functionality.
1233
1234            config BLE_MESH_DEBUG_PROXY
1235                bool "Proxy debug"
1236                depends on BLE_MESH_PROXY
1237                help
1238                    Enable Proxy protocol debug logs for the BLE Mesh functionality.
1239
1240        endif # BLE_MESH_DEBUG
1241
1242    endmenu
1243
1244endif # BLE_MESH
1245