30#include "nimble/porting/nimble/include/os/queue.h"
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
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
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
96#define BLE_ATT_OP_READ_MULT_VAR_REQ 0x20
99#define BLE_ATT_OP_READ_MULT_VAR_RSP 0x21
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
107#define BLE_ATT_ATTR_MAX_LEN 512
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
118#define HA_FLAG_PERM_RW (BLE_ATT_F_READ | BLE_ATT_F_WRITE)
120#define BLE_ATT_ACCESS_OP_READ 1
121#define BLE_ATT_ACCESS_OP_WRITE 2
124#define BLE_ATT_MTU_DFLT 23
130#define BLE_ATT_MTU_MAX 527
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)