1# Bluetooth ATT/GATT configuration options
2
3# Copyright (c) 2019 Intel Corporation
4# SPDX-License-Identifier: Apache-2.0
5
6menu "ATT and GATT Options"
7
8config BT_ATT_ERR_TO_STR
9	bool "Print ATT error codes as strings [EXPERIMENTAL]"
10	select EXPERIMENTAL
11	help
12	  This configuration enables printing of ATT error
13	  codes represented as strings.
14	  See bt_att_err_to_str() for more details.
15
16config BT_ATT_TX_COUNT
17	int "Number of ATT buffers"
18	default BT_BUF_ACL_TX_COUNT
19	default 3
20	range 1 $(UINT8_MAX)
21	help
22	  These buffers are only used for sending anything over ATT.
23	  Requests, responses, indications, confirmations, notifications.
24
25config BT_ATT_PREPARE_COUNT
26	int "Number of ATT prepare write buffers"
27	default 0
28	range 0 64
29	help
30	  Number of buffers available for ATT prepare write, setting
31	  this to 0 disables GATT long/reliable writes.
32
33config BT_ATT_RETRY_ON_SEC_ERR
34	bool "Automatic security elevation and retry on security errors"
35	default y
36	depends on BT_SMP
37	help
38	  If an ATT request fails due to insufficient security, the host will
39	  try to elevate the security level and retry the ATT request.
40
41config BT_EATT
42	bool "Enhanced ATT Bearers support [EXPERIMENTAL]"
43	depends on BT_L2CAP_ECRED
44	select EXPERIMENTAL
45	select BT_GATT_READ_MULT_VAR_LEN
46	help
47	  This option enables support for Enhanced ATT bearers support. When
48	  enabled additional L2CAP channels can be connected as bearers enabling
49	  multiple outstanding request.
50
51if BT_EATT
52
53config BT_EATT_MAX
54	int "Maximum number of Enhanced ATT bearers"
55	default 3
56	range 1 16
57
58	help
59	  Number of Enhanced ATT bearers available.
60
61
62config BT_EATT_AUTO_CONNECT
63	bool "Automatically connect EATT bearers when a link is established"
64	default y
65	help
66	  The device will try to connect BT_EATT_MAX enhanced ATT bearers when a
67	  connection to a peer is established.
68
69endif # BT_EATT
70
71config BT_GATT_AUTO_RESUBSCRIBE
72	bool "Automatic re-subscription to characteristics"
73	default y
74	imply BT_GATT_AUTO_SEC_REQ
75	depends on BT_GATT_CLIENT
76	help
77	  Quirk: upon re-establishing a bonded connection, assumes the remote
78	  forgot the CCC values and sets them again. If this behavior is not
79	  desired for a particular subscription, set the
80	  `BT_GATT_SUBSCRIBE_FLAG_NO_RESUB` flag.
81	  This also means that upon a reconnection, the application will get an
82	  unprompted call to its `subscribe` callback.
83
84config BT_GATT_AUTO_SEC_REQ
85	bool "Automatic security re-establishment request as a peripheral"
86	default y
87	depends on BT_SMP
88	help
89	  This option requests security re-establishment automatically whenever
90	  a reconnection to a GATT client is established and
91	  there are notifiable or indicatable characteristics for which security
92	  is required. This configuration option only applies to the peripheral
93	  role, which sends a Security Request for this purpose.
94	  When disabled, it is the application's responsibility to call
95	  bt_conn_set_security() to re-establish security prior to sending any
96	  notifications or indications on the characteristics that require
97	  security (unless the central does that first).
98	  This option has been introduced to avoid interoperability issues with
99	  commercially available central devices that react negatively to
100	  receiving a Security Request immediately after reconnection.
101
102config BT_GATT_SERVICE_CHANGED
103	bool "GATT Service Changed support"
104	default y
105	help
106	  This option enables support for the service changed characteristic.
107
108config BT_GATT_DYNAMIC_DB
109	bool "GATT dynamic database support"
110	depends on BT_GATT_SERVICE_CHANGED
111	help
112	  This option enables registering/unregistering services at runtime.
113
114config BT_GATT_CACHING
115	bool "GATT Caching support"
116	default y
117	depends on BT_GATT_SERVICE_CHANGED
118	depends on PSA_CRYPTO_CLIENT
119	select PSA_WANT_KEY_TYPE_AES
120	select PSA_WANT_ALG_CMAC
121	select MBEDTLS_AES_ROM_TABLES if MBEDTLS_PSA_CRYPTO_C
122	help
123	  This option enables support for GATT Caching. When enabled the stack
124	  will register Client Supported Features and Database Hash
125	  characteristics which can be used by clients to detect if anything has
126	  changed on the GATT database.
127
128if BT_GATT_CACHING
129
130config BT_GATT_NOTIFY_MULTIPLE
131	bool "GATT Notify Multiple Characteristic Values support"
132	depends on BT_GATT_CACHING
133	help
134	  This option enables support for the GATT Notify Multiple
135	  Characteristic Values procedure.
136
137if BT_GATT_NOTIFY_MULTIPLE
138
139config BT_GATT_NOTIFY_MULTIPLE_FLUSH_MS
140	int "Delay for batching multiple notifications in a single PDU."
141	default 1
142	range 0 4000
143	help
144	  Sets the time (in milliseconds) during which consecutive GATT
145	  notifications will be tentatively appended to form a single
146	  ATT_MULTIPLE_HANDLE_VALUE_NTF PDU.
147
148	  If set to 0, batching is disabled. Then, the only way to send
149	  ATT_MULTIPLE_HANDLE_VALUE_NTF PDUs is to use bt_gatt_notify_multiple.
150
151	  See the documentation of bt_gatt_notify() for more details.
152
153endif # BT_GATT_NOTIFY_MULTIPLE
154
155config BT_GATT_ENFORCE_CHANGE_UNAWARE
156	bool "GATT Enforce change-unaware state"
157	depends on BT_GATT_CACHING
158	help
159	  When enable this option blocks notification and indications to client
160	  to conform to the following statement from the Bluetooth 5.1
161	  specification:
162	  '...the server shall not send notifications and indications to such
163	  a client until it becomes change-aware."
164	  In case the service cannot deal with sudden errors (-EAGAIN) then it
165	  shall not use this option.
166
167endif # BT_GATT_CACHING
168
169config BT_GATT_ENFORCE_SUBSCRIPTION
170	bool "GATT Enforce characteristic subscription"
171	default y
172	help
173	  When enabled, this option will make the server block sending
174	  notifications and indications to a device which has not subscribed to
175	  the supplied characteristic.
176
177config BT_GATT_CLIENT
178	bool "GATT client support"
179	help
180	  This option enables support for the GATT Client role.
181
182config BT_GATT_READ_MULTIPLE
183	bool "GATT Read Multiple Characteristic Values support"
184	default y
185	help
186	  This option enables support for the GATT Read Multiple Characteristic
187	  Values procedure.
188
189config BT_GATT_READ_MULT_VAR_LEN
190	bool "GATT Read Multiple Variable Length Characteristic Values support"
191	default y
192	help
193	  This option enables support for the GATT Read Multiple Variable Length
194	  Characteristic Values procedure. Mandatory if EATT is enabled, optional
195	  otherwise (Core spec v5.3, Vol 3, Part G, Section 4.2, Table 4.1).
196
197config BT_GATT_AUTO_DISCOVER_CCC
198	bool "Support to automatic discover the CCC handles of characteristics"
199	depends on BT_GATT_CLIENT
200	help
201	  This option enables support for GATT to initiate discovery for CCC
202	  handles if the CCC handle is unknown by the application.
203
204config BT_GATT_AUTO_UPDATE_MTU
205	bool "Automatically send ATT MTU exchange request on connect"
206	depends on BT_GATT_CLIENT
207	help
208	  This option if enabled allows automatically sending request for ATT
209	  MTU exchange.
210
211config BT_GAP_AUTO_UPDATE_CONN_PARAMS
212	bool "Automatic Update of Connection Parameters"
213	default y
214	depends on BT_PERIPHERAL
215	help
216	  This option if enabled allows automatically sending request for connection
217	  parameters update after GAP recommended 5 seconds of connection as
218	  peripheral.
219
220config BT_GAP_PERIPHERAL_PREF_PARAMS
221	bool "Configure peripheral preferred connection parameters"
222	default y
223	depends on BT_PERIPHERAL
224	help
225	  This allows to configure peripheral preferred connection parameters.
226	  Enabling this option results in adding PPCP characteristic in GAP.
227	  If disabled it is up to application to set expected connection parameters.
228
229if BT_GAP_PERIPHERAL_PREF_PARAMS
230config BT_PERIPHERAL_PREF_MIN_INT
231	int "Peripheral preferred minimum connection interval in 1.25ms units"
232	default 24
233	range 6 $(UINT16_MAX) if !BT_CONN_PARAM_ANY
234	help
235	  Range 3200 to 65534 is invalid. 65535 represents no specific value.
236
237config BT_PERIPHERAL_PREF_MAX_INT
238	int "Peripheral preferred maximum connection interval in 1.25ms units"
239	default 40
240	range 6 $(UINT16_MAX) if !BT_CONN_PARAM_ANY
241	help
242	  Range 3200 to 65534 is invalid. 65535 represents no specific value.
243
244config BT_PERIPHERAL_PREF_LATENCY
245	int "Peripheral preferred peripheral latency in Connection Intervals"
246	default 0
247	range 0 499 if !BT_CONN_PARAM_ANY
248
249config BT_PERIPHERAL_PREF_TIMEOUT
250	int "Peripheral preferred supervision timeout in 10ms units"
251	default 42
252	range 10 $(UINT16_MAX) if !BT_CONN_PARAM_ANY
253	help
254	  It is up to user to provide valid timeout which pass required minimum
255	  value: in milliseconds it shall be larger than
256	  "(1+ Conn_Latency) * Conn_Interval_Max * 2"
257	  where Conn_Interval_Max is given in milliseconds.
258	  Range 3200 to 65534 is invalid. 65535 represents no specific value.
259endif # BT_GAP_PERIPHERAL_PREF_PARAMS
260
261config BT_DEVICE_NAME_GATT_WRITABLE
262	bool "Allow to write device name by remote GATT clients"
263	depends on BT_DEVICE_NAME_DYNAMIC
264	default y
265	help
266	  Enabling this option allows remote GATT clients to write to device
267	  name GAP characteristic.
268
269if BT_DEVICE_NAME_GATT_WRITABLE
270choice BT_DEVICE_NAME_GATT_WRITABLE_SECURITY
271	prompt "Security requirements"
272	default DEVICE_NAME_GATT_WRITABLE_ENCRYPT
273	help
274	  Select security requirementsf for writing device name by remote GATT
275	  clients.
276
277config DEVICE_NAME_GATT_WRITABLE_NONE
278	bool "No requirements"
279
280config DEVICE_NAME_GATT_WRITABLE_ENCRYPT
281	bool "Encryption required"
282
283config DEVICE_NAME_GATT_WRITABLE_AUTHEN
284	bool "Encryption and authentication required"
285
286endchoice  #BT_DEVICE_NAME_GATT_WRITABLE_SECURITY
287endif #BT_DEVICE_NAME_GATT_WRITABLE
288
289config BT_DEVICE_APPEARANCE_GATT_WRITABLE
290	bool "Allow to write GAP Appearance by remote GATT clients"
291	depends on BT_DEVICE_APPEARANCE_DYNAMIC
292	default y
293	help
294	  Enabling this option allows remote GATT clients to write to device
295	  appearance GAP characteristic.
296
297if BT_DEVICE_APPEARANCE_GATT_WRITABLE
298choice BT_DEVICE_APPEARANCE_GATT_WRITABLE
299	prompt "Security requirements"
300	default DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN
301	help
302	  Select security requirementsf for writing device name by remote GATT
303	  clients.
304
305config BT_DEVICE_APPEARANCE_GATT_WRITABLE_NONE
306	bool "No requirements"
307
308config BT_DEVICE_APPEARANCE_GATT_WRITABLE_ENCRYPT
309	bool "Encryption required"
310
311config DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN
312	bool "Encryption and authentication required"
313
314endchoice  #BT_DEVICE_APPEARANCE_GATT_WRITABLE
315endif #BT_DEVICE_APPEARANCE_GATT_WRITABLE
316
317config BT_GATT_AUTHORIZATION_CUSTOM
318	bool "Custom authorization of GATT operations"
319	help
320	  This option allows the user to define application-specific
321	  authorization logic for GATT operations that can be registered
322	  with the bt_gatt_authorization_cb_register API. See the API
323	  documentation for more details.
324
325endmenu
326