ble_gatt_client
|
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | bt_gatt_iter |
Typedefs | |
typedef void(* | bt_gatt_destroy_func_t )(void *user_data) |
typedef void(* | bt_gatt_result_callback_t )(bool success, uint8_t att_ecode, void *user_data) |
typedef void(* | bt_gatt_request_callback_t )(bool success, uint8_t att_ecode, struct bt_gatt_result *result, void *user_data) |
Functions | |
unsigned int | bt_gatt_result_service_count (struct bt_gatt_result *result) |
unsigned int | bt_gatt_result_characteristic_count (struct bt_gatt_result *result) |
unsigned int | bt_gatt_result_descriptor_count (struct bt_gatt_result *result) |
unsigned int | bt_gatt_result_included_count (struct bt_gatt_result *result) |
bool | bt_gatt_iter_init (struct bt_gatt_iter *iter, struct bt_gatt_result *result) |
bool | bt_gatt_iter_next_service (struct bt_gatt_iter *iter, uint16_t *start_handle, uint16_t *end_handle, uint8_t uuid[16]) |
bool | bt_gatt_iter_next_characteristic (struct bt_gatt_iter *iter, uint16_t *start_handle, uint16_t *end_handle, uint16_t *value_handle, uint8_t *properties, uint8_t uuid[16]) |
bool | bt_gatt_iter_next_descriptor (struct bt_gatt_iter *iter, uint16_t *handle, uint8_t uuid[16]) |
bool | bt_gatt_iter_next_included_service (struct bt_gatt_iter *iter, uint16_t *handle, uint16_t *start_handle, uint16_t *end_handle, uint8_t uuid[16]) |
bool | bt_gatt_iter_next_read_by_type (struct bt_gatt_iter *iter, uint16_t *handle, uint16_t *length, const uint8_t **value) |
struct bt_gatt_request * | bt_gatt_request_ref (struct bt_gatt_request *req) |
void | bt_gatt_request_unref (struct bt_gatt_request *req) |
void | bt_gatt_request_cancel (struct bt_gatt_request *req) |
unsigned int | bt_gatt_exchange_mtu (struct bt_att *att, uint16_t client_rx_mtu, bt_gatt_result_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
struct bt_gatt_request * | bt_gatt_discover_all_primary_services (struct bt_att *att, bt_uuid_t *uuid, bt_gatt_request_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
struct bt_gatt_request * | bt_gatt_discover_primary_services (struct bt_att *att, bt_uuid_t *uuid, uint16_t start, uint16_t end, bt_gatt_request_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
struct bt_gatt_request * | bt_gatt_discover_secondary_services (struct bt_att *att, bt_uuid_t *uuid, uint16_t start, uint16_t end, bt_gatt_request_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
struct bt_gatt_request * | bt_gatt_discover_included_services (struct bt_att *att, uint16_t start, uint16_t end, bt_gatt_request_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
struct bt_gatt_request * | bt_gatt_discover_characteristics (struct bt_att *att, uint16_t start, uint16_t end, bt_gatt_request_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
struct bt_gatt_request * | bt_gatt_discover_descriptors (struct bt_att *att, uint16_t start, uint16_t end, bt_gatt_request_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
bool | bt_gatt_read_by_type (struct bt_att *att, uint16_t start, uint16_t end, const bt_uuid_t *uuid, bt_gatt_request_callback_t callback, void *user_data, bt_gatt_destroy_func_t destroy) |
typedef void(* bt_gatt_destroy_func_t)(void *user_data) |
Definition at line 60 of file gatt-helpers.h.
typedef void(* bt_gatt_request_callback_t)(bool success, uint8_t att_ecode, struct bt_gatt_result *result, void *user_data) |
Definition at line 64 of file gatt-helpers.h.
typedef void(* bt_gatt_result_callback_t)(bool success, uint8_t att_ecode, void *user_data) |
Definition at line 62 of file gatt-helpers.h.
struct bt_gatt_request* bt_gatt_discover_all_primary_services | ( | struct bt_att * | att, |
bt_uuid_t * | uuid, | ||
bt_gatt_request_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Definition at line 925 of file gatt-helpers.c.
References bt_gatt_discover_primary_services().
Referenced by exchange_mtu_cb().
struct bt_gatt_request* bt_gatt_discover_characteristics | ( | struct bt_att * | att, |
uint16_t | start, | ||
uint16_t | end, | ||
bt_gatt_request_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Definition at line 1311 of file gatt-helpers.c.
References async_req_unref(), bt_gatt_request::att, BT_ATT_OP_READ_BY_TYPE_REQ, bt_att_send(), bt_gatt_request_ref(), bt_gatt_request::callback, bt_gatt_request::destroy, discover_chrcs_cb(), bt_gatt_request::end_handle, GATT_CHARAC_UUID, bt_gatt_request::id, new0, put_le16(), bt_gatt_request::start_handle, and bt_gatt_request::user_data.
Referenced by discover_chrcs_cb(), discover_descs_cb(), and discover_incl_cb().
struct bt_gatt_request* bt_gatt_discover_descriptors | ( | struct bt_att * | att, |
uint16_t | start, | ||
uint16_t | end, | ||
bt_gatt_request_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Definition at line 1544 of file gatt-helpers.c.
References async_req_unref(), bt_gatt_request::att, BT_ATT_OP_FIND_INFO_REQ, bt_att_send(), bt_gatt_request_ref(), bt_gatt_request::callback, bt_gatt_request::destroy, discover_descs_cb(), bt_gatt_request::end_handle, bt_gatt_request::id, new0, put_le16(), bt_gatt_request::start_handle, and bt_gatt_request::user_data.
Referenced by discover_descs().
struct bt_gatt_request* bt_gatt_discover_included_services | ( | struct bt_att * | att, |
uint16_t | start, | ||
uint16_t | end, | ||
bt_gatt_request_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Definition at line 1194 of file gatt-helpers.c.
References async_req_unref(), bt_gatt_request::att, BT_ATT_OP_READ_BY_TYPE_REQ, bt_att_send(), bt_gatt_request_ref(), bt_gatt_request::callback, bt_gatt_request::destroy, discover_included_cb(), bt_gatt_request::end_handle, GATT_INCLUDE_UUID, bt_gatt_request::id, new0, put_le16(), bt_gatt_request::start_handle, and bt_gatt_request::user_data.
Referenced by discover_incl_cb(), and discover_secondary_cb().
struct bt_gatt_request* bt_gatt_discover_primary_services | ( | struct bt_att * | att, |
bt_uuid_t * | uuid, | ||
uint16_t | start, | ||
uint16_t | end, | ||
bt_gatt_request_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Definition at line 936 of file gatt-helpers.c.
References discover_services().
Referenced by bt_gatt_discover_all_primary_services(), and process_service_changed().
struct bt_gatt_request* bt_gatt_discover_secondary_services | ( | struct bt_att * | att, |
bt_uuid_t * | uuid, | ||
uint16_t | start, | ||
uint16_t | end, | ||
bt_gatt_request_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Definition at line 947 of file gatt-helpers.c.
References discover_services().
Referenced by discover_primary_cb().
unsigned int bt_gatt_exchange_mtu | ( | struct bt_att * | att, |
uint16_t | client_rx_mtu, | ||
bt_gatt_result_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Exchange MTU trigger
att | pointer to bt_att data structure |
client_rx_mtu | mtu client size |
callback | user callback to call from mtu_cb (set in mtu_op internal data structure) |
user_data | pointer for user, set in the mtu_op internal data structure |
destroy | housekeeping data management function set in the mtu_op internal data structure |
Definition at line 582 of file gatt-helpers.c.
References mtu_op::att, BT_ATT_OP_MTU_REQ, bt_att_send(), mtu_op::callback, mtu_op::client_rx_mtu, mtu_op::destroy, destroy_mtu_op(), mtu_cb(), new0, put_le16(), and mtu_op::user_data.
Referenced by gatt_client_init().
bool bt_gatt_iter_init | ( | struct bt_gatt_iter * | iter, |
struct bt_gatt_result * | result | ||
) |
Definition at line 188 of file gatt-helpers.c.
References bt_gatt_iter::pos, and bt_gatt_iter::result.
Referenced by discover_chrcs_cb(), discover_descs_cb(), discover_incl_cb(), discover_primary_cb(), and discover_secondary_cb().
bool bt_gatt_iter_next_characteristic | ( | struct bt_gatt_iter * | iter, |
uint16_t * | start_handle, | ||
uint16_t * | end_handle, | ||
uint16_t * | value_handle, | ||
uint8_t * | properties, | ||
uint8_t | uuid[16] | ||
) |
Definition at line 378 of file gatt-helpers.c.
References BT_ATT_OP_READ_BY_TYPE_RSP, convert_uuid_le(), bt_gatt_result::data_len, bt_gatt_request::end_handle, get_le16(), bt_gatt_result::next, bt_gatt_result::op, bt_gatt_result::opcode, bt_gatt_result::pdu, bt_gatt_result::pdu_len, bt_gatt_iter::pos, bt_gatt_iter::result, bt_uuid_t::type, and bt_gatt_request::uuid.
Referenced by discover_chrcs_cb().
bool bt_gatt_iter_next_descriptor | ( | struct bt_gatt_iter * | iter, |
uint16_t * | handle, | ||
uint8_t | uuid[16] | ||
) |
Definition at line 430 of file gatt-helpers.c.
References BT_ATT_OP_FIND_INFO_RSP, convert_uuid_le(), bt_gatt_result::data_len, get_le16(), bt_gatt_result::next, bt_gatt_result::opcode, bt_gatt_result::pdu, bt_gatt_result::pdu_len, bt_gatt_iter::pos, and bt_gatt_iter::result.
Referenced by discover_descs_cb().
bool bt_gatt_iter_next_included_service | ( | struct bt_gatt_iter * | iter, |
uint16_t * | handle, | ||
uint16_t * | start_handle, | ||
uint16_t * | end_handle, | ||
uint8_t | uuid[16] | ||
) |
Definition at line 257 of file gatt-helpers.c.
References BT_ATT_OP_READ_BY_TYPE_RSP, convert_uuid_le(), bt_gatt_result::data_len, get_le16(), bt_gatt_result::next, bt_gatt_result::op, bt_gatt_result::opcode, bt_gatt_result::pdu, bt_gatt_result::pdu_len, bt_gatt_iter::pos, bt_gatt_iter::result, bt_uuid_t::type, and bt_gatt_request::uuid.
Referenced by discover_incl_cb().
bool bt_gatt_iter_next_read_by_type | ( | struct bt_gatt_iter * | iter, |
uint16_t * | handle, | ||
uint16_t * | length, | ||
const uint8_t ** | value | ||
) |
Definition at line 455 of file gatt-helpers.c.
References BT_ATT_OP_READ_BY_TYPE_RSP, bt_gatt_result::data_len, get_le16(), bt_gatt_result::next, bt_gatt_result::op, bt_gatt_result::opcode, bt_gatt_result::pdu, bt_gatt_result::pdu_len, bt_gatt_iter::pos, bt_gatt_iter::result, bt_uuid_t::type, and bt_gatt_request::uuid.
bool bt_gatt_iter_next_service | ( | struct bt_gatt_iter * | iter, |
uint16_t * | start_handle, | ||
uint16_t * | end_handle, | ||
uint8_t | uuid[16] | ||
) |
Definition at line 337 of file gatt-helpers.c.
References BT_ATT_OP_FIND_BY_TYPE_VAL_RSP, BT_ATT_OP_READ_BY_GRP_TYPE_RSP, bt_uuid_to_uuid128(), convert_uuid_le(), uint128_t::data, bt_gatt_result::data_len, get_le16(), bt_gatt_result::next, bt_gatt_result::op, bt_gatt_result::opcode, bt_gatt_result::pdu, bt_gatt_result::pdu_len, bt_gatt_iter::pos, bt_gatt_iter::result, bt_uuid_t::u128, bt_gatt_request::uuid, and bt_uuid_t::value.
Referenced by discover_primary_cb(), and discover_secondary_cb().
bool bt_gatt_read_by_type | ( | struct bt_att * | att, |
uint16_t | start, | ||
uint16_t | end, | ||
const bt_uuid_t * | uuid, | ||
bt_gatt_request_callback_t | callback, | ||
void * | user_data, | ||
bt_gatt_destroy_func_t | destroy | ||
) |
Definition at line 1421 of file gatt-helpers.c.
References async_req_unref(), bt_gatt_request::att, BT_ATT_OP_READ_BY_TYPE_REQ, bt_att_send(), bt_gatt_request_ref(), bt_uuid_to_le(), bt_gatt_request::callback, bt_gatt_request::destroy, bt_gatt_request::end_handle, get_uuid_len(), bt_gatt_request::id, new0, put_le16(), read_by_type_cb(), bt_gatt_request::start_handle, bt_uuid_t::type, bt_gatt_request::user_data, and bt_gatt_request::uuid.
void bt_gatt_request_cancel | ( | struct bt_gatt_request * | req | ) |
Definition at line 650 of file gatt-helpers.c.
References bt_gatt_request::att, bt_att_cancel(), and bt_gatt_request::id.
Referenced by bt_gatt_client_cancel_all(), and bt_gatt_request_unref().
struct bt_gatt_request* bt_gatt_request_ref | ( | struct bt_gatt_request * | req | ) |
Definition at line 622 of file gatt-helpers.c.
References bt_gatt_request::ref_count.
Referenced by bt_gatt_discover_characteristics(), bt_gatt_discover_descriptors(), bt_gatt_discover_included_services(), bt_gatt_read_by_type(), discover_chrcs_cb(), discover_descs_cb(), discover_included_cb(), discover_services(), find_by_type_val_cb(), new_read_included(), read_by_grp_type_cb(), read_by_type_cb(), and read_included_cb().
void bt_gatt_request_unref | ( | struct bt_gatt_request * | req | ) |
Definition at line 632 of file gatt-helpers.c.
References bt_gatt_request_cancel(), bt_gatt_request::destroy, bt_gatt_request::ref_count, result_destroy(), bt_gatt_request::result_head, and bt_gatt_request::user_data.
Referenced by async_req_unref(), bt_gatt_client_cancel_all(), and discovery_req_clear().
unsigned int bt_gatt_result_characteristic_count | ( | struct bt_gatt_result * | result | ) |
Definition at line 128 of file gatt-helpers.c.
References BT_ATT_OP_READ_BY_TYPE_RSP, bt_gatt_result::data_len, bt_gatt_result::opcode, and result_element_count().
Referenced by discover_chrcs_cb().
unsigned int bt_gatt_result_descriptor_count | ( | struct bt_gatt_result * | result | ) |
Definition at line 149 of file gatt-helpers.c.
References BT_ATT_OP_FIND_INFO_RSP, bt_gatt_result::opcode, and result_element_count().
Referenced by discover_descs_cb().
unsigned int bt_gatt_result_included_count | ( | struct bt_gatt_result * | result | ) |
Definition at line 160 of file gatt-helpers.c.
References BT_ATT_OP_READ_BY_TYPE_RSP, bt_gatt_result::data_len, bt_gatt_result::next, bt_gatt_result::opcode, and bt_gatt_result::pdu_len.
Referenced by discover_incl_cb().
unsigned int bt_gatt_result_service_count | ( | struct bt_gatt_result * | result | ) |
Definition at line 116 of file gatt-helpers.c.
References BT_ATT_OP_FIND_BY_TYPE_VAL_RSP, BT_ATT_OP_READ_BY_GRP_TYPE_RSP, bt_gatt_result::opcode, and result_element_count().
Referenced by discover_primary_cb(), and discover_secondary_cb().