Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
gatt.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2015-2016 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10#ifndef ZEPHYR_INCLUDE_BLUETOOTH_GATT_H_
11#define ZEPHYR_INCLUDE_BLUETOOTH_GATT_H_
12
20#include <stddef.h>
21#include <sys/slist.h>
22#include <sys/types.h>
23#include <sys/util.h>
24#include <bluetooth/conn.h>
25#include <bluetooth/uuid.h>
26#include <bluetooth/att.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
33enum {
36
39
42
48
54
61
68
75};
76
84#define BT_GATT_ERR(_att_err) (-(_att_err))
85
87enum {
94
101};
102
106 const struct bt_uuid *uuid;
107
122 ssize_t (*read)(struct bt_conn *conn, const struct bt_gatt_attr *attr,
123 void *buf, uint16_t len, uint16_t offset);
124
137 ssize_t (*write)(struct bt_conn *conn, const struct bt_gatt_attr *attr,
138 const void *buf, uint16_t len, uint16_t offset,
139 uint8_t flags);
140
147};
148
152 const struct bt_gatt_attr *attrs;
155};
156
163
165};
166
170 const struct bt_uuid *uuid;
173};
174
178 const struct bt_uuid *uuid;
183};
184
196 void (*att_mtu_updated)(struct bt_conn *conn, uint16_t tx, uint16_t rx);
197
199};
200
209#define BT_GATT_CHRC_BROADCAST 0x01
215#define BT_GATT_CHRC_READ 0x02
221#define BT_GATT_CHRC_WRITE_WITHOUT_RESP 0x04
227#define BT_GATT_CHRC_WRITE 0x08
234#define BT_GATT_CHRC_NOTIFY 0x10
240#define BT_GATT_CHRC_INDICATE 0x20
246#define BT_GATT_CHRC_AUTH 0x40
253#define BT_GATT_CHRC_EXT_PROP 0x80
254
258 const struct bt_uuid *uuid;
263};
264
266#define BT_GATT_CEP_RELIABLE_WRITE 0x0001
267#define BT_GATT_CEP_WRITABLE_AUX 0x0002
268
273};
274
282#define BT_GATT_CCC_NOTIFY 0x0001
288#define BT_GATT_CCC_INDICATE 0x0002
289
294};
295
304#define BT_GATT_SCC_BROADCAST 0x0001
305
310};
311
326};
327
341
363
371
372enum {
375};
376
387typedef uint8_t (*bt_gatt_attr_func_t)(const struct bt_gatt_attr *attr,
389 void *user_data);
390
403void bt_gatt_foreach_attr_type(uint16_t start_handle, uint16_t end_handle,
404 const struct bt_uuid *uuid,
405 const void *attr_data, uint16_t num_matches,
407 void *user_data);
408
418static inline void bt_gatt_foreach_attr(uint16_t start_handle, uint16_t end_handle,
420 void *user_data)
421{
422 bt_gatt_foreach_attr_type(start_handle, end_handle, NULL, NULL, 0, func,
423 user_data);
424}
425
434struct bt_gatt_attr *bt_gatt_attr_next(const struct bt_gatt_attr *attr);
435
451 uint16_t attr_count,
452 const struct bt_uuid *uuid);
453
462
474
490ssize_t bt_gatt_attr_read(struct bt_conn *conn, const struct bt_gatt_attr *attr,
491 void *buf, uint16_t buf_len, uint16_t offset,
492 const void *value, uint16_t value_len);
493
510 const struct bt_gatt_attr *attr,
511 void *buf, uint16_t len, uint16_t offset);
512
520#define BT_GATT_SERVICE_DEFINE(_name, ...) \
521 const struct bt_gatt_attr attr_##_name[] = { __VA_ARGS__ }; \
522 const STRUCT_SECTION_ITERABLE(bt_gatt_service_static, _name) = \
523 BT_GATT_SERVICE(attr_##_name)
524
525#define _BT_GATT_ATTRS_ARRAY_DEFINE(n, _instances, _attrs_def) \
526 static struct bt_gatt_attr attrs_##n[] = _attrs_def(_instances[n]);
527
528#define _BT_GATT_SERVICE_ARRAY_ITEM(_n, _) BT_GATT_SERVICE(attrs_##_n),
529
545#define BT_GATT_SERVICE_INSTANCE_DEFINE( \
546 _name, _instances, _instance_num, _attrs_def) \
547 BUILD_ASSERT(ARRAY_SIZE(_instances) == _instance_num, \
548 "The number of array elements does not match its size"); \
549 UTIL_EVAL(UTIL_REPEAT( \
550 _instance_num, _BT_GATT_ATTRS_ARRAY_DEFINE, _instances, \
551 _attrs_def)) \
552 static struct bt_gatt_service _name[] = { \
553 UTIL_LISTIFY(_instance_num, _BT_GATT_SERVICE_ARRAY_ITEM) \
554 }
555
563#define BT_GATT_SERVICE(_attrs) \
564{ \
565 .attrs = _attrs, \
566 .attr_count = ARRAY_SIZE(_attrs), \
567}
568
576#define BT_GATT_PRIMARY_SERVICE(_service) \
577 BT_GATT_ATTRIBUTE(BT_UUID_GATT_PRIMARY, BT_GATT_PERM_READ, \
578 bt_gatt_attr_read_service, NULL, _service)
579
587#define BT_GATT_SECONDARY_SERVICE(_service) \
588 BT_GATT_ATTRIBUTE(BT_UUID_GATT_SECONDARY, BT_GATT_PERM_READ, \
589 bt_gatt_attr_read_service, NULL, _service)
590
607 const struct bt_gatt_attr *attr,
608 void *buf, uint16_t len, uint16_t offset);
609
617#define BT_GATT_INCLUDE_SERVICE(_service_incl) \
618 BT_GATT_ATTRIBUTE(BT_UUID_GATT_INCLUDE, BT_GATT_PERM_READ, \
619 bt_gatt_attr_read_included, NULL, _service_incl)
620
636ssize_t bt_gatt_attr_read_chrc(struct bt_conn *conn,
637 const struct bt_gatt_attr *attr, void *buf,
638 uint16_t len, uint16_t offset);
639
640#define BT_GATT_CHRC_INIT(_uuid, _handle, _props) \
641{ \
642 .uuid = _uuid, \
643 .value_handle = _handle, \
644 .properties = _props, \
645}
646
660#define BT_GATT_CHARACTERISTIC(_uuid, _props, _perm, _read, _write, _user_data) \
661 BT_GATT_ATTRIBUTE(BT_UUID_GATT_CHRC, BT_GATT_PERM_READ, \
662 bt_gatt_attr_read_chrc, NULL, \
663 ((struct bt_gatt_chrc[]) { \
664 BT_GATT_CHRC_INIT(_uuid, 0U, _props), \
665 })), \
666 BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _user_data)
667
668#if defined(CONFIG_BT_SETTINGS_CCC_LAZY_LOADING)
669 #define BT_GATT_CCC_MAX (CONFIG_BT_MAX_CONN)
670#elif defined(CONFIG_BT_CONN)
671 #define BT_GATT_CCC_MAX (CONFIG_BT_MAX_PAIRED + CONFIG_BT_MAX_CONN)
672#else
673 #define BT_GATT_CCC_MAX 0
674#endif
675
684};
685
687struct _bt_gatt_ccc {
690
693
699 void (*cfg_changed)(const struct bt_gatt_attr *attr, uint16_t value);
700
710 ssize_t (*cfg_write)(struct bt_conn *conn,
711 const struct bt_gatt_attr *attr, uint16_t value);
712
724 bool (*cfg_match)(struct bt_conn *conn,
725 const struct bt_gatt_attr *attr);
726};
727
744ssize_t bt_gatt_attr_read_ccc(struct bt_conn *conn,
745 const struct bt_gatt_attr *attr, void *buf,
746 uint16_t len, uint16_t offset);
747
764ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
765 const struct bt_gatt_attr *attr, const void *buf,
766 uint16_t len, uint16_t offset, uint8_t flags);
767
768
778#define BT_GATT_CCC_INITIALIZER(_changed, _write, _match) \
779 { \
780 .cfg = {}, \
781 .cfg_changed = _changed, \
782 .cfg_write = _write, \
783 .cfg_match = _match, \
784 }
785
794#define BT_GATT_CCC_MANAGED(_ccc, _perm) \
795 BT_GATT_ATTRIBUTE(BT_UUID_GATT_CCC, _perm, \
796 bt_gatt_attr_read_ccc, bt_gatt_attr_write_ccc, \
797 _ccc)
798
807#define BT_GATT_CCC(_changed, _perm) \
808 BT_GATT_CCC_MANAGED(((struct _bt_gatt_ccc[]) \
809 {BT_GATT_CCC_INITIALIZER(_changed, NULL, NULL)}), _perm)
810
827ssize_t bt_gatt_attr_read_cep(struct bt_conn *conn,
828 const struct bt_gatt_attr *attr, void *buf,
829 uint16_t len, uint16_t offset);
830
838#define BT_GATT_CEP(_value) \
839 BT_GATT_DESCRIPTOR(BT_UUID_GATT_CEP, BT_GATT_PERM_READ, \
840 bt_gatt_attr_read_cep, NULL, (void *)_value)
841
859ssize_t bt_gatt_attr_read_cud(struct bt_conn *conn,
860 const struct bt_gatt_attr *attr, void *buf,
861 uint16_t len, uint16_t offset);
862
871#define BT_GATT_CUD(_value, _perm) \
872 BT_GATT_DESCRIPTOR(BT_UUID_GATT_CUD, _perm, bt_gatt_attr_read_cud, \
873 NULL, (void *)_value)
874
891ssize_t bt_gatt_attr_read_cpf(struct bt_conn *conn,
892 const struct bt_gatt_attr *attr, void *buf,
893 uint16_t len, uint16_t offset);
894
902#define BT_GATT_CPF(_value) \
903 BT_GATT_DESCRIPTOR(BT_UUID_GATT_CPF, BT_GATT_PERM_READ, \
904 bt_gatt_attr_read_cpf, NULL, (void *)_value)
905
917#define BT_GATT_DESCRIPTOR(_uuid, _perm, _read, _write, _user_data) \
918 BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _user_data)
919
931#define BT_GATT_ATTRIBUTE(_uuid, _perm, _read, _write, _user_data) \
932{ \
933 .uuid = _uuid, \
934 .read = _read, \
935 .write = _write, \
936 .user_data = _user_data, \
937 .handle = 0, \
938 .perm = _perm, \
939}
940
946typedef void (*bt_gatt_complete_func_t) (struct bt_conn *conn, void *user_data);
947
954 const struct bt_uuid *uuid;
960 const struct bt_gatt_attr *attr;
962 const void *data;
969};
970
992int bt_gatt_notify_cb(struct bt_conn *conn,
993 struct bt_gatt_notify_params *params);
994
1005int bt_gatt_notify_multiple(struct bt_conn *conn, uint16_t num_params,
1006 struct bt_gatt_notify_params *params);
1007
1027static inline int bt_gatt_notify(struct bt_conn *conn,
1028 const struct bt_gatt_attr *attr,
1029 const void *data, uint16_t len)
1030{
1031 struct bt_gatt_notify_params params;
1032
1033 memset(&params, 0, sizeof(params));
1034
1035 params.attr = attr;
1036 params.data = data;
1037 params.len = len;
1038
1039 return bt_gatt_notify_cb(conn, &params);
1040}
1041
1061static inline int bt_gatt_notify_uuid(struct bt_conn *conn,
1062 const struct bt_uuid *uuid,
1063 const struct bt_gatt_attr *attr,
1064 const void *data, uint16_t len)
1065{
1066 struct bt_gatt_notify_params params;
1067
1068 memset(&params, 0, sizeof(params));
1069
1070 params.uuid = uuid;
1071 params.attr = attr;
1072 params.data = data;
1073 params.len = len;
1074
1075 return bt_gatt_notify_cb(conn, &params);
1076}
1077
1078/* Forward declaration of the bt_gatt_indicate_params structure */
1080
1088typedef void (*bt_gatt_indicate_func_t)(struct bt_conn *conn,
1089 struct bt_gatt_indicate_params *params,
1090 uint8_t err);
1091
1093 struct bt_gatt_indicate_params *params);
1094
1102 const struct bt_uuid *uuid;
1108 const struct bt_gatt_attr *attr;
1114 const void *data;
1118 uint8_t _ref;
1119};
1120
1146int bt_gatt_indicate(struct bt_conn *conn,
1147 struct bt_gatt_indicate_params *params);
1148
1149
1167bool bt_gatt_is_subscribed(struct bt_conn *conn,
1168 const struct bt_gatt_attr *attr, uint16_t ccc_value);
1169
1179uint16_t bt_gatt_get_mtu(struct bt_conn *conn);
1180
1192 void (*func)(struct bt_conn *conn, uint8_t err,
1193 struct bt_gatt_exchange_params *params);
1194};
1195
1208int bt_gatt_exchange_mtu(struct bt_conn *conn,
1209 struct bt_gatt_exchange_params *params);
1210
1212
1242typedef uint8_t (*bt_gatt_discover_func_t)(struct bt_conn *conn,
1243 const struct bt_gatt_attr *attr,
1244 struct bt_gatt_discover_params *params);
1245
1247enum {
1288};
1289
1293 const struct bt_uuid *uuid;
1296 union {
1297 struct {
1304 } _included;
1307 };
1312#if defined(CONFIG_BT_GATT_AUTO_DISCOVER_CCC)
1314 struct bt_gatt_subscribe_params *sub_params;
1315#endif /* defined(CONFIG_BT_GATT_AUTO_DISCOVER_CCC) */
1316};
1317
1343int bt_gatt_discover(struct bt_conn *conn,
1344 struct bt_gatt_discover_params *params);
1345
1346struct bt_gatt_read_params;
1347
1360typedef uint8_t (*bt_gatt_read_func_t)(struct bt_conn *conn, uint8_t err,
1361 struct bt_gatt_read_params *params,
1362 const void *data, uint16_t length);
1363
1373 union {
1374 struct {
1380 struct {
1397 struct {
1403 const struct bt_uuid *uuid;
1405 };
1406};
1407
1428int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params);
1429
1431
1439typedef void (*bt_gatt_write_func_t)(struct bt_conn *conn, uint8_t err,
1440 struct bt_gatt_write_params *params);
1441
1451 const void *data;
1454};
1455
1469int bt_gatt_write(struct bt_conn *conn, struct bt_gatt_write_params *params);
1470
1499int bt_gatt_write_without_response_cb(struct bt_conn *conn, uint16_t handle,
1500 const void *data, uint16_t length,
1501 bool sign, bt_gatt_complete_func_t func,
1502 void *user_data);
1503
1517static inline int bt_gatt_write_without_response(struct bt_conn *conn,
1518 uint16_t handle, const void *data,
1519 uint16_t length, bool sign)
1520{
1521 return bt_gatt_write_without_response_cb(conn, handle, data, length,
1522 sign, NULL, NULL);
1523}
1524
1526
1543typedef uint8_t (*bt_gatt_notify_func_t)(struct bt_conn *conn,
1544 struct bt_gatt_subscribe_params *params,
1545 const void *data, uint16_t length);
1546
1548enum {
1559
1573
1580
1583
1594#if defined(CONFIG_BT_GATT_AUTO_DISCOVER_CCC)
1596 uint16_t end_handle;
1598 struct bt_gatt_discover_params *disc_params;
1599#endif /* CONFIG_BT_GATT_AUTO_DISCOVER_CCC */
1604
1606};
1607
1625int bt_gatt_subscribe(struct bt_conn *conn,
1626 struct bt_gatt_subscribe_params *params);
1627
1645 struct bt_gatt_subscribe_params *params);
1646
1659int bt_gatt_unsubscribe(struct bt_conn *conn,
1660 struct bt_gatt_subscribe_params *params);
1661
1667void bt_gatt_cancel(struct bt_conn *conn, void *params);
1668
1671#ifdef __cplusplus
1672}
1673#endif
1674
1679#endif /* ZEPHYR_INCLUDE_BLUETOOTH_GATT_H_ */
Attribute Protocol handling.
Bluetooth connection handling.
void
Definition: eswifi_shell.c:15
#define ATOMIC_DEFINE(name, num_bits)
Define an array of atomic variables.
Definition: atomic.h:113
int bt_gatt_exchange_mtu(struct bt_conn *conn, struct bt_gatt_exchange_params *params)
Exchange MTU.
int bt_gatt_read(struct bt_conn *conn, struct bt_gatt_read_params *params)
Read Attribute Value by handle.
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.
Definition: gatt.h:1242
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.
void bt_gatt_cancel(struct bt_conn *conn, void *params)
Cancel GATT pending request.
int bt_gatt_unsubscribe(struct bt_conn *conn, struct bt_gatt_subscribe_params *params)
Unsubscribe Attribute Value Notification.
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.
Definition: gatt.h:1360
int bt_gatt_resubscribe(uint8_t id, const bt_addr_le_t *peer, struct bt_gatt_subscribe_params *params)
Resubscribe Attribute Value Notification subscription.
int bt_gatt_subscribe(struct bt_conn *conn, struct bt_gatt_subscribe_params *params)
Subscribe Attribute Value Notification.
int bt_gatt_write(struct bt_conn *conn, struct bt_gatt_write_params *params)
Write Attribute Value by handle.
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.
Definition: gatt.h:1517
int bt_gatt_discover(struct bt_conn *conn, struct bt_gatt_discover_params *params)
GATT Discover function.
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.
Definition: gatt.h:1543
void(* bt_gatt_write_func_t)(struct bt_conn *conn, uint8_t err, struct bt_gatt_write_params *params)
Write callback function.
Definition: gatt.h:1439
@ BT_GATT_SUBSCRIBE_FLAG_NO_RESUB
No resubscribe flag.
Definition: gatt.h:1572
@ BT_GATT_SUBSCRIBE_NUM_FLAGS
Definition: gatt.h:1581
@ BT_GATT_SUBSCRIBE_FLAG_VOLATILE
Persistence flag.
Definition: gatt.h:1558
@ BT_GATT_SUBSCRIBE_FLAG_WRITE_PENDING
Write pending flag.
Definition: gatt.h:1579
@ BT_GATT_DISCOVER_DESCRIPTOR
Discover Descriptors.
Definition: gatt.h:1267
@ BT_GATT_DISCOVER_SECONDARY
Definition: gatt.h:1251
@ BT_GATT_DISCOVER_CHARACTERISTIC
Discover Characteristic Values.
Definition: gatt.h:1258
@ BT_GATT_DISCOVER_INCLUDE
Definition: gatt.h:1253
@ BT_GATT_DISCOVER_STD_CHAR_DESC
Discover standard characteristic descriptor values.
Definition: gatt.h:1287
@ BT_GATT_DISCOVER_PRIMARY
Definition: gatt.h:1249
@ BT_GATT_DISCOVER_ATTRIBUTE
Discover Attributes.
Definition: gatt.h:1276
void(* bt_gatt_indicate_func_t)(struct bt_conn *conn, struct bt_gatt_indicate_params *params, uint8_t err)
Indication complete result callback.
Definition: gatt.h:1088
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.
Definition: gatt.h:1061
void bt_gatt_cb_register(struct bt_gatt_cb *cb)
Register GATT callbacks.
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.
uint16_t bt_gatt_attr_get_handle(const struct bt_gatt_attr *attr)
Get Attribute handle.
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.
uint16_t bt_gatt_get_mtu(struct bt_conn *conn)
Get ATT MTU for a connection.
struct bt_gatt_attr * bt_gatt_attr_next(const struct bt_gatt_attr *attr)
Iterate to the next attribute.
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.
int bt_gatt_indicate(struct bt_conn *conn, struct bt_gatt_indicate_params *params)
Indicate attribute value change.
int bt_gatt_notify_cb(struct bt_conn *conn, struct bt_gatt_notify_params *params)
Notify attribute value change.
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.
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.
void(* bt_gatt_indicate_params_destroy_t)(struct bt_gatt_indicate_params *params)
Definition: gatt.h:1092
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.
Definition: gatt.h:1027
uint16_t bt_gatt_attr_value_handle(const struct bt_gatt_attr *attr)
Get the handle of the characteristic value descriptor.
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.
Definition: gatt.h:418
int bt_gatt_notify_multiple(struct bt_conn *conn, uint16_t num_params, struct bt_gatt_notify_params *params)
Notify multiple attribute value change.
int bt_gatt_service_register(struct bt_gatt_service *svc)
Register GATT service.
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.
#define BT_GATT_CCC_MAX
Definition: gatt.h:673
void(* bt_gatt_complete_func_t)(struct bt_conn *conn, void *user_data)
Notification complete result callback.
Definition: gatt.h:946
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.
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.
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.
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.
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.
uint8_t(* bt_gatt_attr_func_t)(const struct bt_gatt_attr *attr, uint16_t handle, void *user_data)
Attribute iterator callback.
Definition: gatt.h:387
int bt_gatt_service_unregister(struct bt_gatt_service *svc)
Unregister GATT service. *.
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.
@ BT_GATT_ITER_STOP
Definition: gatt.h:373
@ BT_GATT_ITER_CONTINUE
Definition: gatt.h:374
@ BT_GATT_WRITE_FLAG_PREPARE
Attribute prepare write flag.
Definition: gatt.h:93
@ BT_GATT_WRITE_FLAG_CMD
Attribute write command flag.
Definition: gatt.h:100
@ BT_GATT_PERM_READ_ENCRYPT
Attribute read permission with encryption.
Definition: gatt.h:47
@ BT_GATT_PERM_WRITE
Definition: gatt.h:41
@ BT_GATT_PERM_WRITE_ENCRYPT
Attribute write permission with encryption.
Definition: gatt.h:53
@ BT_GATT_PERM_NONE
Definition: gatt.h:35
@ BT_GATT_PERM_READ
Definition: gatt.h:38
@ BT_GATT_PERM_PREPARE_WRITE
Attribute prepare write permission.
Definition: gatt.h:74
@ BT_GATT_PERM_READ_AUTHEN
Attribute read permission with authentication.
Definition: gatt.h:60
@ BT_GATT_PERM_WRITE_AUTHEN
Attribute write permission with authentication.
Definition: gatt.h:67
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
flags
Definition: http_parser.h:131
__SIZE_TYPE__ ssize_t
Definition: types.h:28
Single-linked list implementation.
struct _snode sys_snode_t
Definition: slist.h:33
#define bool
Definition: stdbool.h:13
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
__INT8_TYPE__ int8_t
Definition: stdint.h:42
void * memset(void *buf, int c, size_t n)
Definition: addr.h:39
GATT Attribute structure.
Definition: gatt.h:104
uint8_t perm
Definition: gatt.h:146
ssize_t(* read)(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
Attribute read callback.
Definition: gatt.h:122
const struct bt_uuid * uuid
Definition: gatt.h:106
ssize_t(* write)(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
Attribute write callback.
Definition: gatt.h:137
void * user_data
Definition: gatt.h:142
uint16_t handle
Definition: gatt.h:144
GATT callback structure.
Definition: gatt.h:186
void(* att_mtu_updated)(struct bt_conn *conn, uint16_t tx, uint16_t rx)
The maximum ATT MTU on a connection has changed.
Definition: gatt.h:196
sys_snode_t node
Definition: gatt.h:198
GATT CCC configuration entry.
Definition: gatt.h:677
uint16_t value
Definition: gatt.h:683
bt_addr_le_t peer
Definition: gatt.h:681
uint8_t id
Definition: gatt.h:679
Definition: gatt.h:291
uint16_t flags
Definition: gatt.h:293
Characteristic Extended Properties Attribute Value.
Definition: gatt.h:270
uint16_t properties
Definition: gatt.h:272
Characteristic Attribute Value.
Definition: gatt.h:256
uint16_t value_handle
Definition: gatt.h:260
uint8_t properties
Definition: gatt.h:262
const struct bt_uuid * uuid
Definition: gatt.h:258
GATT Characteristic Presentation Format Attribute Value.
Definition: gatt.h:313
uint8_t name_space
Definition: gatt.h:323
uint16_t unit
Definition: gatt.h:321
int8_t exponent
Definition: gatt.h:319
uint16_t description
Definition: gatt.h:325
uint8_t format
Definition: gatt.h:315
GATT Discover Attributes parameters.
Definition: gatt.h:1291
uint16_t start_handle
Definition: gatt.h:1301
uint16_t end_handle
Definition: gatt.h:1303
bt_gatt_discover_func_t func
Definition: gatt.h:1295
uint16_t attr_handle
Definition: gatt.h:1299
const struct bt_uuid * uuid
Definition: gatt.h:1293
uint8_t type
Definition: gatt.h:1311
GATT Exchange MTU parameters.
Definition: gatt.h:1190
void(* func)(struct bt_conn *conn, uint8_t err, struct bt_gatt_exchange_params *params)
Definition: gatt.h:1192
Include Attribute Value.
Definition: gatt.h:176
uint16_t end_handle
Definition: gatt.h:182
uint16_t start_handle
Definition: gatt.h:180
const struct bt_uuid * uuid
Definition: gatt.h:178
GATT Indicate Value parameters.
Definition: gatt.h:1096
uint16_t len
Definition: gatt.h:1116
const struct bt_gatt_attr * attr
Indicate Attribute object.
Definition: gatt.h:1108
const void * data
Definition: gatt.h:1114
bt_gatt_indicate_params_destroy_t destroy
Definition: gatt.h:1112
bt_gatt_indicate_func_t func
Definition: gatt.h:1110
const struct bt_uuid * uuid
Indicate Attribute UUID type.
Definition: gatt.h:1102
Definition: gatt.h:948
const struct bt_uuid * uuid
Notification Attribute UUID type.
Definition: gatt.h:954
uint16_t len
Definition: gatt.h:964
const struct bt_gatt_attr * attr
Notification Attribute object.
Definition: gatt.h:960
bt_gatt_complete_func_t func
Definition: gatt.h:966
void * user_data
Definition: gatt.h:968
const void * data
Definition: gatt.h:962
GATT Read parameters.
Definition: gatt.h:1365
size_t handle_count
Definition: gatt.h:1372
uint16_t * handles
Definition: gatt.h:1384
uint16_t offset
Definition: gatt.h:1378
bt_gatt_read_func_t func
Definition: gatt.h:1367
struct bt_gatt_read_params::@66::@70 by_uuid
bool variable
Definition: gatt.h:1395
uint16_t end_handle
Definition: gatt.h:1401
struct bt_gatt_read_params::@66::@68 single
uint16_t start_handle
Definition: gatt.h:1399
struct bt_gatt_read_params::@66::@69 multiple
const struct bt_uuid * uuid
Definition: gatt.h:1403
uint16_t handle
Definition: gatt.h:1376
Definition: gatt.h:307
uint16_t flags
Definition: gatt.h:309
GATT Service structure.
Definition: gatt.h:150
const struct bt_gatt_attr * attrs
Definition: gatt.h:152
size_t attr_count
Definition: gatt.h:154
Service Attribute Value.
Definition: gatt.h:168
const struct bt_uuid * uuid
Definition: gatt.h:170
uint16_t end_handle
Definition: gatt.h:172
GATT Service structure.
Definition: gatt.h:158
struct bt_gatt_attr * attrs
Definition: gatt.h:160
size_t attr_count
Definition: gatt.h:162
sys_snode_t node
Definition: gatt.h:164
GATT Subscribe parameters.
Definition: gatt.h:1585
bt_gatt_write_func_t write
Definition: gatt.h:1589
uint16_t value
Definition: gatt.h:1601
uint16_t ccc_handle
Definition: gatt.h:1593
uint16_t value_handle
Definition: gatt.h:1591
sys_snode_t node
Definition: gatt.h:1605
bt_gatt_notify_func_t notify
Definition: gatt.h:1587
GATT Write parameters.
Definition: gatt.h:1443
bt_gatt_write_func_t func
Definition: gatt.h:1445
uint16_t handle
Definition: gatt.h:1447
const void * data
Definition: gatt.h:1451
uint16_t offset
Definition: gatt.h:1449
uint16_t length
Definition: gatt.h:1453
This is a 'tentative' type and should be used as a pointer only.
Definition: uuid.h:46
static fdata_t data[2]
Definition: test_fifo_contexts.c:15
static const intptr_t user_data[5]
Definition: main.c:590
Misc utilities.
Bluetooth UUID handling.