NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
ble_att.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef H_BLE_ATT_
21#define H_BLE_ATT_
22
30#include "nimble/porting/nimble/include/os/queue.h"
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35struct os_mbuf;
36
37#define BLE_ATT_UUID_PRIMARY_SERVICE 0x2800
38#define BLE_ATT_UUID_SECONDARY_SERVICE 0x2801
39#define BLE_ATT_UUID_INCLUDE 0x2802
40#define BLE_ATT_UUID_CHARACTERISTIC 0x2803
41
42#define BLE_ATT_ERR_INVALID_HANDLE 0x01
43#define BLE_ATT_ERR_READ_NOT_PERMITTED 0x02
44#define BLE_ATT_ERR_WRITE_NOT_PERMITTED 0x03
45#define BLE_ATT_ERR_INVALID_PDU 0x04
46#define BLE_ATT_ERR_INSUFFICIENT_AUTHEN 0x05
47#define BLE_ATT_ERR_REQ_NOT_SUPPORTED 0x06
48#define BLE_ATT_ERR_INVALID_OFFSET 0x07
49#define BLE_ATT_ERR_INSUFFICIENT_AUTHOR 0x08
50#define BLE_ATT_ERR_PREPARE_QUEUE_FULL 0x09
51#define BLE_ATT_ERR_ATTR_NOT_FOUND 0x0a
52#define BLE_ATT_ERR_ATTR_NOT_LONG 0x0b
53#define BLE_ATT_ERR_INSUFFICIENT_KEY_SZ 0x0c
54#define BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN 0x0d
55#define BLE_ATT_ERR_UNLIKELY 0x0e
56#define BLE_ATT_ERR_INSUFFICIENT_ENC 0x0f
57#define BLE_ATT_ERR_UNSUPPORTED_GROUP 0x10
58#define BLE_ATT_ERR_INSUFFICIENT_RES 0x11
59#define BLE_ATT_ERR_DB_OUT_OF_SYNC 0x12
60#define BLE_ATT_ERR_VALUE_NOT_ALLOWED 0x13
61
71#define BLE_ATT_OP_ERROR_RSP 0x01
72#define BLE_ATT_OP_MTU_REQ 0x02
73#define BLE_ATT_OP_MTU_RSP 0x03
74#define BLE_ATT_OP_FIND_INFO_REQ 0x04
75#define BLE_ATT_OP_FIND_INFO_RSP 0x05
76#define BLE_ATT_OP_FIND_TYPE_VALUE_REQ 0x06
77#define BLE_ATT_OP_FIND_TYPE_VALUE_RSP 0x07
78#define BLE_ATT_OP_READ_TYPE_REQ 0x08
79#define BLE_ATT_OP_READ_TYPE_RSP 0x09
80#define BLE_ATT_OP_READ_REQ 0x0a
81#define BLE_ATT_OP_READ_RSP 0x0b
82#define BLE_ATT_OP_READ_BLOB_REQ 0x0c
83#define BLE_ATT_OP_READ_BLOB_RSP 0x0d
84#define BLE_ATT_OP_READ_MULT_REQ 0x0e
85#define BLE_ATT_OP_READ_MULT_RSP 0x0f
86#define BLE_ATT_OP_READ_GROUP_TYPE_REQ 0x10
87#define BLE_ATT_OP_READ_GROUP_TYPE_RSP 0x11
88#define BLE_ATT_OP_WRITE_REQ 0x12
89#define BLE_ATT_OP_WRITE_RSP 0x13
90#define BLE_ATT_OP_PREP_WRITE_REQ 0x16
91#define BLE_ATT_OP_PREP_WRITE_RSP 0x17
92#define BLE_ATT_OP_EXEC_WRITE_REQ 0x18
93#define BLE_ATT_OP_EXEC_WRITE_RSP 0x19
94
96#define BLE_ATT_OP_READ_MULT_VAR_REQ 0x20
97
99#define BLE_ATT_OP_READ_MULT_VAR_RSP 0x21
100
101#define BLE_ATT_OP_NOTIFY_REQ 0x1b
102#define BLE_ATT_OP_INDICATE_REQ 0x1d
103#define BLE_ATT_OP_INDICATE_RSP 0x1e
104#define BLE_ATT_OP_WRITE_CMD 0x52
105#define BLE_ATT_OP_SIGNED_WRITE_CMD 0xD2
106
107#define BLE_ATT_ATTR_MAX_LEN 512
108
109#define BLE_ATT_F_READ 0x01
110#define BLE_ATT_F_WRITE 0x02
111#define BLE_ATT_F_READ_ENC 0x04
112#define BLE_ATT_F_READ_AUTHEN 0x08
113#define BLE_ATT_F_READ_AUTHOR 0x10
114#define BLE_ATT_F_WRITE_ENC 0x20
115#define BLE_ATT_F_WRITE_AUTHEN 0x40
116#define BLE_ATT_F_WRITE_AUTHOR 0x80
117
118#define HA_FLAG_PERM_RW (BLE_ATT_F_READ | BLE_ATT_F_WRITE)
119
120#define BLE_ATT_ACCESS_OP_READ 1
121#define BLE_ATT_ACCESS_OP_WRITE 2
122
124#define BLE_ATT_MTU_DFLT 23
125
130#define BLE_ATT_MTU_MAX 527
131
148int ble_att_svr_read_local(uint16_t attr_handle, struct os_mbuf **out_om);
149
165int ble_att_svr_write_local(uint16_t attr_handle, struct os_mbuf *om);
166
177uint16_t ble_att_mtu(uint16_t conn_handle);
178
186
204
205#ifdef __cplusplus
206}
207#endif
208
213#endif
int ble_att_set_preferred_mtu(uint16_t mtu)
int ble_att_svr_read_local(uint16_t attr_handle, struct os_mbuf **out_om)
uint16_t ble_att_mtu(uint16_t conn_handle)
uint16_t ble_att_preferred_mtu(void)
int ble_att_svr_write_local(uint16_t attr_handle, struct os_mbuf *om)
Definition os_mbuf.h:86