xref: /btstack/src/ble/att_db.h (revision 6de29f25a6b7f822713cac6d89d4a0744c1b2a4f)
1591423b2SMatthias Ringwald /*
2591423b2SMatthias Ringwald  * Copyright (C) 2014 BlueKitchen GmbH
3591423b2SMatthias Ringwald  *
4591423b2SMatthias Ringwald  * Redistribution and use in source and binary forms, with or without
5591423b2SMatthias Ringwald  * modification, are permitted provided that the following conditions
6591423b2SMatthias Ringwald  * are met:
7591423b2SMatthias Ringwald  *
8591423b2SMatthias Ringwald  * 1. Redistributions of source code must retain the above copyright
9591423b2SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer.
10591423b2SMatthias Ringwald  * 2. Redistributions in binary form must reproduce the above copyright
11591423b2SMatthias Ringwald  *    notice, this list of conditions and the following disclaimer in the
12591423b2SMatthias Ringwald  *    documentation and/or other materials provided with the distribution.
13591423b2SMatthias Ringwald  * 3. Neither the name of the copyright holders nor the names of
14591423b2SMatthias Ringwald  *    contributors may be used to endorse or promote products derived
15591423b2SMatthias Ringwald  *    from this software without specific prior written permission.
16591423b2SMatthias Ringwald  * 4. Any redistribution, use, or modification is done solely for
17591423b2SMatthias Ringwald  *    personal benefit and not for any commercial purpose or for
18591423b2SMatthias Ringwald  *    monetary gain.
19591423b2SMatthias Ringwald  *
20591423b2SMatthias Ringwald  * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
21591423b2SMatthias Ringwald  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22591423b2SMatthias Ringwald  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23591423b2SMatthias Ringwald  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
24591423b2SMatthias Ringwald  * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25591423b2SMatthias Ringwald  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26591423b2SMatthias Ringwald  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27591423b2SMatthias Ringwald  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28591423b2SMatthias Ringwald  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29591423b2SMatthias Ringwald  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
30591423b2SMatthias Ringwald  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31591423b2SMatthias Ringwald  * SUCH DAMAGE.
32591423b2SMatthias Ringwald  *
33591423b2SMatthias Ringwald  * Please inquire about commercial licensing options at
34591423b2SMatthias Ringwald  * [email protected]
35591423b2SMatthias Ringwald  *
36591423b2SMatthias Ringwald  */
37591423b2SMatthias Ringwald 
38591423b2SMatthias Ringwald 
3947a0820cSMatthias Ringwald #ifndef ATT_DB_H
4047a0820cSMatthias Ringwald #define ATT_DB_H
41591423b2SMatthias Ringwald 
42591423b2SMatthias Ringwald #include <stdint.h>
43711e6c80SMatthias Ringwald #include "bluetooth.h"
448ac574d6SMatthias Ringwald #include "btstack_linked_list.h"
455d07396bSMatthias Ringwald #include "btstack_defines.h"
464d5915b3SMatthias Ringwald #include "btstack_bool.h"
47591423b2SMatthias Ringwald 
48591423b2SMatthias Ringwald #if defined __cplusplus
49591423b2SMatthias Ringwald extern "C" {
50591423b2SMatthias Ringwald #endif
51591423b2SMatthias Ringwald 
5209f91c9fSMatthias Ringwald // MARK: Attribute PDU Opcodes
5309f91c9fSMatthias Ringwald #define ATT_ERROR_RESPONSE              0x01
5409f91c9fSMatthias Ringwald 
5509f91c9fSMatthias Ringwald #define ATT_EXCHANGE_MTU_REQUEST        0x02
5609f91c9fSMatthias Ringwald #define ATT_EXCHANGE_MTU_RESPONSE       0x03
5709f91c9fSMatthias Ringwald 
5809f91c9fSMatthias Ringwald #define ATT_FIND_INFORMATION_REQUEST    0x04
5909f91c9fSMatthias Ringwald #define ATT_FIND_INFORMATION_REPLY      0x05
6009f91c9fSMatthias Ringwald #define ATT_FIND_BY_TYPE_VALUE_REQUEST  0x06
6109f91c9fSMatthias Ringwald #define ATT_FIND_BY_TYPE_VALUE_RESPONSE 0x07
6209f91c9fSMatthias Ringwald 
6309f91c9fSMatthias Ringwald #define ATT_READ_BY_TYPE_REQUEST        0x08
6409f91c9fSMatthias Ringwald #define ATT_READ_BY_TYPE_RESPONSE       0x09
6509f91c9fSMatthias Ringwald #define ATT_READ_REQUEST                0x0a
6609f91c9fSMatthias Ringwald #define ATT_READ_RESPONSE               0x0b
6709f91c9fSMatthias Ringwald #define ATT_READ_BLOB_REQUEST           0x0c
6809f91c9fSMatthias Ringwald #define ATT_READ_BLOB_RESPONSE          0x0d
6909f91c9fSMatthias Ringwald #define ATT_READ_MULTIPLE_REQUEST       0x0e
7009f91c9fSMatthias Ringwald #define ATT_READ_MULTIPLE_RESPONSE      0x0f
7109f91c9fSMatthias Ringwald #define ATT_READ_BY_GROUP_TYPE_REQUEST  0x10
7209f91c9fSMatthias Ringwald #define ATT_READ_BY_GROUP_TYPE_RESPONSE 0x11
7309f91c9fSMatthias Ringwald 
7409f91c9fSMatthias Ringwald #define ATT_WRITE_REQUEST               0x12
7509f91c9fSMatthias Ringwald #define ATT_WRITE_RESPONSE              0x13
7609f91c9fSMatthias Ringwald 
7709f91c9fSMatthias Ringwald #define ATT_PREPARE_WRITE_REQUEST       0x16
7809f91c9fSMatthias Ringwald #define ATT_PREPARE_WRITE_RESPONSE      0x17
7909f91c9fSMatthias Ringwald #define ATT_EXECUTE_WRITE_REQUEST       0x18
8009f91c9fSMatthias Ringwald #define ATT_EXECUTE_WRITE_RESPONSE      0x19
8109f91c9fSMatthias Ringwald 
8209f91c9fSMatthias Ringwald #define ATT_HANDLE_VALUE_NOTIFICATION   0x1b
8309f91c9fSMatthias Ringwald #define ATT_HANDLE_VALUE_INDICATION     0x1d
8409f91c9fSMatthias Ringwald #define ATT_HANDLE_VALUE_CONFIRMATION   0x1e
8509f91c9fSMatthias Ringwald 
8609f91c9fSMatthias Ringwald 
8709f91c9fSMatthias Ringwald #define ATT_WRITE_COMMAND                0x52
8809f91c9fSMatthias Ringwald #define ATT_SIGNED_WRITE_COMMAND         0xD2
8909f91c9fSMatthias Ringwald 
90beb20288SMatthias Ringwald // custom BTstack ATT Response Pending for att_read_callback
91e404a688SMatthias Ringwald #define ATT_READ_RESPONSE_PENDING                 0xffff
92e404a688SMatthias Ringwald 
9356c3a347SMatthias Ringwald // internally used to signal write response pending
9456c3a347SMatthias Ringwald #define ATT_INTERNAL_WRITE_RESPONSE_PENDING       0xfffe
9556c3a347SMatthias Ringwald 
9609f91c9fSMatthias Ringwald // internal additions
9709f91c9fSMatthias Ringwald // 128 bit UUID used
9809f91c9fSMatthias Ringwald #define ATT_PROPERTY_UUID128             0x200
9909f91c9fSMatthias Ringwald // Read/Write Permission bits
10009f91c9fSMatthias Ringwald #define ATT_PROPERTY_READ_PERMISSION_BIT_0  0x0400
10109f91c9fSMatthias Ringwald #define ATT_PROPERTY_READ_PERMISSION_BIT_1  0x0800
10209f91c9fSMatthias Ringwald #define ATT_PROPERTY_WRITE_PERMISSION_BIT_0 0x0001
10309f91c9fSMatthias Ringwald #define ATT_PROPERTY_WRITE_PERMISSION_BIT_1 0x0010
10409f91c9fSMatthias Ringwald #define ATT_PROPERTY_READ_PERMISSION_SC     0x0020
10509f91c9fSMatthias Ringwald #define ATT_PROPERTY_WRITE_PERMISSION_SC    0x0080
10609f91c9fSMatthias Ringwald 
10709f91c9fSMatthias Ringwald 
108591423b2SMatthias Ringwald typedef struct att_connection {
109711e6c80SMatthias Ringwald     hci_con_handle_t con_handle;
110591423b2SMatthias Ringwald     uint16_t mtu;       // initialized to ATT_DEFAULT_MTU (23), negotiated during MTU exchange
111591423b2SMatthias Ringwald     uint16_t max_mtu;   // local maximal L2CAP_MTU, set to l2cap_max_le_mtu()
112591423b2SMatthias Ringwald     uint8_t  encryption_key_size;
113591423b2SMatthias Ringwald     uint8_t  authenticated;
114591423b2SMatthias Ringwald     uint8_t  authorized;
11513eb7322SMatthias Ringwald     uint8_t  secure_connection;
116591423b2SMatthias Ringwald } att_connection_t;
117591423b2SMatthias Ringwald 
118591423b2SMatthias Ringwald // ATT Client Read Callback for Dynamic Data
119591423b2SMatthias Ringwald // - if buffer == NULL, don't copy data, just return size of value
120591423b2SMatthias Ringwald // - if buffer != NULL, copy data and return number bytes copied
121e404a688SMatthias Ringwald // If ENABLE_ATT_DELAYED_READ_RESPONSE is defined, you may return ATT_READ_RESPONSE_PENDING if data isn't available yet
122591423b2SMatthias Ringwald // @param con_handle of hci le connection
123591423b2SMatthias Ringwald // @param attribute_handle to be read
124591423b2SMatthias Ringwald // @param offset defines start of attribute value
125591423b2SMatthias Ringwald // @param buffer
126591423b2SMatthias Ringwald // @param buffer_size
127711e6c80SMatthias Ringwald typedef uint16_t (*att_read_callback_t)(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size);
128591423b2SMatthias Ringwald 
129591423b2SMatthias Ringwald // ATT Client Write Callback for Dynamic Data
130591423b2SMatthias Ringwald // @param con_handle of hci le connection
131591423b2SMatthias Ringwald // @param attribute_handle to be written
1329b31df63SMatthias Ringwald // @param transaction - ATT_TRANSACTION_MODE_NONE for regular writes. For prepared writes: ATT_TRANSACTION_MODE_ACTIVE, ATT_TRANSACTION_MODE_VALIDATE, ATT_TRANSACTION_MODE_EXECUTE, ATT_TRANSACTION_MODE_CANCEL
133591423b2SMatthias Ringwald // @param offset into the value - used for queued writes and long attributes
134591423b2SMatthias Ringwald // @param buffer
135591423b2SMatthias Ringwald // @param buffer_size
136591423b2SMatthias Ringwald // @param signature used for signed write commmands
137591423b2SMatthias Ringwald // @returns 0 if write was ok, ATT_ERROR_PREPARE_QUEUE_FULL if no space in queue, ATT_ERROR_INVALID_OFFSET if offset is larger than max buffer
1389b31df63SMatthias Ringwald //
1399b31df63SMatthias Ringwald // Each Prepared Write Request triggers a callback with transaction mode ATT_TRANSACTION_MODE_ACTIVE.
1409b31df63SMatthias Ringwald // On Execute Write, the callback will be called with ATT_TRANSACTION_MODE_VALIDATE and allows to validate all queued writes and return an application error.
1419b31df63SMatthias Ringwald // If none of the registered callbacks return an error for ATT_TRANSACTION_MODE_VALIDATE and the callback will be called with ATT_TRANSACTION_MODE_EXECUTE.
1429b31df63SMatthias Ringwald // Otherwise, all callbacks will be called with ATT_TRANSACTION_MODE_CANCEL.
1439b31df63SMatthias Ringwald //
1449b31df63SMatthias Ringwald // If the additional validation step is not needed, just return 0 for all callbacks with transaction mode ATT_TRANSACTION_MODE_VALIDATE.
1459b31df63SMatthias Ringwald //
146711e6c80SMatthias Ringwald typedef int (*att_write_callback_t)(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t transaction_mode, uint16_t offset, uint8_t *buffer, uint16_t buffer_size);
147591423b2SMatthias Ringwald 
1488ac574d6SMatthias Ringwald // Read & Write Callbacks for handle range
1498ac574d6SMatthias Ringwald typedef struct att_service_handler {
1508ac574d6SMatthias Ringwald     btstack_linked_item_t * item;
1518ac574d6SMatthias Ringwald     uint16_t start_handle;
1528ac574d6SMatthias Ringwald     uint16_t end_handle;
1538ac574d6SMatthias Ringwald     att_read_callback_t read_callback;
1548ac574d6SMatthias Ringwald     att_write_callback_t write_callback;
1555d07396bSMatthias Ringwald     btstack_packet_handler_t packet_handler;
1568ac574d6SMatthias Ringwald } att_service_handler_t;
1578ac574d6SMatthias Ringwald 
158591423b2SMatthias Ringwald // MARK: ATT Operations
159591423b2SMatthias Ringwald 
160591423b2SMatthias Ringwald /*
161591423b2SMatthias Ringwald  * @brief setup ATT database
162591423b2SMatthias Ringwald  */
163591423b2SMatthias Ringwald void att_set_db(uint8_t const * db);
164591423b2SMatthias Ringwald 
165591423b2SMatthias Ringwald /*
166591423b2SMatthias Ringwald  * @brief set callback for read of dynamic attributes
167591423b2SMatthias Ringwald  * @param callback
168591423b2SMatthias Ringwald  */
169591423b2SMatthias Ringwald void att_set_read_callback(att_read_callback_t callback);
170591423b2SMatthias Ringwald 
171591423b2SMatthias Ringwald /*
172591423b2SMatthias Ringwald  * @brief set callback for write of dynamic attributes
173591423b2SMatthias Ringwald  * @param callback
174591423b2SMatthias Ringwald  */
175591423b2SMatthias Ringwald void att_set_write_callback(att_write_callback_t callback);
176591423b2SMatthias Ringwald 
177591423b2SMatthias Ringwald /*
178591423b2SMatthias Ringwald  * @brief debug helper, dump ATT database to stdout using log_info
179591423b2SMatthias Ringwald  */
180591423b2SMatthias Ringwald void att_dump_attributes(void);
181591423b2SMatthias Ringwald 
182591423b2SMatthias Ringwald /*
183591423b2SMatthias Ringwald  * @brief process ATT request against database and put response into response buffer
184591423b2SMatthias Ringwald  * @param att_connection used for mtu and security properties
185591423b2SMatthias Ringwald  * @param request_buffer, request_len: ATT request from clinet
186591423b2SMatthias Ringwald  * @param response_buffer for result
187e404a688SMatthias Ringwald  * @returns len of data in response buffer. 0 = no response,
188e404a688SMatthias Ringwald  *          ATT_READ_RESPONSE_PENDING if it was returned at least once for dynamic data (requires ENABLE_ATT_DELAYED_READ_RESPONSE)
189591423b2SMatthias Ringwald  */
190591423b2SMatthias Ringwald uint16_t att_handle_request(att_connection_t * att_connection,
191591423b2SMatthias Ringwald                             uint8_t * request_buffer,
192591423b2SMatthias Ringwald                             uint16_t request_len,
193591423b2SMatthias Ringwald                             uint8_t * response_buffer);
194591423b2SMatthias Ringwald 
195591423b2SMatthias Ringwald /*
196591423b2SMatthias Ringwald  * @brief setup value notification in response buffer for a given handle and value
197591423b2SMatthias Ringwald  * @param att_connection
198fc64f94aSMatthias Ringwald  * @param attribute_handle
199fc64f94aSMatthias Ringwald  * @param value
200fc64f94aSMatthias Ringwald  * @param value_len
201591423b2SMatthias Ringwald  * @param response_buffer for notification
202591423b2SMatthias Ringwald  */
203591423b2SMatthias Ringwald uint16_t att_prepare_handle_value_notification(att_connection_t * att_connection,
204fc64f94aSMatthias Ringwald                                                uint16_t attribute_handle,
2053bb3035fSMilanka Ringwald                                                const uint8_t *value,
206591423b2SMatthias Ringwald                                                uint16_t value_len,
207591423b2SMatthias Ringwald                                                uint8_t * response_buffer);
208591423b2SMatthias Ringwald 
209591423b2SMatthias Ringwald /*
210591423b2SMatthias Ringwald  * @brief setup value indication in response buffer for a given handle and value
211591423b2SMatthias Ringwald  * @param att_connection
212fc64f94aSMatthias Ringwald  * @param attribute_handle
213fc64f94aSMatthias Ringwald  * @param value
214fc64f94aSMatthias Ringwald  * @param value_len
215591423b2SMatthias Ringwald  * @param response_buffer for indication
216591423b2SMatthias Ringwald  */
217591423b2SMatthias Ringwald uint16_t att_prepare_handle_value_indication(att_connection_t * att_connection,
218fc64f94aSMatthias Ringwald                                              uint16_t attribute_handle,
2193bb3035fSMilanka Ringwald                                              const uint8_t *value,
220591423b2SMatthias Ringwald                                              uint16_t value_len,
221591423b2SMatthias Ringwald                                              uint8_t * response_buffer);
222591423b2SMatthias Ringwald 
223591423b2SMatthias Ringwald /*
224591423b2SMatthias Ringwald  * @brief transcation queue of prepared writes, e.g., after disconnect
225591423b2SMatthias Ringwald  */
226591423b2SMatthias Ringwald void att_clear_transaction_queue(att_connection_t * att_connection);
227591423b2SMatthias Ringwald 
228bfd413f0SMatthias Ringwald // att_read_callback helpers for a various data types
229bfd413f0SMatthias Ringwald 
230bfd413f0SMatthias Ringwald /*
231bfd413f0SMatthias Ringwald  * @brief Handle read of blob like data for att_read_callback
232bfd413f0SMatthias Ringwald  * @param blob of data
233bfd413f0SMatthias Ringwald  * @param blob_size of blob
234bfd413f0SMatthias Ringwald  * @param offset from att_read_callback
235bfd413f0SMatthias Ringwald  * @param buffer from att_read_callback
236bfd413f0SMatthias Ringwald  * @param buffer_size from att_read_callback
237bfd413f0SMatthias Ringwald  * @returns value size for buffer == 0 and num bytes copied otherwise
238bfd413f0SMatthias Ringwald  */
239bfd413f0SMatthias Ringwald uint16_t att_read_callback_handle_blob(const uint8_t * blob, uint16_t blob_size, uint16_t offset, uint8_t * buffer, uint16_t buffer_size);
240bfd413f0SMatthias Ringwald 
241bfd413f0SMatthias Ringwald /*
242bfd413f0SMatthias Ringwald  * @brief Handle read of little endian unsigned 32 bit value for att_read_callback
243bfd413f0SMatthias Ringwald  * @param value
244bfd413f0SMatthias Ringwald  * @param offset from att_read_callback
245bfd413f0SMatthias Ringwald  * @param buffer from att_read_callback
246bfd413f0SMatthias Ringwald  * @param buffer_size from att_read_callback
247bfd413f0SMatthias Ringwald  * @returns value size for buffer == 0 and num bytes copied otherwise
248bfd413f0SMatthias Ringwald  */
249bfd413f0SMatthias Ringwald uint16_t att_read_callback_handle_little_endian_32(uint32_t value, uint16_t offset, uint8_t * buffer, uint16_t buffer_size);
250bfd413f0SMatthias Ringwald 
251bfd413f0SMatthias Ringwald /*
252bfd413f0SMatthias Ringwald  * @brief Handle read of little endian unsigned 16 bit value for att_read_callback
253bfd413f0SMatthias Ringwald  * @param value
254bfd413f0SMatthias Ringwald  * @param offset from att_read_callback
255bfd413f0SMatthias Ringwald  * @param buffer from att_read_callback
256bfd413f0SMatthias Ringwald  * @param buffer_size from att_read_callback
257bfd413f0SMatthias Ringwald  * @returns value size for buffer == 0 and num bytes copied otherwise
258bfd413f0SMatthias Ringwald  */
259bfd413f0SMatthias Ringwald uint16_t att_read_callback_handle_little_endian_16(uint16_t value, uint16_t offset, uint8_t * buffer, uint16_t buffer_size);
260bfd413f0SMatthias Ringwald 
261bfd413f0SMatthias Ringwald /*
262bfd413f0SMatthias Ringwald  * @brief Handle read of single byte for att_read_callback
263bfd413f0SMatthias Ringwald  * @param blob of data
264bfd413f0SMatthias Ringwald  * @param blob_size of blob
265bfd413f0SMatthias Ringwald  * @param offset from att_read_callback
266bfd413f0SMatthias Ringwald  * @param buffer from att_read_callback
267bfd413f0SMatthias Ringwald  * @param buffer_size from att_read_callback
268bfd413f0SMatthias Ringwald  * @returns value size for buffer == 0 and num bytes copied otherwise
269bfd413f0SMatthias Ringwald  */
270bfd413f0SMatthias Ringwald uint16_t att_read_callback_handle_byte(uint8_t value, uint16_t offset, uint8_t * buffer, uint16_t buffer_size);
271bfd413f0SMatthias Ringwald 
272bfd413f0SMatthias Ringwald 
273591423b2SMatthias Ringwald // experimental client API
274fc64f94aSMatthias Ringwald uint16_t att_uuid_for_handle(uint16_t attribute_handle);
275591423b2SMatthias Ringwald 
276660ce368SMatthias Ringwald 
277660ce368SMatthias Ringwald // experimental GATT Server API
278660ce368SMatthias Ringwald 
2794d5915b3SMatthias Ringwald // returns true if service found. only primary service.
2804d5915b3SMatthias Ringwald bool gatt_server_get_get_handle_range_for_service_with_uuid16(uint16_t uuid16, uint16_t * start_handle, uint16_t * end_handle);
281660ce368SMatthias Ringwald 
282660ce368SMatthias Ringwald // returns 0 if not found
283660ce368SMatthias Ringwald uint16_t gatt_server_get_value_handle_for_characteristic_with_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t uuid16);
284660ce368SMatthias Ringwald 
285660ce368SMatthias Ringwald // returns 0 if not found
286c7774db7SMilanka Ringwald uint16_t gatt_server_get_descriptor_handle_for_characteristic_with_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t characteristic_uuid16, uint16_t descriptor_uuid16);
287c7774db7SMilanka Ringwald uint16_t gatt_server_get_client_configuration_handle_for_characteristic_with_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t characteristic_uuid16);
288c7774db7SMilanka Ringwald uint16_t gatt_server_get_server_configuration_handle_for_characteristic_with_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t characteristic_uuid16);
289660ce368SMatthias Ringwald 
29015f22304SMatthias Ringwald 
29115f22304SMatthias Ringwald // returns 1 if service found. only primary service.
29215f22304SMatthias Ringwald int gatt_server_get_get_handle_range_for_service_with_uuid128(const uint8_t * uuid128, uint16_t * start_handle, uint16_t * end_handle);
29315f22304SMatthias Ringwald 
29415f22304SMatthias Ringwald // returns 0 if not found
29515f22304SMatthias Ringwald uint16_t gatt_server_get_value_handle_for_characteristic_with_uuid128(uint16_t start_handle, uint16_t end_handle, const uint8_t * uuid128);
29615f22304SMatthias Ringwald 
29715f22304SMatthias Ringwald // returns 0 if not found
29815f22304SMatthias Ringwald uint16_t gatt_server_get_client_configuration_handle_for_characteristic_with_uuid128(uint16_t start_handle, uint16_t end_handle, const uint8_t * uuid128);
29915f22304SMatthias Ringwald 
3008b1d64c6SMatthias Ringwald // non-user functionality for att_server
3018b1d64c6SMatthias Ringwald 
3028b1d64c6SMatthias Ringwald /*
3038b1d64c6SMatthias Ringwald  * @brief Check if writes to handle should be persistent
3048b1d64c6SMatthias Ringwald  * @param handle
3058b1d64c6SMatthias Ringwald  * @returns 1 if persistent
3068b1d64c6SMatthias Ringwald  */
3074d5915b3SMatthias Ringwald bool att_is_persistent_ccc(uint16_t handle);
3088b1d64c6SMatthias Ringwald 
30944127f43SMatthias Ringwald // auto-pts testing, returns response size
31044127f43SMatthias Ringwald #ifdef ENABLE_BTP
31144127f43SMatthias Ringwald uint16_t btp_att_get_attributes_by_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t uuid16, uint8_t * response_buffer, uint16_t response_buffer_size);
31244127f43SMatthias Ringwald uint16_t btp_att_get_attributes_by_uuid128(uint16_t start_handle, uint16_t end_handle, const uint8_t * uuid128, uint8_t * response_buffer, uint16_t response_buffer_size);
313*6de29f25SMatthias Ringwald uint16_t btp_att_get_attribute_value(att_connection_t * att_connection, uint16_t attribute_handle, uint8_t * response_buffer, uint16_t response_buffer_size);
31444127f43SMatthias Ringwald #endif
3158b1d64c6SMatthias Ringwald 
316591423b2SMatthias Ringwald #if defined __cplusplus
317591423b2SMatthias Ringwald }
318591423b2SMatthias Ringwald #endif
319591423b2SMatthias Ringwald 
32080e33422SMatthias Ringwald #endif // ATT_H
321