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