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

Parameters
  • conn_id[in] : GATT connection handle

  • mtu[in] : New MTU size

Returns

wiced_bt_gatt_status_t

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.

Parameters
  • conn_id[in] : GATT connection handle

  • discovery_type[in] : Discover type

  • p_discovery_param[in] : Discover parameter

Returns

wiced_bt_gatt_status_t

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

Parameters
  • conn_id[in] : Connection id

  • handle[in] : Attribute handle to read

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

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

  • len[in] : Length of the p_read_buf

  • auth_req[in] : Authentication requirements

Returns

wiced_bt_gatt_status_t

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

Parameters
  • conn_id[in] : Connection id

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

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

  • p_uuid[in] : 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.

  • len[in] : Length of the p_read_buf

  • auth_req[in] : Authentication requirements

Returns

wiced_bt_gatt_status_t

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

Parameters
  • conn_id[in] : 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

  • p_app_ctxt[in] : context of the p_app_write_buffer

  • auth_req[in] : Authentication requirements

Returns

wiced_bt_gatt_status_t

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.

Parameters
  • conn_id[in] : Connection handle

  • opcode[in] : Can be GATT_REQ_WRITE, GATT_CMD_WRITE, GATT_REQ_PREPARE_WRITE

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

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

  • p_app_ctxt[in] : context of the p_app_write_buffer

Returns

wiced_bt_gatt_status_t

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.

Parameters
  • conn_id[in] : Connection handle

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

Returns

wiced_bt_gatt_status_t

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

Parameters
  • conn_id[in] : Connection handle

  • handle[in] : Attribute handle

Returns

wiced_bt_gatt_status_t