Module for negotiating and keeping track of GATT connection parameters and updating the data length.
More...
Module for negotiating and keeping track of GATT connection parameters and updating the data length.
#define NRF_BLE_GATT_DEF |
( |
|
_name | ) |
|
Macro for defining a nrf_ble_gatt instance.
- Parameters
-
_name | Name of the instance. |
GATT module event handler type.
The GATT module calls a function of this type when a parameter value is changed.
GATT module event types.
Enumerator |
---|
NRF_BLE_GATT_EVT_ATT_MTU_UPDATED |
The ATT_MTU size was updated.
|
NRF_BLE_GATT_EVT_DATA_LENGTH_UPDATED |
The data length was updated.
|
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
-
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
-
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_gatt or p_data_length is NULL. |
NRF_ERROR_INVALID_PARAM | If conn_handle is larger than NRF_BLE_GATT_LINK_COUNT. |
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_gatt is NULL or if conn_handle is larger than the supported maximum number of connections. |
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_gatt is 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. |