Module for negotiating and keeping track of GATT connection parameters and updating the data length. More...
Modules |
|
| GATT module configuration | |
Data Structures |
|
| struct | nrf_ble_gatt_evt_t |
|
GATT module event.
More...
|
|
| struct | nrf_ble_gatt_link_t |
|
GATT information for each connection.
More...
|
|
| struct | nrf_ble_gatt_s |
|
GATT structure that contains status information for the GATT module.
More...
|
|
Macros |
|
| #define | NRF_BLE_GATT_DEF (_name) |
|
Macro for defining a nrf_ble_gatt instance.
More...
|
|
| #define | NRF_BLE_GATT_LINK_COUNT ( NRF_SDH_BLE_PERIPHERAL_LINK_COUNT + NRF_SDH_BLE_CENTRAL_LINK_COUNT ) |
|
The maximum number of peripheral and central connections combined. This value is based on what is configured in the SoftDevice handler sdk_config.
|
|
Typedefs |
|
| typedef struct nrf_ble_gatt_s | nrf_ble_gatt_t |
| typedef void(* | nrf_ble_gatt_evt_handler_t )( nrf_ble_gatt_t *p_gatt, nrf_ble_gatt_evt_t const *p_evt) |
|
GATT module event handler type.
More...
|
|
Enumerations |
|
| enum |
nrf_ble_gatt_evt_id_t
{
NRF_BLE_GATT_EVT_ATT_MTU_UPDATED = 0xA77, NRF_BLE_GATT_EVT_DATA_LENGTH_UPDATED = 0xDA7A } |
|
GATT module event types.
More...
|
|
Functions |
|
| ret_code_t | nrf_ble_gatt_init ( nrf_ble_gatt_t *p_gatt, nrf_ble_gatt_evt_handler_t evt_handler) |
|
Function for initializing the GATT module.
More...
|
|
| ret_code_t | nrf_ble_gatt_att_mtu_periph_set ( nrf_ble_gatt_t *p_gatt, uint16_t desired_mtu) |
|
Function for setting the ATT_MTU size for the next connection that is established as peripheral.
More...
|
|
| ret_code_t | nrf_ble_gatt_att_mtu_central_set ( nrf_ble_gatt_t *p_gatt, uint16_t desired_mtu) |
|
Function for setting the ATT_MTU size for the next connection that is established as central.
More...
|
|
| ret_code_t | nrf_ble_gatt_data_length_set ( nrf_ble_gatt_t *p_gatt, uint16_t conn_handle, uint8_t data_length) |
|
Function for setting the data length for a connection.
More...
|
|
| ret_code_t | nrf_ble_gatt_data_length_get ( nrf_ble_gatt_t const *p_gatt, uint16_t conn_handle, uint8_t *p_data_length) |
|
Function for retrieving the data length of a connection.
More...
|
|
| void | nrf_ble_gatt_on_ble_evt ( ble_evt_t const *p_ble_evt, void *p_context) |
|
Function for handling BLE stack events.
More...
|
|
| uint16_t | nrf_ble_gatt_eff_mtu_get ( nrf_ble_gatt_t const *p_gatt, uint16_t conn_handle) |
|
Function for getting the current ATT_MTU size for a given connection.
More...
|
|
Detailed Description
Module for negotiating and keeping track of GATT connection parameters and updating the data length.
Macro Definition Documentation
| #define NRF_BLE_GATT_DEF | ( | _name | ) |
Macro for defining a nrf_ble_gatt instance.
- Parameters
-
_name Name of the instance.
Typedef Documentation
| typedef void(* nrf_ble_gatt_evt_handler_t)( nrf_ble_gatt_t *p_gatt, nrf_ble_gatt_evt_t const *p_evt) |
GATT module event handler type.
The GATT module calls a function of this type when a parameter value is changed.
Enumeration Type Documentation
Function Documentation
| ret_code_t nrf_ble_gatt_att_mtu_central_set | ( | nrf_ble_gatt_t * | p_gatt , |
| uint16_t | desired_mtu | ||
| ) |
Function for setting the ATT_MTU size for the next connection that is established as central.
- Parameters
-
[in,out] p_gatt Pointer to the GATT structure. [in] desired_mtu Requested ATT_MTU size.
- Return values
-
NRF_SUCCESS If the operation was successful. NRF_ERROR_NULL If p_gattis NULL.NRF_ERROR_INVALID_PARAM If the size of desired_mtuis bigger than NRF_SDH_BLE_GATT_MAX_MTU_SIZE or smaller than BLE_GATT_ATT_MTU_DEFAULT .
| ret_code_t nrf_ble_gatt_att_mtu_periph_set | ( | nrf_ble_gatt_t * | p_gatt , |
| uint16_t | desired_mtu | ||
| ) |
Function for setting the ATT_MTU size for the next connection that is established as peripheral.
- Parameters
-
[in] p_gatt Pointer to the GATT structure. [in] desired_mtu Requested ATT_MTU size.
- Return values
-
NRF_SUCCESS If the operation was successful. NRF_ERROR_NULL If p_gattis NULL.NRF_ERROR_INVALID_PARAM If the size of desired_mtuis bigger than NRF_SDH_BLE_GATT_MAX_MTU_SIZE or smaller than BLE_GATT_ATT_MTU_DEFAULT .
| ret_code_t nrf_ble_gatt_data_length_get | ( | nrf_ble_gatt_t const * | p_gatt , |
| uint16_t | conn_handle , | ||
| uint8_t * | p_data_length | ||
| ) |
Function for retrieving the data length of a connection.
If
conn_handle
is
BLE_CONN_HANDLE_INVALID
, the function retrieves the data length that will be requested for the next connection. If
conn_handle
is a handle to an existing connection, the function retrieves the effective data length that was negotiated for that connection.
- Parameters
-
[in,out] p_gatt Pointer to the GATT structure. [in] conn_handle The connection for which to retrieve the data length, or BLE_CONN_HANDLE_INVALID to retrieve the requested data length for the next connection. [out] p_data_length The connection data length.
- Return values
-
NRF_SUCCESS If the operation was successful. NRF_ERROR_NULL If p_gattorp_data_lengthis NULL.NRF_ERROR_INVALID_PARAM If conn_handleis larger than NRF_BLE_GATT_LINK_COUNT .
| ret_code_t nrf_ble_gatt_data_length_set | ( | nrf_ble_gatt_t * | p_gatt , |
| uint16_t | conn_handle , | ||
| uint8_t | data_length | ||
| ) |
Function for setting the data length for a connection.
If
conn_handle
is a handle to an existing connection, a data length update request is sent on that connection. If
conn_handle
is
BLE_CONN_HANDLE_INVALID
, a data length update request is sent on the next connection that is established after the ATT_MTU exchange has completed. If no ATT_MTU exchange procedure is carried out (for example, if a default ATT_MTU size is used), the data length is not changed.
| uint16_t nrf_ble_gatt_eff_mtu_get | ( | nrf_ble_gatt_t const * | p_gatt , |
| uint16_t | conn_handle | ||
| ) |
Function for getting the current ATT_MTU size for a given connection.
- Parameters
-
[in] p_gatt Pointer to the GATT structure. [in] conn_handle Connection handle of the connection.
- Returns
- ATT_MTU size for the given connection.
- Return values
-
0 If p_gattis NULL or ifconn_handleis larger than the supported maximum number of connections.
| ret_code_t nrf_ble_gatt_init | ( | nrf_ble_gatt_t * | p_gatt , |
| nrf_ble_gatt_evt_handler_t | evt_handler | ||
| ) |
Function for initializing the GATT module.
- Parameters
-
[in] evt_handler Event handler. [out] p_gatt Pointer to the GATT structure.
- Return values
-
NRF_SUCCESS If the operation was successful. NRF_ERROR_NULL If p_gattis NULL.
| void nrf_ble_gatt_on_ble_evt | ( | ble_evt_t const * | p_ble_evt , |
| void * | p_context | ||
| ) |
Function for handling BLE stack events.
This function handles events from the BLE stack that are of interest to the module.
- Parameters
-
[in] p_ble_evt Event received from the BLE stack. [in] p_context Pointer to the GATT structure.