Zephyr Project API 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
att.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2016 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_
12
20#include <stdint.h>
21#include <stddef.h>
22
24#include <zephyr/sys/slist.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* Error codes for Error response PDU
32 *
33 * Defined by The Bluetooth Core Specification, Version 5.4, Vol 3, Part F, Section 3.4.1.1
34 */
36#define BT_ATT_ERR_SUCCESS 0x00
38#define BT_ATT_ERR_INVALID_HANDLE 0x01
40#define BT_ATT_ERR_READ_NOT_PERMITTED 0x02
42#define BT_ATT_ERR_WRITE_NOT_PERMITTED 0x03
44#define BT_ATT_ERR_INVALID_PDU 0x04
46#define BT_ATT_ERR_AUTHENTICATION 0x05
48#define BT_ATT_ERR_NOT_SUPPORTED 0x06
50#define BT_ATT_ERR_INVALID_OFFSET 0x07
52#define BT_ATT_ERR_AUTHORIZATION 0x08
54#define BT_ATT_ERR_PREPARE_QUEUE_FULL 0x09
56#define BT_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0a
58#define BT_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0b
60#define BT_ATT_ERR_ENCRYPTION_KEY_SIZE 0x0c
62#define BT_ATT_ERR_INVALID_ATTRIBUTE_LEN 0x0d
68#define BT_ATT_ERR_UNLIKELY 0x0e
70#define BT_ATT_ERR_INSUFFICIENT_ENCRYPTION 0x0f
77#define BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE 0x10
79#define BT_ATT_ERR_INSUFFICIENT_RESOURCES 0x11
81#define BT_ATT_ERR_DB_OUT_OF_SYNC 0x12
83#define BT_ATT_ERR_VALUE_NOT_ALLOWED 0x13
84
85/* Common Profile Error Codes
86 *
87 * Defined by the Supplement to the Bluetooth Core Specification (CSS), v11, Part B, Section 1.2.
88 */
90#define BT_ATT_ERR_WRITE_REQ_REJECTED 0xfc
92#define BT_ATT_ERR_CCC_IMPROPER_CONF 0xfd
94#define BT_ATT_ERR_PROCEDURE_IN_PROGRESS 0xfe
96#define BT_ATT_ERR_OUT_OF_RANGE 0xff
97
98/* Version 5.2, Vol 3, Part F, 3.2.9 defines maximum attribute length to 512 */
99#define BT_ATT_MAX_ATTRIBUTE_LEN 512
100
101/* Handle 0x0000 is reserved for future use */
102#define BT_ATT_FIRST_ATTRIBUTE_HANDLE 0x0001
103/* 0xffff is defined as the maximum, and thus last, valid attribute handle */
104#define BT_ATT_LAST_ATTRIBUTE_HANDLE 0xffff
105
122#if defined(CONFIG_BT_ATT_ERR_TO_STR)
123const char *bt_att_err_to_str(uint8_t att_err);
124#else
125#include <zephyr/toolchain.h>
126
127static inline const char *bt_att_err_to_str(uint8_t att_err)
128{
129 ARG_UNUSED(att_err);
130
131 return "";
132}
133#endif
134
135#if defined(CONFIG_BT_EATT)
136#if defined(CONFIG_BT_TESTING)
137
138int bt_eatt_disconnect_one(struct bt_conn *conn);
139
140/* Reconfigure all EATT channels on connection */
141int bt_eatt_reconfigure(struct bt_conn *conn, uint16_t mtu);
142
143#endif /* CONFIG_BT_TESTING */
144
160int bt_eatt_connect(struct bt_conn *conn, size_t num_channels);
161
169size_t bt_eatt_count(struct bt_conn *conn);
170
171#endif /* CONFIG_BT_EATT */
172
185
186#ifdef __cplusplus
187}
188#endif
189
194#endif /* ZEPHYR_INCLUDE_BLUETOOTH_ATT_H_ */
Bluetooth connection handling.
size_t bt_eatt_count(struct bt_conn *conn)
Get number of EATT channels connected.
int bt_eatt_connect(struct bt_conn *conn, size_t num_channels)
Connect Enhanced ATT channels.
bt_att_chan_opt
ATT channel option bit field values.
Definition att.h:177
static const char * bt_att_err_to_str(uint8_t att_err)
Converts a ATT error to string.
Definition att.h:127
@ BT_ATT_CHAN_OPT_NONE
Both Enhanced and Unenhanced channels can be used
Definition att.h:179
@ BT_ATT_CHAN_OPT_UNENHANCED_ONLY
Only Unenhanced channels will be used
Definition att.h:181
@ BT_ATT_CHAN_OPT_ENHANCED_ONLY
Only Enhanced channels will be used
Definition att.h:183
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition util_macro.h:44
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Macros to abstract toolchain specific capabilities.
Macro utilities.