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