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 PSA_WANT_ALG_ECB_NO_PADDING
122	imply MBEDTLS_AES_ROM_TABLES if MBEDTLS_PSA_CRYPTO_C
123	help
124	  This option enables support for GATT Caching. When enabled the stack
125	  will register Client Supported Features and Database Hash
126	  characteristics which can be used by clients to detect if anything has
127	  changed on the GATT database.
128
129if BT_GATT_CACHING
130
131config BT_GATT_NOTIFY_MULTIPLE
132	bool "GATT Notify Multiple Characteristic Values support"
133	depends on BT_GATT_CACHING
134	help
135	  This option enables support for the GATT Notify Multiple
136	  Characteristic Values procedure.
137
138if BT_GATT_NOTIFY_MULTIPLE
139
140config BT_GATT_NOTIFY_MULTIPLE_FLUSH_MS
141	int "Delay for batching multiple notifications in a single PDU."
142	default 1
143	range 0 4000
144	help
145	  Sets the time (in milliseconds) during which consecutive GATT
146	  notifications will be tentatively appended to form a single
147	  ATT_MULTIPLE_HANDLE_VALUE_NTF PDU.
148
149	  If set to 0, batching is disabled. Then, the only way to send
150	  ATT_MULTIPLE_HANDLE_VALUE_NTF PDUs is to use bt_gatt_notify_multiple.
151
152	  See the documentation of bt_gatt_notify() for more details.
153
154endif # BT_GATT_NOTIFY_MULTIPLE
155
156config BT_GATT_ENFORCE_CHANGE_UNAWARE
157	bool "GATT Enforce change-unaware state"
158	depends on BT_GATT_CACHING
159	help
160	  When enable this option blocks notification and indications to client
161	  to conform to the following statement from the Bluetooth 5.1
162	  specification:
163	  '...the server shall not send notifications and indications to such
164	  a client until it becomes change-aware."
165	  In case the service cannot deal with sudden errors (-EAGAIN) then it
166	  shall not use this option.
167
168endif # BT_GATT_CACHING
169
170config BT_GATT_ENFORCE_SUBSCRIPTION
171	bool "GATT Enforce characteristic subscription"
172	default y
173	help
174	  When enabled, this option will make the server block sending
175	  notifications and indications to a device which has not subscribed to
176	  the supplied characteristic.
177
178config BT_GATT_CLIENT
179	bool "GATT client support"
180	help
181	  This option enables support for the GATT Client role.
182
183config BT_GATT_READ_MULTIPLE
184	bool "GATT Read Multiple Characteristic Values support"
185	default y
186	help
187	  This option enables support for the GATT Read Multiple Characteristic
188	  Values procedure.
189
190config BT_GATT_READ_MULT_VAR_LEN
191	bool "GATT Read Multiple Variable Length Characteristic Values support"
192	default y
193	help
194	  This option enables support for the GATT Read Multiple Variable Length
195	  Characteristic Values procedure. Mandatory if EATT is enabled, optional
196	  otherwise (Core spec v5.3, Vol 3, Part G, Section 4.2, Table 4.1).
197
198config BT_GATT_AUTO_DISCOVER_CCC
199	bool "Support to automatic discover the CCC handles of characteristics"
200	depends on BT_GATT_CLIENT
201	help
202	  This option enables support for GATT to initiate discovery for CCC
203	  handles if the CCC handle is unknown by the application.
204
205config BT_GATT_AUTO_UPDATE_MTU
206	bool "Automatically send ATT MTU exchange request on connect"
207	depends on BT_GATT_CLIENT
208	help
209	  This option if enabled allows automatically sending request for ATT
210	  MTU exchange.
211
212config BT_GAP_AUTO_UPDATE_CONN_PARAMS
213	bool "Automatic Update of Connection Parameters"
214	default y
215	depends on BT_PERIPHERAL
216	help
217	  This option if enabled allows automatically sending request for connection
218	  parameters update after GAP recommended 5 seconds of connection as
219	  peripheral.
220
221config BT_GAP_PERIPHERAL_PREF_PARAMS
222	bool "Configure peripheral preferred connection parameters"
223	default y
224	depends on BT_PERIPHERAL
225	help
226	  This allows to configure peripheral preferred connection parameters.
227	  Enabling this option results in adding PPCP characteristic in GAP.
228	  If disabled it is up to application to set expected connection parameters.
229
230if BT_GAP_PERIPHERAL_PREF_PARAMS
231config BT_PERIPHERAL_PREF_MIN_INT
232	int "Peripheral preferred minimum connection interval in 1.25ms units"
233	default 24
234	range 6 $(UINT16_MAX) if !BT_CONN_PARAM_ANY
235	help
236	  Range 3200 to 65534 is invalid. 65535 represents no specific value.
237
238config BT_PERIPHERAL_PREF_MAX_INT
239	int "Peripheral preferred maximum connection interval in 1.25ms units"
240	default 40
241	range 6 $(UINT16_MAX) if !BT_CONN_PARAM_ANY
242	help
243	  Range 3200 to 65534 is invalid. 65535 represents no specific value.
244
245config BT_PERIPHERAL_PREF_LATENCY
246	int "Peripheral preferred peripheral latency in Connection Intervals"
247	default 0
248	range 0 499 if !BT_CONN_PARAM_ANY
249
250config BT_PERIPHERAL_PREF_TIMEOUT
251	int "Peripheral preferred supervision timeout in 10ms units"
252	default 42
253	range 10 $(UINT16_MAX) if !BT_CONN_PARAM_ANY
254	help
255	  It is up to user to provide valid timeout which pass required minimum
256	  value: in milliseconds it shall be larger than
257	  "(1+ Conn_Latency) * Conn_Interval_Max * 2"
258	  where Conn_Interval_Max is given in milliseconds.
259	  Range 3200 to 65534 is invalid. 65535 represents no specific value.
260endif # BT_GAP_PERIPHERAL_PREF_PARAMS
261
262config BT_DEVICE_NAME_GATT_WRITABLE
263	bool "Allow to write device name by remote GATT clients"
264	depends on BT_DEVICE_NAME_DYNAMIC
265	default y
266	help
267	  Enabling this option allows remote GATT clients to write to device
268	  name GAP characteristic.
269
270if BT_DEVICE_NAME_GATT_WRITABLE
271choice BT_DEVICE_NAME_GATT_WRITABLE_SECURITY
272	prompt "Security requirements"
273	default DEVICE_NAME_GATT_WRITABLE_ENCRYPT
274	help
275	  Select security requirementsf for writing device name by remote GATT
276	  clients.
277
278config DEVICE_NAME_GATT_WRITABLE_NONE
279	bool "No requirements"
280
281config DEVICE_NAME_GATT_WRITABLE_ENCRYPT
282	bool "Encryption required"
283
284config DEVICE_NAME_GATT_WRITABLE_AUTHEN
285	bool "Encryption and authentication required"
286
287endchoice  #BT_DEVICE_NAME_GATT_WRITABLE_SECURITY
288endif #BT_DEVICE_NAME_GATT_WRITABLE
289
290config BT_DEVICE_APPEARANCE_GATT_WRITABLE
291	bool "Allow to write GAP Appearance by remote GATT clients"
292	depends on BT_DEVICE_APPEARANCE_DYNAMIC
293	default y
294	help
295	  Enabling this option allows remote GATT clients to write to device
296	  appearance GAP characteristic.
297
298if BT_DEVICE_APPEARANCE_GATT_WRITABLE
299choice BT_DEVICE_APPEARANCE_GATT_WRITABLE
300	prompt "Security requirements"
301	default DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN
302	help
303	  Select security requirementsf for writing device name by remote GATT
304	  clients.
305
306config BT_DEVICE_APPEARANCE_GATT_WRITABLE_NONE
307	bool "No requirements"
308
309config BT_DEVICE_APPEARANCE_GATT_WRITABLE_ENCRYPT
310	bool "Encryption required"
311
312config DEVICE_APPEARANCE_GATT_WRITABLE_AUTHEN
313	bool "Encryption and authentication required"
314
315endchoice  #BT_DEVICE_APPEARANCE_GATT_WRITABLE
316endif #BT_DEVICE_APPEARANCE_GATT_WRITABLE
317
318config BT_GATT_AUTHORIZATION_CUSTOM
319	bool "Custom authorization of GATT operations"
320	help
321	  This option allows the user to define application-specific
322	  authorization logic for GATT operations that can be registered
323	  with the bt_gatt_authorization_cb_register API. See the API
324	  documentation for more details.
325
326endmenu
327