MT2523 API Reference  LinkIt SDK v4
bt_att.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_ATT_SPEC_H__
36 #define __BT_ATT_SPEC_H__
37 
56 #include "bt_platform.h"
57 #include "bt_uuid.h"
58 
59 BT_EXTERN_C_BEGIN
60 
66 #define BT_ATT_DEFAULT_MTU 23
68 #define BT_ATT_OPCODE_ERROR_RESPONSE 0x01
69 #define BT_ATT_OPCODE_EXCHANGE_MTU_REQUEST 0x02
70 #define BT_ATT_OPCODE_EXCHANGE_MTU_RESPONSE 0x03
71 #define BT_ATT_OPCODE_FIND_INFORMATION_REQUEST 0x04
72 #define BT_ATT_OPCODE_FIND_INFORMATION_RESPONSE 0x05
73 #define BT_ATT_OPCODE_FIND_BY_TYPE_VALUE_REQUEST 0x06
74 #define BT_ATT_OPCODE_FIND_BY_TYPE_VALUE_RESPONSE 0x07
75 #define BT_ATT_OPCODE_READ_BY_TYPE_REQUEST 0x08
76 #define BT_ATT_OPCODE_READ_BY_TYPE_RESPONSE 0x09
77 #define BT_ATT_OPCODE_READ_REQUEST 0x0A
78 #define BT_ATT_OPCODE_READ_RESPONSE 0x0B
79 #define BT_ATT_OPCODE_READ_BLOB_REQUEST 0x0C
80 #define BT_ATT_OPCODE_READ_BLOB_RESPONSE 0x0D
81 #define BT_ATT_OPCODE_READ_MULTIPLE_REQUEST 0x0E
82 #define BT_ATT_OPCODE_READ_MULTIPLE_RESPONSE 0x0F
83 #define BT_ATT_OPCODE_READ_BY_GROUP_TYPE_REQUEST 0x10
84 #define BT_ATT_OPCODE_READ_BY_GROUP_TYPE_RESPONSE 0x11
85 #define BT_ATT_OPCODE_WRITE_REQUEST 0x12
86 #define BT_ATT_OPCODE_WRITE_RESPONSE 0x13
87 #define BT_ATT_OPCODE_PREPARE_WRITE_REQUEST 0x16
88 #define BT_ATT_OPCODE_PREPARE_WRITE_RESPONSE 0x17
89 #define BT_ATT_OPCODE_EXECUTE_WRITE_REQUEST 0x18
90 #define BT_ATT_OPCODE_EXECUTE_WRITE_RESPONSE 0x19
91 #define BT_ATT_OPCODE_HANDLE_VALUE_NOTIFICATION 0x1B
92 #define BT_ATT_OPCODE_HANDLE_VALUE_INDICATION 0x1D
93 #define BT_ATT_OPCODE_HANDLE_VALUE_CONFIRMATION 0x1E
94 #define BT_ATT_OPCODE_WRITE_COMMAND 0x52
95 #define BT_ATT_OPCODE_SIGNED_WRITE_COMMAND 0xD2
96 #define BT_ATT_OPCODE_SIGNED_FLAG 0x80
97 #define BT_ATT_OPCODE_COMMAND_FLAG 0x40
98 #define BT_ATT_OPCODE_METHOD_MASK 0x3F
100 #define BT_ATT_ERRCODE_INVALID_HANDLE 0x01
101 #define BT_ATT_ERRCODE_READ_NOT_PERMITTED 0x02
102 #define BT_ATT_ERRCODE_WRITE_NOT_PERMITTED 0x03
103 #define BT_ATT_ERRCODE_INVALID_PDU 0x04
104 #define BT_ATT_ERRCODE_INSUFFICIENT_AUTHENTICATION 0x05
105 #define BT_ATT_ERRCODE_REQUEST_NOT_SUPPORTED 0x06
106 #define BT_ATT_ERRCODE_INVALID_OFFSET 0x07
107 #define BT_ATT_ERRCODE_INSUFFICIENT_AUTHORIZATION 0x08
108 #define BT_ATT_ERRCODE_PREPARE_QUEUE_FULL 0x09
109 #define BT_ATT_ERRCODE_ATTRIBUTE_NOT_FOUND 0x0A
110 #define BT_ATT_ERRCODE_ATTRIBUTE_NOT_LONG 0x0B
111 #define BT_ATT_ERRCODE_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0C
112 #define BT_ATT_ERRCODE_INVALID_ATTRIBUTE_VALUE_LENGTH 0x0D
113 #define BT_ATT_ERRCODE_UNLIKELY_ERROR 0x0E
114 #define BT_ATT_ERRCODE_INSUFFICIENT_ENCRYPTION 0x0F
115 #define BT_ATT_ERRCODE_UNSUPPORTED_GROUP_TYPE 0x10
116 #define BT_ATT_ERRCODE_INSUFFICIENT_RESOURCES 0x11
117 #define BT_ATT_ERRCODE_APPLICATION_BASE 0x80
118 #define BT_ATT_ERRCODE_CONTINUE 0x81
119 #define BT_ATT_ERRCODE_APPLICATION_MAX 0x9F
120 #define BT_ATT_ERRCODE_COMMON_BASE 0xE0
121 #define BT_ATT_ERRCODE_COMMON_MAX 0xFE
122 #define BT_ATT_ERRCODE_OUT_OF_MEMORY 0xFF
124 #define BT_ATT_EXECUTE_WRITE_CANCEL 0x00
125 #define BT_ATT_EXECUTE_WRITE_WRITE 0x01
140 BT_PACKED (
141 typedef struct {
142  uint8_t opcode;
143  uint8_t error_opcode;
144  uint16_t error_handle;
145  uint8_t error_code;
147 
151 BT_PACKED (
152 typedef struct {
153  uint8_t opcode;
154  uint16_t client_rx_mtu;
156 
160 BT_PACKED (
161 typedef struct {
162  uint8_t opcode;
163  uint16_t server_rx_mtu;
165 
169 BT_PACKED (
170 typedef struct {
171  uint8_t opcode;
172  uint16_t starting_handle;
173  uint16_t ending_handle;
175 
179 BT_PACKED (
180 typedef struct {
181  uint8_t opcode;
182  uint8_t format;
183  uint8_t info_data[1];
185 
189 BT_PACKED (
190 typedef struct {
191  uint8_t opcode;
192  uint16_t starting_handle;
193  uint16_t ending_handle;
194  uint16_t uuid;
195  uint8_t attribute_value[1];
197 
201 BT_PACKED (
202 typedef struct {
203  uint8_t opcode;
204  uint8_t handles_info_list[1];
206 
210 BT_PACKED (
211 typedef struct {
212  uint8_t opcode;
213  uint16_t starting_handle;
214  uint16_t ending_handle;
215  bt_uuid_t type;
217 
221 BT_PACKED (
222 typedef struct {
223  uint8_t opcode;
224  uint8_t length;
225  uint8_t attribute_data_list[1];
227 
231 BT_PACKED (
232 typedef struct{
233  uint8_t opcode;
234  uint16_t attribute_handle;
236 
240 BT_PACKED (
241 typedef struct {
242  uint8_t opcode;
243  uint8_t attribute_value[1];
245 
249 BT_PACKED (
250 typedef struct {
251  uint8_t opcode;
252  uint16_t attribute_handle;
253  uint16_t value_offset;
255 
260 
264 BT_PACKED (
265 typedef struct {
266  uint8_t opcode;
267  uint16_t set_of_handles[1];
269 
273 BT_PACKED (
274 typedef struct {
275  uint8_t opcode;
276  uint8_t set_of_values[1];
278 
283 
288 
292 BT_PACKED (
293 typedef struct {
294  uint8_t opcode;
295  uint16_t attribute_handle;
296  uint8_t attribute_value[1];
298 
302 typedef struct {
303  uint8_t opcode;
305 
310 
314 BT_PACKED (
315 typedef struct {
316  uint8_t opcode;
317  uint16_t attribute_handle;
318  uint16_t value_offset;
319  uint8_t *part_attribute_value;
321 
325 BT_PACKED (
326 typedef struct {
327  uint8_t opcode;
328  uint16_t attribute_handle;
329  uint16_t value_offset;
330  uint8_t part_attribute_value[1];
332 
336 BT_PACKED (
337 typedef struct {
338  uint8_t opcode;
339  uint8_t flags;
341 
346 
350 BT_PACKED (
351 typedef struct {
352  uint8_t opcode;
353  uint16_t handle;
354  uint8_t attribute_value[1];
356 
361 
366 
371 BT_EXTERN_C_END
378 #endif /* __BT_ATT_SPEC_H__ */
bt_att_read_by_type_req_t bt_att_read_by_group_type_req_t
ATT read by group type request structure.
Definition: bt_att.h:282
ATT write request structure.
Definition: bt_att.h:297
ATT find by type value request structure.
Definition: bt_att.h:196
ATT handle value notification structure.
Definition: bt_att.h:355
bt_att_write_rsp_t bt_att_execute_write_rsp_t
ATT execute write response structure.
Definition: bt_att.h:345
ATT read multiple response structure.
Definition: bt_att.h:277
ATT write response structure.
Definition: bt_att.h:302
ATT read response structure.
Definition: bt_att.h:244
ATT execute write request structure.
Definition: bt_att.h:340
ATT exchange MTU response structure.
Definition: bt_att.h:164
ATT exchange MTU request structure.
Definition: bt_att.h:155
bt_att_handle_value_notification_t bt_att_handle_value_indication_t
ATT handle value indication structure.
Definition: bt_att.h:360
ATT prepare write response structure.
Definition: bt_att.h:331
ATT error response structure.
Definition: bt_att.h:146
ATT read blob request structure.
Definition: bt_att.h:254
ATT find information response structure.
Definition: bt_att.h:184
ATT read by type request structure.
Definition: bt_att.h:216
ATT find information request structure.
Definition: bt_att.h:174
ATT read request structure.
Definition: bt_att.h:235
bt_att_write_req_t bt_att_write_command_t
ATT write command structure.
Definition: bt_att.h:309
bt_att_read_by_type_rsp_t bt_att_read_by_group_type_rsp_t
ATT read by group type response structure.
Definition: bt_att.h:287
bt_att_write_rsp_t bt_att_handle_value_confirmation_t
ATT handle value confirmation structure.
Definition: bt_att.h:365
bt_uuid union.
Definition: bt_uuid.h:124
ATT find by type value response structure.
Definition: bt_att.h:205
uint8_t opcode
BT_ATT_OPCODE_WRITE_RESPONSE.
Definition: bt_att.h:303
ATT read multiple request structure.
Definition: bt_att.h:268
bt_att_read_rsp_t bt_att_read_blob_rsp_t
ATT read blob response structure.
Definition: bt_att.h:259
ATT read by type response structure.
Definition: bt_att.h:226
ATT prepare write request structure.
Definition: bt_att.h:320