nRF51 SDK - S310 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Generic Attribute Profile (GATT) Client

Definitions and prototypes for the GATT Client interface. More...

Modules

 Message Sequence Charts
 
 Defines
 

Data Structures

struct  ble_gattc_handle_range_t
 Operation Handle Range. More...
 
struct  ble_gattc_service_t
 GATT service. More...
 
struct  ble_gattc_include_t
 GATT include. More...
 
struct  ble_gattc_char_t
 GATT characteristic. More...
 
struct  ble_gattc_desc_t
 GATT descriptor. More...
 
struct  ble_gattc_write_params_t
 Write Parameters. More...
 
struct  ble_gattc_evt_prim_srvc_disc_rsp_t
 Event structure for BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. More...
 
struct  ble_gattc_evt_rel_disc_rsp_t
 Event structure for BLE_GATTC_EVT_REL_DISC_RSP. More...
 
struct  ble_gattc_evt_char_disc_rsp_t
 Event structure for BLE_GATTC_EVT_CHAR_DISC_RSP. More...
 
struct  ble_gattc_evt_desc_disc_rsp_t
 Event structure for BLE_GATTC_EVT_DESC_DISC_RSP. More...
 
struct  ble_gattc_handle_value_t
 GATT read by UUID handle value pair. More...
 
struct  ble_gattc_evt_char_val_by_uuid_read_rsp_t
 Event structure for BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. More...
 
struct  ble_gattc_evt_read_rsp_t
 Event structure for BLE_GATTC_EVT_READ_RSP. More...
 
struct  ble_gattc_evt_char_vals_read_rsp_t
 Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP. More...
 
struct  ble_gattc_evt_write_rsp_t
 Event structure for BLE_GATTC_EVT_WRITE_RSP. More...
 
struct  ble_gattc_evt_hvx_t
 Event structure for BLE_GATTC_EVT_HVX. More...
 
struct  ble_gattc_evt_timeout_t
 Event structure for BLE_GATTC_EVT_TIMEOUT. More...
 
struct  ble_gattc_evt_t
 GATTC event type. More...
 

Enumerations

enum  BLE_GATTC_SVCS {
  SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = 0x90,
  SD_BLE_GATTC_RELATIONSHIPS_DISCOVER,
  SD_BLE_GATTC_CHARACTERISTICS_DISCOVER,
  SD_BLE_GATTC_DESCRIPTORS_DISCOVER,
  SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ,
  SD_BLE_GATTC_READ,
  SD_BLE_GATTC_CHAR_VALUES_READ,
  SD_BLE_GATTC_WRITE,
  SD_BLE_GATTC_HV_CONFIRM
}
 GATTC API SVC numbers. More...
 
enum  BLE_GATTC_EVTS {
  BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = 0x30,
  BLE_GATTC_EVT_REL_DISC_RSP,
  BLE_GATTC_EVT_CHAR_DISC_RSP,
  BLE_GATTC_EVT_DESC_DISC_RSP,
  BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP,
  BLE_GATTC_EVT_READ_RSP,
  BLE_GATTC_EVT_CHAR_VALS_READ_RSP,
  BLE_GATTC_EVT_WRITE_RSP,
  BLE_GATTC_EVT_HVX,
  BLE_GATTC_EVT_TIMEOUT
}
 GATT Client Event IDs. More...
 

Functions

uint32_t sd_ble_gattc_primary_services_discover (uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *const p_srvc_uuid)
 Initiate or continue a GATT Primary Service Discovery procedure. More...
 
uint32_t sd_ble_gattc_relationships_discover (uint16_t conn_handle, ble_gattc_handle_range_t const *const p_handle_range)
 Initiate or continue a GATT Relationship Discovery procedure. More...
 
uint32_t sd_ble_gattc_characteristics_discover (uint16_t conn_handle, ble_gattc_handle_range_t const *const p_handle_range)
 Initiate or continue a GATT Characteristic Discovery procedure. More...
 
uint32_t sd_ble_gattc_descriptors_discover (uint16_t conn_handle, ble_gattc_handle_range_t const *const p_handle_range)
 Initiate or continue a GATT Characteristic Descriptor Discovery procedure. More...
 
uint32_t sd_ble_gattc_char_value_by_uuid_read (uint16_t conn_handle, ble_uuid_t const *const p_uuid, ble_gattc_handle_range_t const *const p_handle_range)
 Initiate or continue a GATT Read using Characteristic UUID procedure. More...
 
uint32_t sd_ble_gattc_read (uint16_t conn_handle, uint16_t handle, uint16_t offset)
 Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure. More...
 
uint32_t sd_ble_gattc_char_values_read (uint16_t conn_handle, uint16_t const *const p_handles, uint16_t handle_count)
 Initiate a GATT Read Multiple Characteristic Values procedure. More...
 
uint32_t sd_ble_gattc_write (uint16_t conn_handle, ble_gattc_write_params_t const *const p_write_params)
 Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure. More...
 
uint32_t sd_ble_gattc_hv_confirm (uint16_t conn_handle, uint16_t handle)
 Send a Handle Value Confirmation to the GATT Server. More...
 

Detailed Description

Definitions and prototypes for the GATT Client interface.

Enumeration Type Documentation

GATT Client Event IDs.

Enumerator
BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP 

Primary Service Discovery Response event.

BLE_GATTC_EVT_REL_DISC_RSP 

Relationship Discovery Response event.

BLE_GATTC_EVT_CHAR_DISC_RSP 

Characteristic Discovery Response event.

BLE_GATTC_EVT_DESC_DISC_RSP 

Descriptor Discovery Response event.

BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP 

Read By UUID Response event.

BLE_GATTC_EVT_READ_RSP 

Read Response event.

BLE_GATTC_EVT_CHAR_VALS_READ_RSP 

Read multiple Response event.

BLE_GATTC_EVT_WRITE_RSP 

Write Response event.

BLE_GATTC_EVT_HVX 

Handle Value Notification or Indication event.

BLE_GATTC_EVT_TIMEOUT 

Timeout event.

GATTC API SVC numbers.

Enumerator
SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER 

Primary Service Discovery.

SD_BLE_GATTC_RELATIONSHIPS_DISCOVER 

Relationship Discovery.

SD_BLE_GATTC_CHARACTERISTICS_DISCOVER 

Characteristic Discovery.

SD_BLE_GATTC_DESCRIPTORS_DISCOVER 

Characteristic Descriptor Discovery.

SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ 

Read Characteristic Value by UUID.

SD_BLE_GATTC_READ 

Generic read.

SD_BLE_GATTC_CHAR_VALUES_READ 

Read multiple Characteristic Values.

SD_BLE_GATTC_WRITE 

Generic write.

SD_BLE_GATTC_HV_CONFIRM 

Handle Value Confirmation.

Function Documentation

uint32_t sd_ble_gattc_char_value_by_uuid_read ( uint16_t  conn_handle,
ble_uuid_t const *const  p_uuid,
ble_gattc_handle_range_t const *const  p_handle_range 
)

Initiate or continue a GATT Read using Characteristic UUID procedure.

This function initiates the Read using Characteristic UUID procedure. If the last Characteristic has not been reached, this must be called again with an updated handle range to continue the discovery.

Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]p_uuidPointer to a Characteristic value UUID to read.
[in]p_handle_rangeA pointer to the range of handles to perform this procedure on.
Returns
NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_BUSY Client procedure already in progress.
uint32_t sd_ble_gattc_char_values_read ( uint16_t  conn_handle,
uint16_t const *const  p_handles,
uint16_t  handle_count 
)

Initiate a GATT Read Multiple Characteristic Values procedure.

This function initiates a GATT Read Multiple Characteristic Values procedure.

Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]p_handlesA pointer to the handle(s) of the attribute(s) to be read.
[in]handle_countThe number of handles in p_handles.
Returns
NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_BUSY Client procedure already in progress.
uint32_t sd_ble_gattc_characteristics_discover ( uint16_t  conn_handle,
ble_gattc_handle_range_t const *const  p_handle_range 
)

Initiate or continue a GATT Characteristic Discovery procedure.

This function initiates a Characteristic discovery procedure. If the last Characteristic has not been reached, this must be called again with an updated handle range to continue the discovery.

Note
If any of the discovered characteristics have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with type BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]p_handle_rangeA pointer to the range of handles of the Service to perform this procedure on.
Returns
NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_BUSY Client procedure already in progress.
uint32_t sd_ble_gattc_descriptors_discover ( uint16_t  conn_handle,
ble_gattc_handle_range_t const *const  p_handle_range 
)

Initiate or continue a GATT Characteristic Descriptor Discovery procedure.

This function initiates the Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached, this must be called again with an updated handle range to continue the discovery.

Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]p_handle_rangeA pointer to the range of handles of the Characteristic to perform this procedure on.
Returns
NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_BUSY Client procedure already in progress.
uint32_t sd_ble_gattc_hv_confirm ( uint16_t  conn_handle,
uint16_t  handle 
)

Send a Handle Value Confirmation to the GATT Server.

Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]handleThe handle of the attribute in the indication.
Returns
NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_STATE No Indication pending to be confirmed.
BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle.
BLE_ERROR_NO_TX_BUFFERS There are no available buffers left.
uint32_t sd_ble_gattc_primary_services_discover ( uint16_t  conn_handle,
uint16_t  start_handle,
ble_uuid_t const *const  p_srvc_uuid 
)

Initiate or continue a GATT Primary Service Discovery procedure.

This function initiates a Primary Service discovery, starting from the supplied handle. If the last service has not been reached, this must be called again with an updated start handle value to continue the search.

Note
If any of the discovered services have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with type BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]start_handleHandle to start searching from.
[in]p_srvc_uuidPointer to the service UUID to be found. If it is NULL, all primary services will be returned.
Returns
NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
NRF_ERROR_BUSY Client procedure already in progress.
uint32_t sd_ble_gattc_read ( uint16_t  conn_handle,
uint16_t  handle,
uint16_t  offset 
)

Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure.

This function initiates a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor to be read is longer than GATT_MTU - 1, this function must be called multiple times with appropriate offset to read the complete value.

Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]handleThe handle of the attribute to be read.
[in]offsetOffset into the attribute value to be read.
Returns
NRF_SUCCESS Successfully started or resumed the Read (Long) procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_BUSY Client procedure already in progress.
uint32_t sd_ble_gattc_relationships_discover ( uint16_t  conn_handle,
ble_gattc_handle_range_t const *const  p_handle_range 
)

Initiate or continue a GATT Relationship Discovery procedure.

This function initiates the Find Included Services sub-procedure. If the last included service has not been reached, this must be called again with an updated handle range to continue the search.

Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]p_handle_rangeA pointer to the range of handles of the Service to perform this procedure on.
Returns
NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
NRF_ERROR_BUSY Client procedure already in progress.
uint32_t sd_ble_gattc_write ( uint16_t  conn_handle,
ble_gattc_write_params_t const *const  p_write_params 
)

Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure.

This function can perform all write procedures described in GATT.

Note
It is important to note that a write without response will consume an application buffer, and will therefore generate a BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write on the other hand will use the standard client internal buffer and thus will only generate a BLE_GATTC_EVT_WRITE_RSP event as soon as the write response has been received from the peer. Please see the documentation of sd_ble_tx_buffer_count_get for more details.
Parameters
[in]conn_handleThe connection handle identifying the connection to perform this procedure on.
[in]p_write_paramsA pointer to a write parameters structure.
Returns
NRF_SUCCESS Successfully started the Write procedure.
BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
NRF_ERROR_BUSY Procedure already in progress.
BLE_ERROR_NO_TX_BUFFERS There are no available buffers left.