2016-02-17 17:21:58 +08:00
|
|
|
/** @file
|
|
|
|
* @brief Attribute Protocol handling.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Intel Corporation
|
|
|
|
*
|
2017-01-19 09:01:01 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2016-02-17 17:21:58 +08:00
|
|
|
*/
|
|
|
|
#ifndef __BT_ATT_H
|
|
|
|
#define __BT_ATT_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-08-02 21:23:26 +08:00
|
|
|
#include <misc/slist.h>
|
|
|
|
|
2016-02-17 17:21:58 +08:00
|
|
|
/* Error codes for Error response PDU */
|
|
|
|
#define BT_ATT_ERR_INVALID_HANDLE 0x01
|
|
|
|
#define BT_ATT_ERR_READ_NOT_PERMITTED 0x02
|
|
|
|
#define BT_ATT_ERR_WRITE_NOT_PERMITTED 0x03
|
|
|
|
#define BT_ATT_ERR_INVALID_PDU 0x04
|
|
|
|
#define BT_ATT_ERR_AUTHENTICATION 0x05
|
|
|
|
#define BT_ATT_ERR_NOT_SUPPORTED 0x06
|
|
|
|
#define BT_ATT_ERR_INVALID_OFFSET 0x07
|
|
|
|
#define BT_ATT_ERR_AUTHORIZATION 0x08
|
|
|
|
#define BT_ATT_ERR_PREPARE_QUEUE_FULL 0x09
|
|
|
|
#define BT_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0a
|
|
|
|
#define BT_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0b
|
|
|
|
#define BT_ATT_ERR_ENCRYPTION_KEY_SIZE 0x0c
|
|
|
|
#define BT_ATT_ERR_INVALID_ATTRIBUTE_LEN 0x0d
|
|
|
|
#define BT_ATT_ERR_UNLIKELY 0x0e
|
|
|
|
#define BT_ATT_ERR_INSUFFICIENT_ENCRYPTION 0x0f
|
|
|
|
#define BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE 0x10
|
|
|
|
#define BT_ATT_ERR_INSUFFICIENT_RESOURCES 0x11
|
|
|
|
|
2016-02-17 20:20:46 +08:00
|
|
|
/* Common Profile Error Codes (from CSS) */
|
2017-01-13 18:57:56 +08:00
|
|
|
#define BT_ATT_ERR_WRITE_REQ_REJECTED 0xfc
|
2016-02-17 20:20:46 +08:00
|
|
|
#define BT_ATT_ERR_CCC_IMPROPER_CONF 0xfd
|
|
|
|
#define BT_ATT_ERR_PROCEDURE_IN_PROGRESS 0xfe
|
|
|
|
#define BT_ATT_ERR_OUT_OF_RANGE 0xff
|
|
|
|
|
2016-08-02 21:23:26 +08:00
|
|
|
typedef void (*bt_att_func_t)(struct bt_conn *conn, uint8_t err,
|
|
|
|
const void *pdu, uint16_t length,
|
|
|
|
void *user_data);
|
|
|
|
typedef void (*bt_att_destroy_t)(void *user_data);
|
|
|
|
|
|
|
|
/* ATT request context */
|
|
|
|
struct bt_att_req {
|
2016-10-31 18:53:43 +08:00
|
|
|
sys_snode_t node;
|
|
|
|
bt_att_func_t func;
|
|
|
|
bt_att_destroy_t destroy;
|
|
|
|
struct net_buf_simple_state state;
|
|
|
|
struct net_buf *buf;
|
2016-08-02 21:23:26 +08:00
|
|
|
#if defined(CONFIG_BLUETOOTH_SMP)
|
2016-10-31 18:53:43 +08:00
|
|
|
bool retrying;
|
2016-08-02 21:23:26 +08:00
|
|
|
#endif /* CONFIG_BLUETOOTH_SMP */
|
|
|
|
};
|
|
|
|
|
2016-02-17 17:21:58 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __BT_ATT_H */
|