1 /** @file
2 * @brief Internal API for Generic Attribute Profile handling.
3 */
4
5 /*
6 * Copyright (c) 2015-2016 Intel Corporation
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11 #define BT_GATT_CENTRAL_ADDR_RES_NOT_SUPP 0
12 #define BT_GATT_CENTRAL_ADDR_RES_SUPP 1
13
14 #define BT_GATT_PERM_READ_MASK (BT_GATT_PERM_READ | \
15 BT_GATT_PERM_READ_ENCRYPT | \
16 BT_GATT_PERM_READ_AUTHEN)
17 #define BT_GATT_PERM_WRITE_MASK (BT_GATT_PERM_WRITE | \
18 BT_GATT_PERM_WRITE_ENCRYPT | \
19 BT_GATT_PERM_WRITE_AUTHEN)
20 #define BT_GATT_PERM_ENCRYPT_MASK (BT_GATT_PERM_READ_ENCRYPT | \
21 BT_GATT_PERM_WRITE_ENCRYPT)
22 #define BT_GATT_PERM_AUTHEN_MASK (BT_GATT_PERM_READ_AUTHEN | \
23 BT_GATT_PERM_WRITE_AUTHEN)
24
25 void bt_gatt_init(void);
26 void bt_gatt_connected(struct bt_conn *conn);
27 void bt_gatt_encrypt_change(struct bt_conn *conn);
28 void bt_gatt_disconnected(struct bt_conn *conn);
29
30 bool bt_gatt_change_aware(struct bt_conn *conn, bool req);
31
32 int bt_gatt_store_ccc(u8_t id, const bt_addr_le_t *addr);
33
34 int bt_gatt_clear(u8_t id, const bt_addr_le_t *addr);
35
36 #if defined(CONFIG_BT_GATT_CLIENT)
37 void bt_gatt_notification(struct bt_conn *conn, u16_t handle,
38 const void *data, u16_t length);
39
40 void bt_gatt_mult_notification(struct bt_conn *conn, const void *data,
41 u16_t length);
42 #else
bt_gatt_notification(struct bt_conn * conn,u16_t handle,const void * data,u16_t length)43 static inline void bt_gatt_notification(struct bt_conn *conn, u16_t handle,
44 const void *data, u16_t length)
45 {
46 }
47
bt_gatt_mult_notification(struct bt_conn * conn,const void * data,u16_t length)48 static inline void bt_gatt_mult_notification(struct bt_conn *conn,
49 const void *data, u16_t length)
50 {
51 }
52 #endif /* CONFIG_BT_GATT_CLIENT */
53
54 struct bt_gatt_attr;
55
56 /* Check attribute permission */
57 u8_t bt_gatt_check_perm(struct bt_conn *conn, const struct bt_gatt_attr *attr,
58 u8_t mask);
59