Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Generic Attribute Profile handling. More...
#include <stddef.h>
#include <sys/slist.h>
#include <sys/types.h>
#include <sys/util.h>
#include <bluetooth/conn.h>
#include <bluetooth/uuid.h>
#include <bluetooth/att.h>
Go to the source code of this file.
Data Structures | |
struct | bt_gatt_attr |
GATT Attribute structure. More... | |
struct | bt_gatt_service_static |
GATT Service structure. More... | |
struct | bt_gatt_service |
GATT Service structure. More... | |
struct | bt_gatt_service_val |
Service Attribute Value. More... | |
struct | bt_gatt_include |
Include Attribute Value. More... | |
struct | bt_gatt_cb |
GATT callback structure. More... | |
struct | bt_gatt_chrc |
Characteristic Attribute Value. More... | |
struct | bt_gatt_cep |
Characteristic Extended Properties Attribute Value. More... | |
struct | bt_gatt_ccc |
struct | bt_gatt_scc |
struct | bt_gatt_cpf |
GATT Characteristic Presentation Format Attribute Value. More... | |
struct | bt_gatt_ccc_cfg |
GATT CCC configuration entry. More... | |
struct | bt_gatt_notify_params |
struct | bt_gatt_indicate_params |
GATT Indicate Value parameters. More... | |
struct | bt_gatt_exchange_params |
GATT Exchange MTU parameters. More... | |
struct | bt_gatt_discover_params |
GATT Discover Attributes parameters. More... | |
struct | bt_gatt_read_params |
GATT Read parameters. More... | |
struct | bt_gatt_write_params |
GATT Write parameters. More... | |
struct | bt_gatt_subscribe_params |
GATT Subscribe parameters. More... | |
Macros | |
#define | BT_GATT_ERR(_att_err) (-(_att_err)) |
Construct error return value for attribute read and write callbacks. More... | |
#define | BT_GATT_CHRC_BROADCAST 0x01 |
Characteristic broadcast property. More... | |
#define | BT_GATT_CHRC_READ 0x02 |
Characteristic read property. More... | |
#define | BT_GATT_CHRC_WRITE_WITHOUT_RESP 0x04 |
Characteristic write without response property. More... | |
#define | BT_GATT_CHRC_WRITE 0x08 |
Characteristic write with response property. More... | |
#define | BT_GATT_CHRC_NOTIFY 0x10 |
Characteristic notify property. More... | |
#define | BT_GATT_CHRC_INDICATE 0x20 |
Characteristic indicate property. More... | |
#define | BT_GATT_CHRC_AUTH 0x40 |
Characteristic Authenticated Signed Writes property. More... | |
#define | BT_GATT_CHRC_EXT_PROP 0x80 |
Characteristic Extended Properties property. More... | |
#define | BT_GATT_CEP_RELIABLE_WRITE 0x0001 |
#define | BT_GATT_CEP_WRITABLE_AUX 0x0002 |
#define | BT_GATT_CCC_NOTIFY 0x0001 |
Client Characteristic Configuration Notification. More... | |
#define | BT_GATT_CCC_INDICATE 0x0002 |
Client Characteristic Configuration Indication. More... | |
#define | BT_GATT_SCC_BROADCAST 0x0001 |
Server Characteristic Configuration Broadcast. More... | |
#define | BT_GATT_SERVICE_DEFINE(_name, ...) |
Statically define and register a service. More... | |
#define | BT_GATT_SERVICE_INSTANCE_DEFINE( _name, _instances, _instance_num, _attrs_def) |
Statically define service structure array. More... | |
#define | BT_GATT_SERVICE(_attrs) |
Service Structure Declaration Macro. More... | |
#define | BT_GATT_PRIMARY_SERVICE(_service) |
Primary Service Declaration Macro. More... | |
#define | BT_GATT_SECONDARY_SERVICE(_service) |
Secondary Service Declaration Macro. More... | |
#define | BT_GATT_INCLUDE_SERVICE(_service_incl) |
Include Service Declaration Macro. More... | |
#define | BT_GATT_CHRC_INIT(_uuid, _handle, _props) |
#define | BT_GATT_CHARACTERISTIC(_uuid, _props, _perm, _read, _write, _user_data) |
Characteristic and Value Declaration Macro. More... | |
#define | BT_GATT_CCC_MAX 0 |
#define | BT_GATT_CCC_INITIALIZER(_changed, _write, _match) |
Initialize Client Characteristic Configuration Declaration Macro. More... | |
#define | BT_GATT_CCC_MANAGED(_ccc, _perm) |
Managed Client Characteristic Configuration Declaration Macro. More... | |
#define | BT_GATT_CCC(_changed, _perm) |
Client Characteristic Configuration Declaration Macro. More... | |
#define | BT_GATT_CEP(_value) |
Characteristic Extended Properties Declaration Macro. More... | |
#define | BT_GATT_CUD(_value, _perm) |
Characteristic User Format Descriptor Declaration Macro. More... | |
#define | BT_GATT_CPF(_value) |
Characteristic Presentation Format Descriptor Declaration Macro. More... | |
#define | BT_GATT_DESCRIPTOR(_uuid, _perm, _read, _write, _user_data) BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _user_data) |
Descriptor Declaration Macro. More... | |
#define | BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _user_data) |
Attribute Declaration Macro. More... | |
Typedefs | |
typedef uint8_t(* | bt_gatt_attr_func_t) (const struct bt_gatt_attr *attr, uint16_t handle, void *user_data) |
Attribute iterator callback. More... | |
typedef void(* | bt_gatt_complete_func_t) (struct bt_conn *conn, void *user_data) |
Notification complete result callback. More... | |
typedef void(* | bt_gatt_indicate_func_t) (struct bt_conn *conn, struct bt_gatt_indicate_params *params, uint8_t err) |
Indication complete result callback. More... | |
typedef void(* | bt_gatt_indicate_params_destroy_t) (struct bt_gatt_indicate_params *params) |
typedef uint8_t(* | bt_gatt_discover_func_t) (struct bt_conn *conn, const struct bt_gatt_attr *attr, struct bt_gatt_discover_params *params) |
Discover attribute callback function. More... | |
typedef uint8_t(* | bt_gatt_read_func_t) (struct bt_conn *conn, uint8_t err, struct bt_gatt_read_params *params, const void *data, uint16_t length) |
Read callback function. More... | |
typedef void(* | bt_gatt_write_func_t) (struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params) |
Write callback function. More... | |
typedef uint8_t(* | bt_gatt_notify_func_t) (struct bt_conn *conn, struct bt_gatt_subscribe_params *params, const void *data, uint16_t length) |
Notification callback function. More... | |
Enumerations | |
enum | { BT_GATT_PERM_NONE = 0 , BT_GATT_PERM_READ = BIT(0) , BT_GATT_PERM_WRITE = BIT(1) , BT_GATT_PERM_READ_ENCRYPT = BIT(2) , BT_GATT_PERM_WRITE_ENCRYPT = BIT(3) , BT_GATT_PERM_READ_AUTHEN = BIT(4) , BT_GATT_PERM_WRITE_AUTHEN = BIT(5) , BT_GATT_PERM_PREPARE_WRITE = BIT(6) } |
enum | { BT_GATT_WRITE_FLAG_PREPARE = BIT(0) , BT_GATT_WRITE_FLAG_CMD = BIT(1) } |
enum | { BT_GATT_ITER_STOP = 0 , BT_GATT_ITER_CONTINUE } |
enum | { BT_GATT_DISCOVER_PRIMARY , BT_GATT_DISCOVER_SECONDARY , BT_GATT_DISCOVER_INCLUDE , BT_GATT_DISCOVER_CHARACTERISTIC , BT_GATT_DISCOVER_DESCRIPTOR , BT_GATT_DISCOVER_ATTRIBUTE , BT_GATT_DISCOVER_STD_CHAR_DESC } |
enum | { BT_GATT_SUBSCRIBE_FLAG_VOLATILE , BT_GATT_SUBSCRIBE_FLAG_NO_RESUB , BT_GATT_SUBSCRIBE_FLAG_WRITE_PENDING , BT_GATT_SUBSCRIBE_NUM_FLAGS } |
Functions | |
void | bt_gatt_cb_register (struct bt_gatt_cb *cb) |
Register GATT callbacks. More... | |
int | bt_gatt_service_register (struct bt_gatt_service *svc) |
Register GATT service. More... | |
int | bt_gatt_service_unregister (struct bt_gatt_service *svc) |
Unregister GATT service. *. More... | |
void | bt_gatt_foreach_attr_type (uint16_t start_handle, uint16_t end_handle, const struct bt_uuid *uuid, const void *attr_data, uint16_t num_matches, bt_gatt_attr_func_t func, void *user_data) |
Attribute iterator by type. More... | |
static void | bt_gatt_foreach_attr (uint16_t start_handle, uint16_t end_handle, bt_gatt_attr_func_t func, void *user_data) |
Attribute iterator. More... | |
struct bt_gatt_attr * | bt_gatt_attr_next (const struct bt_gatt_attr *attr) |
Iterate to the next attribute. More... | |
struct bt_gatt_attr * | bt_gatt_find_by_uuid (const struct bt_gatt_attr *attr, uint16_t attr_count, const struct bt_uuid *uuid) |
Find Attribute by UUID. More... | |
uint16_t | bt_gatt_attr_get_handle (const struct bt_gatt_attr *attr) |
Get Attribute handle. More... | |
uint16_t | bt_gatt_attr_value_handle (const struct bt_gatt_attr *attr) |
Get the handle of the characteristic value descriptor. More... | |
ssize_t | bt_gatt_attr_read (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t buf_len, uint16_t offset, const void *value, uint16_t value_len) |
Generic Read Attribute value helper. More... | |
ssize_t | bt_gatt_attr_read_service (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) |
Read Service Attribute helper. More... | |
ssize_t | bt_gatt_attr_read_included (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) |
Read Include Attribute helper. More... | |
ssize_t | bt_gatt_attr_read_chrc (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) |
Read Characteristic Attribute helper. More... | |
ssize_t | bt_gatt_attr_read_ccc (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) |
Read Client Characteristic Configuration Attribute helper. More... | |
ssize_t | bt_gatt_attr_write_ccc (struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags) |
Write Client Characteristic Configuration Attribute helper. More... | |
ssize_t | bt_gatt_attr_read_cep (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) |
Read Characteristic Extended Properties Attribute helper. More... | |
ssize_t | bt_gatt_attr_read_cud (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) |
Read Characteristic User Description Descriptor Attribute helper. More... | |
ssize_t | bt_gatt_attr_read_cpf (struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) |
Read Characteristic Presentation format Descriptor Attribute helper. More... | |
int | bt_gatt_notify_cb (struct bt_conn *conn, struct bt_gatt_notify_params *params) |
Notify attribute value change. More... | |
int | bt_gatt_notify_multiple (struct bt_conn *conn, uint16_t num_params, struct bt_gatt_notify_params *params) |
Notify multiple attribute value change. More... | |
static int | bt_gatt_notify (struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *data, uint16_t len) |
Notify attribute value change. More... | |
static int | bt_gatt_notify_uuid (struct bt_conn *conn, const struct bt_uuid *uuid, const struct bt_gatt_attr *attr, const void *data, uint16_t len) |
Notify attribute value change by UUID. More... | |
int | bt_gatt_indicate (struct bt_conn *conn, struct bt_gatt_indicate_params *params) |
Indicate attribute value change. More... | |
bool | bt_gatt_is_subscribed (struct bt_conn *conn, const struct bt_gatt_attr *attr, uint16_t ccc_value) |
Check if connection have subscribed to attribute. More... | |
uint16_t | bt_gatt_get_mtu (struct bt_conn *conn) |
Get ATT MTU for a connection. More... | |
int | bt_gatt_exchange_mtu (struct bt_conn *conn, struct bt_gatt_exchange_params *params) |
Exchange MTU. More... | |
int | bt_gatt_discover (struct bt_conn *conn, struct bt_gatt_discover_params *params) |
GATT Discover function. More... | |
int | bt_gatt_read (struct bt_conn *conn, struct bt_gatt_read_params *params) |
Read Attribute Value by handle. More... | |
int | bt_gatt_write (struct bt_conn *conn, struct bt_gatt_write_params *params) |
Write Attribute Value by handle. More... | |
int | bt_gatt_write_without_response_cb (struct bt_conn *conn, uint16_t handle, const void *data, uint16_t length, bool sign, bt_gatt_complete_func_t func, void *user_data) |
Write Attribute Value by handle without response with callback. More... | |
static int | bt_gatt_write_without_response (struct bt_conn *conn, uint16_t handle, const void *data, uint16_t length, bool sign) |
Write Attribute Value by handle without response. More... | |
int | bt_gatt_subscribe (struct bt_conn *conn, struct bt_gatt_subscribe_params *params) |
Subscribe Attribute Value Notification. More... | |
int | bt_gatt_resubscribe (uint8_t id, const bt_addr_le_t *peer, struct bt_gatt_subscribe_params *params) |
Resubscribe Attribute Value Notification subscription. More... | |
int | bt_gatt_unsubscribe (struct bt_conn *conn, struct bt_gatt_subscribe_params *params) |
Unsubscribe Attribute Value Notification. More... | |
void | bt_gatt_cancel (struct bt_conn *conn, void *params) |
Cancel GATT pending request. More... | |
Generic Attribute Profile handling.