1# Copyright Nordic Semiconductor ASA 2023. All rights reserved.
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig MCUMGR_GRP_SETTINGS
5	bool "MCUmgr handlers for settings management"
6	depends on SETTINGS
7	depends on SETTINGS_RUNTIME
8	select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_2
9	select MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_2 if ZCBOR_CANONICAL
10	select MCUMGR_SMP_CBOR_MIN_ENCODING_LEVEL_1
11	help
12	  Enables MCUmgr handlers for settings manipulation.
13
14if MCUMGR_GRP_SETTINGS
15
16choice MCUMGR_GRP_SETTINGS_BUFFER_TYPE
17	prompt "Buffer type"
18	default MCUMGR_GRP_SETTINGS_BUFFER_TYPE_STACK
19	help
20	  Selects if the stack or heap will be used for variables that are
21	  needed when processing requests.
22
23config MCUMGR_GRP_SETTINGS_BUFFER_TYPE_STACK
24	bool "Stack (fixed size)"
25	help
26	  Use a fixed size stack buffer, any user-supplied values longer than
27	  this will be rejected.
28
29	  Note that stack usage for parameter storage alone will be
30	  MCUMGR_GRP_SETTINGS_NAME_LEN + MCUMGR_GRP_SETTINGS_VALUE_LEN,
31	  therefore the MCUmgr stack should be appropriately sized.
32
33config MCUMGR_GRP_SETTINGS_BUFFER_TYPE_HEAP
34	bool "Heap (dynamic size)"
35	depends on COMMON_LIBC_MALLOC_ARENA_SIZE > 0
36	help
37	  Use dynamic heap memory allocation through malloc, if there is
38	  insufficient heap memory for the allocation then the request will be
39	  rejected.
40
41endchoice
42
43config MCUMGR_GRP_SETTINGS_NAME_LEN
44	int "Maximum setting name length"
45	default 32
46	help
47	  Maximum length of a key to lookup, this will be the size of the
48	  variable if placed on the stack or the maximum allocated size of the
49	  variable if placed on the heap.
50
51config MCUMGR_GRP_SETTINGS_VALUE_LEN
52	int "Maximum setting value length"
53	default 32
54	help
55	  Maximum length of a value to read, this will be the size of the
56	  variable if placed on the stack or the allocated size of the
57	  variable if placed on the heap (settings does not support getting
58	  the size of a value prior to looking it up).
59
60config MCUMGR_GRP_SETTINGS_ACCESS_HOOK
61	bool "Settings access hook"
62	depends on MCUMGR_MGMT_NOTIFICATION_HOOKS
63	help
64	  Allows applications to control settings management access by
65	  registering for a callback which is then triggered whenever a
66	  settings read or write attempt is made.
67
68endif
69