ble_gatt_client
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
gatt-helpers.h File Reference
#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_requestbt_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_requestbt_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_requestbt_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_requestbt_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_requestbt_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_requestbt_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_requestbt_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 Documentation

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.

Function Documentation

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_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 
)

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

msc_inline_mscgraph_2
  1. bt_gatt_exchange_mtu is called by a GATT Client with the thereafter Parameters building the mtu_op data structure (gatt_client_init in btgattclient.c case)
  2. bt_att_send is called with BT_ATT_OP_MTU_REQ op code and passing the mtu_op data structure
  3. after receiving the response message mtu_cb is called with the opcode and the mtu_op data structure
  4. mtu_cb call the user callback function (exchange_mtu_cb in the btgattclient.c case)
Parameters
attpointer to bt_att data structure
client_rx_mtumtu client size
callbackuser callback to call from mtu_cb (set in mtu_op internal data structure)
user_datapointer for user, set in the mtu_op internal data structure
destroyhousekeeping data management function set in the mtu_op internal data structure
Returns
sequence number or 0 if error

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 
)
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 
)
void bt_gatt_request_cancel ( struct bt_gatt_request req)
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)
unsigned int bt_gatt_result_service_count ( struct bt_gatt_result result)