ble_gatt_client
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
gatt-client.h
Go to the documentation of this file.
1 /*
2  *
3  * BlueZ - Bluetooth protocol stack for Linux
4  *
5  * Copyright (C) 2014 Google Inc.
6  *
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  */
23 
24 #include <stdbool.h>
25 #include <stdint.h>
26 #include <stddef.h>
27 
28 #define BT_GATT_UUID_SIZE 16
29 
30 struct bt_gatt_client;
31 
33  struct bt_att *att,
34  uint16_t mtu);
35 
38 
39 typedef void (*bt_gatt_client_destroy_func_t)(void *user_data);
40 typedef void (*bt_gatt_client_callback_t)(bool success, uint8_t att_ecode,
41  void *user_data);
42 typedef void (*bt_gatt_client_debug_func_t)(const char *str, void *user_data);
43 typedef void (*bt_gatt_client_read_callback_t)(bool success, uint8_t att_ecode,
44  const uint8_t *value, uint16_t length,
45  void *user_data);
46 typedef void (*bt_gatt_client_write_long_callback_t)(bool success,
47  bool reliable_error, uint8_t att_ecode,
48  void *user_data);
49 typedef void (*bt_gatt_client_notify_callback_t)(uint16_t value_handle,
50  const uint8_t *value, uint16_t length,
51  void *user_data);
52 typedef void (*bt_gatt_client_register_callback_t)(uint16_t att_ecode,
53  void *user_data);
54 typedef void (*bt_gatt_client_service_changed_callback_t)(uint16_t start_handle,
55  uint16_t end_handle,
56  void *user_data);
57 
61  void *user_data,
65  void *user_data,
69  void *user_data,
71 
74 
75 bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id);
77 
79  uint16_t value_handle,
81  void *user_data,
84  uint16_t value_handle, uint16_t offset,
86  void *user_data,
89  uint16_t *handles, uint8_t num_handles,
91  void *user_data,
93 
95  struct bt_gatt_client *client,
96  uint16_t value_handle,
97  bool signed_write,
98  const uint8_t *value, uint16_t length);
100  uint16_t value_handle,
101  const uint8_t *value, uint16_t length,
102  bt_gatt_client_callback_t callback,
103  void *user_data,
106  bool reliable,
107  uint16_t value_handle, uint16_t offset,
108  const uint8_t *value, uint16_t length,
110  void *user_data,
113  unsigned int id,
114  uint16_t value_handle, uint16_t offset,
115  const uint8_t *value, uint16_t length,
117  void *user_data,
120  unsigned int id,
121  bt_gatt_client_callback_t callback,
122  void *user_data,
124 
126  uint16_t chrc_value_handle,
129  void *user_data,
132  unsigned int id);
133 
134 bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level);
unsigned int bt_gatt_client_write_long_value(struct bt_gatt_client *client, bool reliable, uint16_t value_handle, uint16_t offset, const uint8_t *value, uint16_t length, bt_gatt_client_write_long_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:2670
bluetooth GATT client structure
Definition: gatt-client.c:64
void(* bt_gatt_client_service_changed_callback_t)(uint16_t start_handle, uint16_t end_handle, void *user_data)
Definition: gatt-client.h:54
unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client, uint16_t value_handle, uint16_t offset, bt_gatt_client_read_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:2279
bool bt_gatt_client_set_debug(struct bt_gatt_client *client, bt_gatt_client_debug_func_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:1856
Definition: gatt-db.c:70
int bt_gatt_client_get_security(struct bt_gatt_client *client)
Definition: gatt-client.c:3063
void bt_gatt_client_unref(struct bt_gatt_client *client)
Definition: gatt-client.c:1804
void(* bt_gatt_client_write_long_callback_t)(bool success, bool reliable_error, uint8_t att_ecode, void *user_data)
Definition: gatt-client.h:46
struct bt_gatt_client * bt_gatt_client_ref(struct bt_gatt_client *client)
Definition: gatt-client.c:1794
bool bt_gatt_client_cancel(struct bt_gatt_client *client, unsigned int id)
Definition: gatt-client.c:1959
void(* bt_gatt_client_debug_func_t)(const char *str, void *user_data)
Definition: gatt-client.h:42
unsigned int bt_gatt_client_write_execute(struct bt_gatt_client *client, unsigned int id, bt_gatt_client_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:2966
unsigned int bt_gatt_client_read_value(struct bt_gatt_client *client, uint16_t value_handle, bt_gatt_client_read_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:2050
void(* bt_gatt_client_register_callback_t)(uint16_t att_ecode, void *user_data)
Definition: gatt-client.h:52
unsigned int bt_gatt_client_prepare_write(struct bt_gatt_client *client, unsigned int id, uint16_t value_handle, uint16_t offset, const uint8_t *value, uint16_t length, bt_gatt_client_write_long_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:2846
struct gatt_db * db
Definition: gatt-client.c:81
struct bt_att * att
Definition: gatt-client.c:65
unsigned int bt_gatt_client_write_without_response(struct bt_gatt_client *client, uint16_t value_handle, bool signed_write, const uint8_t *value, uint16_t length)
Definition: gatt-client.c:2328
unsigned int bt_gatt_client_register_notify(struct bt_gatt_client *client, uint16_t chrc_value_handle, bt_gatt_client_register_callback_t callback, bt_gatt_client_notify_callback_t notify, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:3018
struct gatt_db * bt_gatt_client_get_db(struct bt_gatt_client *client)
Definition: gatt-client.c:1881
bool bt_gatt_client_set_ready_handler(struct bt_gatt_client *client, bt_gatt_client_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:1820
bool bt_gatt_client_unregister_notify(struct bt_gatt_client *client, unsigned int id)
Definition: gatt-client.c:3035
bool bt_gatt_client_cancel_all(struct bt_gatt_client *client)
Definition: gatt-client.c:1974
void(* bt_gatt_client_read_callback_t)(bool success, uint8_t att_ecode, const uint8_t *value, uint16_t length, void *user_data)
Definition: gatt-client.h:43
void(* bt_gatt_client_callback_t)(bool success, uint8_t att_ecode, void *user_data)
Definition: gatt-client.h:40
struct bt_gatt_client * bt_gatt_client_new(struct gatt_db *db, struct bt_att *att, uint16_t mtu)
Definition: gatt-client.c:1733
Definition: att.c:64
uint16_t bt_gatt_client_get_mtu(struct bt_gatt_client *client)
Definition: gatt-client.c:1873
void(* bt_gatt_client_notify_callback_t)(uint16_t value_handle, const uint8_t *value, uint16_t length, void *user_data)
Definition: gatt-client.h:49
bool bt_gatt_client_set_service_changed(struct bt_gatt_client *client, bt_gatt_client_service_changed_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:1838
unsigned int bt_gatt_client_write_value(struct bt_gatt_client *client, uint16_t value_handle, const uint8_t *value, uint16_t length, bt_gatt_client_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:2405
bool bt_gatt_client_is_ready(struct bt_gatt_client *client)
Definition: gatt-client.c:1815
void(* bt_gatt_client_destroy_func_t)(void *user_data)
Definition: gatt-client.h:39
bool bt_gatt_client_set_security(struct bt_gatt_client *client, int level)
Definition: gatt-client.c:3055
unsigned int bt_gatt_client_read_multiple(struct bt_gatt_client *client, uint16_t *handles, uint8_t num_handles, bt_gatt_client_read_callback_t callback, void *user_data, bt_gatt_client_destroy_func_t destroy)
Definition: gatt-client.c:2122