1# Copyright Nordic Semiconductor ASA 2024. All rights reserved.
2# SPDX-License-Identifier: Apache-2.0
3
4# The Kconfig file is dedicated to enumeration management group of
5# of MCUmgr subsystem and provides Kconfig options to configure
6# group commands behaviour and other aspects.
7#
8# Options defined in this file should be prefixed:
9#  MCUMGR_GRP_ENUM_ -- general group options;
10#
11# When adding Kconfig options, that control the same feature,
12# try to group them together by the same stem after prefix.
13
14menuconfig MCUMGR_GRP_ENUM
15	bool "MCUmgr handlers for enumeration management"
16	select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_2
17	select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_3 if ZCBOR_CANONICAL
18	help
19	  Enables MCUmgr handlers for enumeration management. This allows
20	  for listing supported command groups.
21
22if MCUMGR_GRP_ENUM
23
24menuconfig MCUMGR_GRP_ENUM_DETAILS
25	bool "Group details command"
26	select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_3
27	select MCUMGR_SMP_CBOR_MIN_DECODING_LEVEL_4 if ZCBOR_CANONICAL
28	help
29	  Implements functionality for listing details about groups.
30
31	  Note: responses to this command can be very large
32
33if MCUMGR_GRP_ENUM_DETAILS
34
35config MCUMGR_GRP_ENUM_DETAILS_NAME
36	bool "Include group names in detail response"
37	default y
38	help
39	  Will include the name of groups in the detail command response.
40
41config MCUMGR_GRP_ENUM_DETAILS_HANDLERS
42	bool "Include group names in detail response"
43	default y
44	help
45	  Will include the number of handlers of groups in the detail command response.
46
47choice MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE
48	prompt "Buffer type"
49	default MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE_STACK
50	help
51	  Selects if the stack or heap will be used for variables that are needed when processing
52	  requests.
53
54menuconfig MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE_STACK
55	bool "Stack (fixed size)"
56	help
57	  Use a fixed size stack buffer, any user-supplied values longer than this will be
58	  rejected.
59
60	  Note that stack usage for parameter storage alone will be
61	  MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE_STACK * 2, therefore the MCUmgr stack should
62	  be appropriately sized.
63
64if MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE_STACK
65
66config MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE_STACK_ENTRIES
67	int "Maximum list item entries"
68	range 1 65535
69	default 16
70	help
71	  The number of maximum values in the list for the details command to support, each value
72	  occupies 2 bytes on the stack.
73
74endif # MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE_STACK
75
76config MCUMGR_GRP_ENUM_DETAILS_BUFFER_TYPE_HEAP
77	bool "Heap (dynamic size)"
78	depends on COMMON_LIBC_MALLOC_ARENA_SIZE > 0
79	help
80	  Use dynamic heap memory allocation through malloc, if there is insufficient heap memory
81	  for the allocation then the request will be rejected.
82
83endchoice
84
85config MCUMGR_GRP_ENUM_DETAILS_HOOK
86	bool "Callback hook"
87	depends on MCUMGR_MGMT_NOTIFICATION_HOOKS
88	help
89	  Allows applications to add additional fields to responses for the details of supported
90	  command groups.
91
92config MCUMGR_GRP_ENUM_DETAILS_STATES
93	int
94	prompt "Predicted maximum number of entries per group" if MCUMGR_GRP_ENUM_DETAILS_HOOK
95	range 3 32
96	default 3
97	help
98	  This is used for defining CBOR map holding group data. The value does not affect memory
99	  allocation, it is used by zcbor to figure out how to encode map depending on its
100	  predicted size. This value should be increased from the default value by the number of
101	  additional fields that are returned by hooks.
102
103endif # MCUMGR_GRP_ENUM_DETAILS
104
105module = MCUMGR_GRP_ENUM
106module-str = mcumgr_grp_enum
107source "subsys/logging/Kconfig.template.log_config"
108
109endif # MCUMGR_GRP_ENUM
110