ble_gatt_client
|
Go to the source code of this file.
Typedefs | |
typedef void(* | bt_att_response_func_t )(uint8_t opcode, const void *pdu, uint16_t length, void *user_data) |
typedef void(* | bt_att_notify_func_t )(uint8_t opcode, const void *pdu, uint16_t length, void *user_data) |
typedef void(* | bt_att_destroy_func_t )(void *user_data) |
typedef void(* | bt_att_debug_func_t )(const char *str, void *user_data) |
typedef void(* | bt_att_timeout_func_t )(unsigned int id, uint8_t opcode, void *user_data) |
typedef void(* | bt_att_disconnect_func_t )(int err, void *user_data) |
typedef bool(* | bt_att_counter_func_t )(uint32_t *sign_cnt, void *user_data) |
Functions | |
struct bt_att * | bt_att_new (int fd, bool ext_signed) |
struct bt_att * | bt_att_ref (struct bt_att *att) |
void | bt_att_unref (struct bt_att *att) |
bool | bt_att_set_close_on_unref (struct bt_att *att, bool do_close) |
int | bt_att_get_fd (struct bt_att *att) |
bool | bt_att_set_debug (struct bt_att *att, bt_att_debug_func_t callback, void *user_data, bt_att_destroy_func_t destroy) |
uint16_t | bt_att_get_mtu (struct bt_att *att) |
bool | bt_att_set_mtu (struct bt_att *att, uint16_t mtu) |
bool | bt_att_set_timeout_cb (struct bt_att *att, bt_att_timeout_func_t callback, void *user_data, bt_att_destroy_func_t destroy) |
unsigned int | bt_att_send (struct bt_att *att, uint8_t opcode, const void *pdu, uint16_t length, bt_att_response_func_t callback, void *user_data, bt_att_destroy_func_t destroy) |
bool | bt_att_cancel (struct bt_att *att, unsigned int id) |
bool | bt_att_cancel_all (struct bt_att *att) |
unsigned int | bt_att_send_error_rsp (struct bt_att *att, uint8_t opcode, uint16_t handle, int error) |
unsigned int | bt_att_register (struct bt_att *att, uint8_t opcode, bt_att_notify_func_t callback, void *user_data, bt_att_destroy_func_t destroy) |
bool | bt_att_unregister (struct bt_att *att, unsigned int id) |
unsigned int | bt_att_register_disconnect (struct bt_att *att, bt_att_disconnect_func_t callback, void *user_data, bt_att_destroy_func_t destroy) |
bool | bt_att_unregister_disconnect (struct bt_att *att, unsigned int id) |
bool | bt_att_unregister_all (struct bt_att *att) |
int | bt_att_get_security (struct bt_att *att) |
bool | bt_att_set_security (struct bt_att *att, int level) |
bool | bt_att_set_local_key (struct bt_att *att, uint8_t sign_key[16], bt_att_counter_func_t func, void *user_data) |
bool | bt_att_set_remote_key (struct bt_att *att, uint8_t sign_key[16], bt_att_counter_func_t func, void *user_data) |
bool | bt_att_has_crypto (struct bt_att *att) |
typedef bool(* bt_att_counter_func_t)(uint32_t *sign_cnt, void *user_data) |
typedef void(* bt_att_debug_func_t)(const char *str, void *user_data) |
typedef void(* bt_att_disconnect_func_t)(int err, void *user_data) |
typedef void(* bt_att_notify_func_t)(uint8_t opcode, const void *pdu, uint16_t length, void *user_data) |
typedef void(* bt_att_response_func_t)(uint8_t opcode, const void *pdu, uint16_t length, void *user_data) |
typedef void(* bt_att_timeout_func_t)(unsigned int id, uint8_t opcode, void *user_data) |
bool bt_att_cancel | ( | struct bt_att * | att, |
unsigned int | id | ||
) |
Definition at line 1278 of file att.c.
References cancel_att_send_op(), destroy_att_send_op(), att_send_op::id, bt_att::ind_queue, match_op_id(), bt_att::pending_ind, bt_att::pending_req, queue_remove_if(), bt_att::req_queue, UINT_TO_PTR, wakeup_writer(), and bt_att::write_queue.
Referenced by bt_gatt_client_cancel_all(), bt_gatt_request_cancel(), cancel_request(), complete_unregister_notify(), and notify_data_cleanup().
bool bt_att_cancel_all | ( | struct bt_att * | att | ) |
Definition at line 1320 of file att.c.
References cancel_att_send_op(), destroy_att_send_op(), bt_att::ind_queue, bt_att::pending_ind, bt_att::pending_req, queue_remove_all(), bt_att::req_queue, and bt_att::write_queue.
Referenced by bt_att_unref(), and disconnect_cb().
int bt_att_get_fd | ( | struct bt_att * | att | ) |
Definition at line 1087 of file att.c.
References bt_att::fd.
uint16_t bt_att_get_mtu | ( | struct bt_att * | att | ) |
Definition at line 1111 of file att.c.
References bt_att::mtu.
Referenced by bt_gatt_client_get_mtu(), bt_gatt_client_read_multiple(), bt_gatt_client_write_long_value(), exchange_mtu_cb(), prepare_write_cb(), and read_long_cb().
int bt_att_get_security | ( | struct bt_att * | att | ) |
Definition at line 1448 of file att.c.
References BT_SECURITY, bt_att::fd, bt_att::io_on_l2cap, bt_att::io_sec_level, bt_security::level, and SOL_BLUETOOTH.
Referenced by bt_gatt_client_get_security(), bt_gatt_client_write_without_response(), and change_security().
bool bt_att_has_crypto | ( | struct bt_att * | att | ) |
Definition at line 1524 of file att.c.
References bt_att::crypto.
struct bt_att* bt_att_new | ( | int | fd, |
bool | ext_signed | ||
) |
Definition at line 991 of file att.c.
References BT_ATT_DEFAULT_LE_MTU, bt_att_free(), bt_att_ref(), bt_crypto_new(), BT_SECURITY_LOW, bt_att::buf, can_read_data(), bt_att::crypto, bt_att::disconn_list, disconnect_cb(), bt_att::ext_signed, bt_att::fd, bt_att::ind_queue, bt_att::io, io_new(), bt_att::io_on_l2cap, bt_att::io_sec_level, io_set_disconnect_handler(), io_set_read_handler(), is_io_l2cap_based(), bt_att::mtu, new0, bt_att::notify_list, queue_new(), bt_att::req_queue, and bt_att::write_queue.
Referenced by client_create().
Definition at line 1055 of file att.c.
References bt_att::ref_count.
Referenced by bt_att_new(), bt_gatt_client_new(), can_read_data(), disconnect_cb(), and handle_notify().
unsigned int bt_att_register | ( | struct bt_att * | att, |
uint8_t | opcode, | ||
bt_att_notify_func_t | callback, | ||
void * | user_data, | ||
bt_att_destroy_func_t | destroy | ||
) |
Definition at line 1389 of file att.c.
References att_notify::callback, att_notify::destroy, att_notify::id, bt_att::io, new0, bt_att::next_reg_id, bt_att::notify_list, opcode, att_notify::opcode, queue_push_tail(), and att_notify::user_data.
Referenced by bt_gatt_client_new().
unsigned int bt_att_register_disconnect | ( | struct bt_att * | att, |
bt_att_disconnect_func_t | callback, | ||
void * | user_data, | ||
bt_att_destroy_func_t | destroy | ||
) |
Definition at line 1158 of file att.c.
References att_disconn::callback, att_disconn::destroy, bt_att::disconn_list, att_disconn::id, bt_att::io, new0, bt_att::next_reg_id, queue_push_tail(), and att_disconn::user_data.
Referenced by bt_gatt_client_new(), and client_create().
unsigned int bt_att_send | ( | struct bt_att * | att, |
uint8_t | opcode, | ||
const void * | pdu, | ||
uint16_t | length, | ||
bt_att_response_func_t | callback, | ||
void * | user_data, | ||
bt_att_destroy_func_t | destroy | ||
) |
encode & send an att message If (op-code type == ATT_OP_TYPE_REQ) process the response with callback function see att_opcode_type_table (att.c) for opcode type definition
att | structure of the communication channel |
opcode | att message op-code |
pdu | protocol data unit buffer |
length | size of pdu |
callback | callback function depending on opcode to process response |
user_data | request data when relevant |
destroy | function to manage user_data |
Definition at line 1220 of file att.c.
References ATT_OP_TYPE_CMD, ATT_OP_TYPE_CONF, ATT_OP_TYPE_IND, ATT_OP_TYPE_NOT, ATT_OP_TYPE_REQ, ATT_OP_TYPE_RSP, ATT_OP_TYPE_UNKNOWN, create_att_send_op(), att_send_op::id, bt_att::ind_queue, bt_att::io, bt_att::next_send_id, att_send_op::pdu, queue_push_tail(), bt_att::req_queue, att_send_op::type, wakeup_writer(), and bt_att::write_queue.
Referenced by bt_att_send_error_rsp(), bt_gatt_client_prepare_write(), bt_gatt_client_read_long_value(), bt_gatt_client_read_multiple(), bt_gatt_client_read_value(), bt_gatt_client_write_execute(), bt_gatt_client_write_long_value(), bt_gatt_client_write_value(), bt_gatt_client_write_without_response(), bt_gatt_discover_characteristics(), bt_gatt_discover_descriptors(), bt_gatt_discover_included_services(), bt_gatt_exchange_mtu(), bt_gatt_read_by_type(), cancel_long_write_req(), cancel_prep_write_session(), complete_write_long_op(), discover_chrcs_cb(), discover_descs_cb(), discover_included_cb(), discover_services(), find_by_type_val_cb(), handle_next_prep_write(), notify_cb(), notify_data_write_ccc(), read_by_grp_type_cb(), read_by_type_cb(), read_included(), read_included_cb(), read_long_cb(), and respond_not_supported().
unsigned int bt_att_send_error_rsp | ( | struct bt_att * | att, |
uint8_t | opcode, | ||
uint16_t | handle, | ||
int | error | ||
) |
Definition at line 1368 of file att.c.
References att_ecode_from_error(), BT_ATT_OP_ERROR_RSP, bt_att_send(), bt_att_pdu_error_rsp::ecode, bt_att_pdu_error_rsp::handle, bt_att_pdu_error_rsp::opcode, opcode, and put_le16().
bool bt_att_set_close_on_unref | ( | struct bt_att * | att, |
bool | do_close | ||
) |
Definition at line 1079 of file att.c.
References bt_att::io, and io_set_close_on_destroy().
Referenced by client_create().
bool bt_att_set_debug | ( | struct bt_att * | att, |
bt_att_debug_func_t | callback, | ||
void * | user_data, | ||
bt_att_destroy_func_t | destroy | ||
) |
Definition at line 1095 of file att.c.
References bt_att::debug_callback, bt_att::debug_data, and bt_att::debug_destroy.
Referenced by client_create().
bool bt_att_set_local_key | ( | struct bt_att * | att, |
uint8_t | sign_key[16], | ||
bt_att_counter_func_t | func, | ||
void * | user_data | ||
) |
Definition at line 1506 of file att.c.
References bt_att::local_sign, and sign_set_key().
Referenced by cmd_set_sign_key().
bool bt_att_set_mtu | ( | struct bt_att * | att, |
uint16_t | mtu | ||
) |
Definition at line 1119 of file att.c.
References BT_ATT_DEFAULT_LE_MTU, bt_att::buf, and bt_att::mtu.
Referenced by mtu_cb().
bool bt_att_set_remote_key | ( | struct bt_att * | att, |
uint8_t | sign_key[16], | ||
bt_att_counter_func_t | func, | ||
void * | user_data | ||
) |
Definition at line 1515 of file att.c.
References bt_att::remote_sign, and sign_set_key().
bool bt_att_set_security | ( | struct bt_att * | att, |
int | level | ||
) |
Definition at line 1467 of file att.c.
References BT_ATT_SECURITY_AUTO, BT_ATT_SECURITY_HIGH, BT_SECURITY, bt_att::fd, bt_att::io_on_l2cap, bt_att::io_sec_level, bt_security::level, and SOL_BLUETOOTH.
Referenced by bt_gatt_client_set_security(), and change_security().
bool bt_att_set_timeout_cb | ( | struct bt_att * | att, |
bt_att_timeout_func_t | callback, | ||
void * | user_data, | ||
bt_att_destroy_func_t | destroy | ||
) |
Definition at line 1141 of file att.c.
References bt_att::timeout_callback, bt_att::timeout_data, and bt_att::timeout_destroy.
void bt_att_unref | ( | struct bt_att * | att | ) |
Definition at line 1065 of file att.c.
References bt_att_cancel_all(), bt_att_free(), bt_att_unregister_all(), and bt_att::ref_count.
Referenced by att_disconnect_cb(), bt_gatt_client_free(), can_read_data(), client_create(), client_destroy(), disconnect_cb(), and handle_notify().
bool bt_att_unregister | ( | struct bt_att * | att, |
unsigned int | id | ||
) |
Definition at line 1421 of file att.c.
References destroy_att_notify(), match_notify_id(), bt_att::notify_list, queue_remove_if(), and UINT_TO_PTR.
Referenced by bt_gatt_client_free().
bool bt_att_unregister_all | ( | struct bt_att * | att | ) |
Definition at line 1437 of file att.c.
References destroy_att_disconn(), destroy_att_notify(), bt_att::disconn_list, bt_att::notify_list, and queue_remove_all().
Referenced by bt_att_unref(), and disconnect_cb().
bool bt_att_unregister_disconnect | ( | struct bt_att * | att, |
unsigned int | id | ||
) |
Definition at line 1189 of file att.c.
References destroy_att_disconn(), bt_att::disconn_list, match_disconn_id(), queue_remove_if(), and UINT_TO_PTR.
Referenced by bt_gatt_client_free().