Client API

group gatt_client_api_functions

GATT Profile Client Functions.

Functions

wiced_bt_gatt_status_t wiced_bt_gatt_client_configure_mtu(uint16_t conn_id, uint16_t mtu)

Configure the ATT MTU size for a connection on an LE transport.

note

Allowed mtu range is 23 upto wiced_bt_cfg_ble_t::ble_max_rx_pdu_size for BLE links as configured in wiced_bt_cfg_settings_t

Return

wiced_bt_gatt_status_t

Parameters
  • [in] conn_id: : GATT connection handle

  • [in] mtu: : New MTU size

wiced_bt_gatt_status_t wiced_bt_gatt_client_send_discover(uint16_t conn_id, wiced_bt_gatt_discovery_type_t discovery_type, wiced_bt_gatt_discovery_param_t *p_discovery_param)

Start an attribute discovery on an ATT server.

Discovery results are notified using GATT_DISCOVERY_RESULT_EVT ; completion is notified using GATT_DISCOVERY_CPLT_EVT of wiced_bt_gatt_cback_t.

Return

wiced_bt_gatt_status_t

Parameters
  • [in] conn_id: : GATT connection handle

  • [in] discovery_type: : Discover type

  • [in] p_discovery_param: : Discover parameter

wiced_bt_gatt_status_t wiced_bt_gatt_client_send_read_handle(uint16_t conn_id, uint16_t handle, uint16_t offset, uint8_t *p_read_buf, uint16_t len, wiced_bt_gatt_auth_req_t auth_req)

Read from remote ATT server.

Result is notified using GATT_OPERATION_CPLT_EVT of wiced_bt_gatt_cback_t, with wiced_bt_gatt_operation_complete_t::op set to GATTC_OPTYPE_READ_HANDLE

note

: In case the offset is set to 0, the stack first sends a GATT_REQ_READ and then sends out a

series of GATT_REQ_READ_BLOB till the entire attribute is read or until the p_read_buf is filled upto len

Return

wiced_bt_gatt_status_t

Parameters
  • [in] conn_id: : Connection id

  • [in] handle: : Attribute handle to read

  • [in] offset: : Offset to start read from. To read the entire attribute set offset to 0.

Parameters
  • [in/out]: p_read_buf : The buffer to save the read response

  • [in] len: : Length of the p_read_buf

  • [in] auth_req: : Authentication requirements

wiced_bt_gatt_status_t wiced_bt_gatt_client_send_read_by_type(uint16_t conn_id, uint16_t s_handle, uint16_t e_handle, wiced_bt_uuid_t *p_uuid, uint8_t *p_read_buf, uint16_t len, wiced_bt_gatt_auth_req_t auth_req)

Read from remote ATT server.

Result is notified using GATT_OPERATION_CPLT_EVT of wiced_bt_gatt_cback_t, with wiced_bt_gatt_operation_complete_t::op set to GATTC_OPTYPE_READ_BY_TYPE

Return

wiced_bt_gatt_status_t

Parameters
  • [in] conn_id: : Connection id

  • [in] s_handle: : Start handle of the range to search

  • [in] e_handle: : End handle of the range to search

  • [in] p_uuid: : The attribute uuid to match

  • [in/out]: p_read_buf : The buffer to save the read response in case the first response to the type does not fit into the available MTU.

  • [in] len: : Length of the p_read_buf

  • [in] auth_req: : Authentication requirements

wiced_bt_gatt_status_t wiced_bt_gatt_client_send_read_multiple(uint16_t conn_id, wiced_bt_gatt_opcode_t opcode, int num_handles, uint8_t *p_handle_stream, wiced_bt_gatt_app_context_t p_app_ctxt, wiced_bt_gatt_auth_req_t auth_req)

Read multipe from remote ATT server.

Result is notified using GATT_OPERATION_CPLT_EVT of wiced_bt_gatt_cback_t, with wiced_bt_gatt_operation_complete_t::op set to GATTC_OPTYPE_READ_MULTIPLE for opcode = GATT_REQ_READ_MULTI and set to GATTC_OPTYPE_READ_HANDLE for opcode = GATT_REQ_READ_MULTI_VAR_LENGTH and

Return

wiced_bt_gatt_status_t

Parameters
  • [in] conn_id: : Connection id

  • opcode: : Can be set to GATT_REQ_READ_MULTI or GATT_REQ_READ_MULTI_VAR_LENGTH

  • num_handles: : Number of handles pointed to by p_handle_stream

  • p_handle_stream: : The list of 16 bit handles arranged in Little Endian format

  • [in] p_app_ctxt: : context of the p_app_write_buffer

  • [in] auth_req: : Authentication requirements

wiced_bt_gatt_status_t wiced_bt_gatt_client_send_write(uint16_t conn_id, wiced_bt_gatt_opcode_t opcode, wiced_bt_gatt_write_hdr_t *p_hdr, uint8_t *p_app_write_buffer, wiced_bt_gatt_app_context_t p_app_ctxt)

Write to remote ATT server.

Result is notified using GATT_OPERATION_CPLT_EVT of wiced_bt_gatt_cback_t.

note

: When opcode is set to GATT_REQ_WRITE and the length to be written is greater than MTU - 3, then the stack splits the write into a series of GATT_REQ_PREPARE_WRITE and finally sends a GATT_REQ_EXECUTE_WRITE to complete the write.

Return

wiced_bt_gatt_status_t

Parameters
Parameters
  • [in] p_hdr: : Pointer to the write parameters, with application data in p_app_write_buffer

  • [in] p_app_write_buffer: Pointer to the application data buffer to be sent. The len of the buffer is in p_write->len

  • [in] p_app_ctxt: : context of the p_app_write_buffer

wiced_bt_gatt_status_t wiced_bt_gatt_client_send_execute_write(uint16_t conn_id, wiced_bool_t is_execute)

Send Execute Write request to remote ATT server.

Return

wiced_bt_gatt_status_t

Parameters
  • [in] conn_id: : Connection handle

  • [in] is_execute: : WICED_BT_TRUE to execute, WICED_BT_FALSE to cancel

wiced_bt_gatt_status_t wiced_bt_gatt_client_send_indication_confirm(uint16_t conn_id, uint16_t handle)

Send a handle value confirmation to remote ATT server.

in response to GATTC_OPTYPE_INDICATION of wiced_bt_gatt_cback_t

Return

wiced_bt_gatt_status_t

Parameters
  • [in] conn_id: : Connection handle

  • [in] handle: : Attribute handle