ble_gatt_client
|
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
Macros | |
#define | BT_GATT_UUID_SIZE 16 |
Typedefs | |
typedef void(* | bt_gatt_client_destroy_func_t )(void *user_data) |
typedef void(* | bt_gatt_client_callback_t )(bool success, uint8_t att_ecode, void *user_data) |
typedef void(* | bt_gatt_client_debug_func_t )(const char *str, void *user_data) |
typedef void(* | bt_gatt_client_read_callback_t )(bool success, uint8_t att_ecode, const uint8_t *value, uint16_t length, void *user_data) |
typedef void(* | bt_gatt_client_write_long_callback_t )(bool success, bool reliable_error, uint8_t att_ecode, void *user_data) |
typedef void(* | bt_gatt_client_notify_callback_t )(uint16_t value_handle, const uint8_t *value, uint16_t length, void *user_data) |
typedef void(* | bt_gatt_client_register_callback_t )(uint16_t att_ecode, void *user_data) |
typedef void(* | bt_gatt_client_service_changed_callback_t )(uint16_t start_handle, uint16_t end_handle, void *user_data) |
#define BT_GATT_UUID_SIZE 16 |
Definition at line 28 of file gatt-client.h.
typedef void(* bt_gatt_client_callback_t)(bool success, uint8_t att_ecode, void *user_data) |
Definition at line 40 of file gatt-client.h.
typedef void(* bt_gatt_client_debug_func_t)(const char *str, void *user_data) |
Definition at line 42 of file gatt-client.h.
typedef void(* bt_gatt_client_destroy_func_t)(void *user_data) |
Definition at line 39 of file gatt-client.h.
typedef void(* bt_gatt_client_notify_callback_t)(uint16_t value_handle, const uint8_t *value, uint16_t length, void *user_data) |
Definition at line 49 of file gatt-client.h.
typedef void(* bt_gatt_client_read_callback_t)(bool success, uint8_t att_ecode, const uint8_t *value, uint16_t length, void *user_data) |
Definition at line 43 of file gatt-client.h.
typedef void(* bt_gatt_client_register_callback_t)(uint16_t att_ecode, void *user_data) |
Definition at line 52 of file gatt-client.h.
typedef void(* bt_gatt_client_service_changed_callback_t)(uint16_t start_handle, uint16_t end_handle, void *user_data) |
Definition at line 54 of file gatt-client.h.
typedef void(* bt_gatt_client_write_long_callback_t)(bool success, bool reliable_error, uint8_t att_ecode, void *user_data) |
Definition at line 46 of file gatt-client.h.
bool bt_gatt_client_cancel | ( | struct bt_gatt_client * | client, |
unsigned int | id | ||
) |
Definition at line 1959 of file gatt-client.c.
References bt_gatt_client::att, cancel_request(), match_req_id(), bt_gatt_client::pending_requests, queue_remove_if(), and UINT_TO_PTR.
Referenced by cmd_write_execute().
bool bt_gatt_client_cancel_all | ( | struct bt_gatt_client * | client | ) |
Definition at line 1974 of file gatt-client.c.
References bt_gatt_client::att, bt_att_cancel(), bt_gatt_request_cancel(), bt_gatt_request_unref(), cancel_request(), bt_gatt_client::discovery_req, bt_gatt_client::mtu_req_id, bt_gatt_client::pending_requests, and queue_remove_all().
Referenced by bt_gatt_client_free().
struct gatt_db* bt_gatt_client_get_db | ( | struct bt_gatt_client * | client | ) |
Definition at line 1881 of file gatt-client.c.
References bt_gatt_client::db.
uint16_t bt_gatt_client_get_mtu | ( | struct bt_gatt_client * | client | ) |
Definition at line 1873 of file gatt-client.c.
References bt_gatt_client::att, and bt_att_get_mtu().
int bt_gatt_client_get_security | ( | struct bt_gatt_client * | client | ) |
Definition at line 3063 of file gatt-client.c.
References bt_gatt_client::att, and bt_att_get_security().
Referenced by cmd_get_security().
bool bt_gatt_client_is_ready | ( | struct bt_gatt_client * | client | ) |
Definition at line 1815 of file gatt-client.c.
References bt_gatt_client::ready.
Referenced by bt_gatt_client_register_notify(), cmd_get_security(), cmd_read_long_value(), cmd_read_multiple(), cmd_read_value(), cmd_register_notify(), cmd_services(), cmd_set_security(), cmd_unregister_notify(), cmd_write_execute(), cmd_write_long_value(), cmd_write_prepare(), and cmd_write_value().
struct bt_gatt_client* bt_gatt_client_new | ( | struct gatt_db * | db, |
struct bt_att * | att, | ||
uint16_t | mtu | ||
) |
Definition at line 1733 of file gatt-client.c.
References bt_gatt_client::att, att_disconnect_cb(), BT_ATT_OP_HANDLE_VAL_IND, BT_ATT_OP_HANDLE_VAL_NOT, bt_att_ref(), bt_att_register(), bt_att_register_disconnect(), bt_gatt_client_free(), bt_gatt_client_ref(), bt_gatt_client::db, bt_gatt_client::disc_id, gatt_client_init(), gatt_db_ref(), bt_gatt_client::ind_id, bt_gatt_client::long_write_queue, new0, notify_cb(), bt_gatt_client::notify_chrcs, bt_gatt_client::notify_id, bt_gatt_client::notify_list, bt_gatt_client::pending_requests, queue_new(), and bt_gatt_client::svc_chngd_queue.
Referenced by client_create().
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 at line 2846 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, BT_ATT_OP_PREP_WRITE_REQ, bt_att_send(), prep_write_op::callback, request::data, bt_gatt_client::debug_callback, bt_gatt_client::debug_data, request::destroy, prep_write_op::destroy, destroy_prep_write_op(), get_reliable_request(), request::id, bt_gatt_client::in_long_write, prep_write_op::pdu, prep_write_op::pdu_len, request::prep_write, prep_write_cb(), put_le16(), bt_gatt_client::reliable_write_session_id, request_unref(), prep_write_op::user_data, and util_debug().
Referenced by cmd_write_prepare().
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 at line 2279 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, BT_ATT_OP_READ_BLOB_REQ, bt_att_send(), read_long_op::callback, read_long_op::client, request::data, request::destroy, read_long_op::destroy, destroy_read_long_op(), request::id, new0, read_long_op::offset, put_le16(), read_long_cb(), request_create(), request_unref(), read_long_op::user_data, and read_long_op::value_handle.
Referenced by cmd_read_long_value().
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 at line 2122 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, bt_att_get_mtu(), BT_ATT_OP_READ_MULT_REQ, bt_att_send(), read_op::callback, request::data, request::destroy, read_op::destroy, destroy_read_op(), request::id, new0, put_le16(), read_multiple_cb(), request_create(), request_unref(), and read_op::user_data.
Referenced by cmd_read_multiple().
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 | ||
) |
client | |
value_handle | |
callback | |
user_data | |
destroy |
Definition at line 2050 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, BT_ATT_OP_READ_REQ, bt_att_send(), read_op::callback, request::data, request::destroy, read_op::destroy, destroy_read_op(), request::id, new0, put_le16(), read_cb(), request_create(), request_unref(), and read_op::user_data.
Referenced by cmd_read_value().
struct bt_gatt_client* bt_gatt_client_ref | ( | struct bt_gatt_client * | client | ) |
Definition at line 1794 of file gatt-client.c.
References bt_gatt_client::ref_count.
Referenced by bt_gatt_client_new(), complete_write_long_op(), enable_ccc_callback(), execute_write_cb(), notify_cb(), and notify_client_ready().
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 at line 3018 of file gatt-client.c.
References bt_gatt_client_is_ready(), bt_gatt_client::db, bt_gatt_client::in_svc_chngd, and register_notify().
Referenced by cmd_register_notify().
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 at line 1856 of file gatt-client.c.
References bt_gatt_client::debug_callback, bt_gatt_client::debug_data, and bt_gatt_client::debug_destroy.
Referenced by client_create().
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 at line 1820 of file gatt-client.c.
References bt_gatt_client::ready_callback, bt_gatt_client::ready_data, and bt_gatt_client::ready_destroy.
Referenced by client_create().
bool bt_gatt_client_set_security | ( | struct bt_gatt_client * | client, |
int | level | ||
) |
Definition at line 3055 of file gatt-client.c.
References bt_gatt_client::att, and bt_att_set_security().
Referenced by cmd_set_security().
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 at line 1838 of file gatt-client.c.
References bt_gatt_client::svc_chngd_callback, bt_gatt_client::svc_chngd_data, and bt_gatt_client::svc_chngd_destroy.
Referenced by client_create().
void bt_gatt_client_unref | ( | struct bt_gatt_client * | client | ) |
Definition at line 1804 of file gatt-client.c.
References bt_gatt_client_free(), and bt_gatt_client::ref_count.
Referenced by client_destroy(), complete_write_long_op(), enable_ccc_callback(), execute_write_cb(), notify_cb(), and notify_client_ready().
bool bt_gatt_client_unregister_notify | ( | struct bt_gatt_client * | client, |
unsigned int | id | ||
) |
Definition at line 3035 of file gatt-client.c.
References notify_chrc::ccc_write_id, notify_data::chrc, complete_unregister_notify(), match_notify_data_id(), notify_chrc::notify_count, bt_gatt_client::notify_list, queue_remove_if(), and UINT_TO_PTR.
Referenced by cmd_unregister_notify().
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 at line 2966 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, BT_ATT_OP_EXEC_WRITE_REQ, bt_att_send(), write_op::callback, write_op::client, request::data, request::destroy, write_op::destroy, destroy_write_op(), exec_write_cb(), bt_gatt_client::in_long_write, match_req_id(), new0, bt_gatt_client::pending_requests, queue_find(), bt_gatt_client::reliable_write_session_id, request_unref(), UINT_TO_PTR, and write_op::user_data.
Referenced by cmd_write_execute().
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 at line 2670 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, bt_att_get_mtu(), BT_ATT_OP_PREP_WRITE_REQ, bt_att_send(), long_write_op::callback, long_write_op::client, long_write_op::cur_length, request::data, request::destroy, long_write_op::destroy, request::id, bt_gatt_client::in_long_write, long_write_op::length, request::long_write, long_write_op_free(), bt_gatt_client::long_write_queue, MIN, new0, long_write_op::offset, prepare_write_cb(), put_le16(), queue_push_tail(), long_write_op::reliable, bt_gatt_client::reliable_write_session_id, request_create(), request_unref(), long_write_op::user_data, long_write_op::value, and long_write_op::value_handle.
Referenced by cmd_write_long_value().
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 at line 2405 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, BT_ATT_OP_WRITE_REQ, bt_att_send(), write_op::callback, request::data, request::destroy, write_op::destroy, destroy_write_op(), request::id, new0, put_le16(), request_create(), request_unref(), write_op::user_data, and write_cb().
Referenced by cmd_write_value().
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 at line 2328 of file gatt-client.c.
References bt_gatt_client::att, request::att_id, bt_att_get_security(), BT_ATT_OP_SIGNED_WRITE_CMD, BT_ATT_OP_WRITE_CMD, bt_att_send(), BT_SECURITY_LOW, request::id, put_le16(), request_create(), and request_unref().
Referenced by cmd_write_value().