aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c')
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.c276
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.h229
2 files changed, 505 insertions, 0 deletions
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.c
new file mode 100644
index 0000000..8450ad6
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.c
@@ -0,0 +1,276 @@
+/**
+ * Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "sdk_common.h"
+#if NRF_MODULE_ENABLED(NRF_BLE_GATTS_C)
+
+#include "nrf_ble_gatts_c.h"
+#include <string.h>
+#include "ble.h"
+
+#define NRF_LOG_MODULE_NAME nrf_ble_gatts_c
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+
+#define GATTS_LOG NRF_LOG_DEBUG /**< A debug logger macro that can be used in this file to perform logging over UART. */
+#define MODULE_INITIALIZED (p_gatts_c->initialized) /**< Macro indicating whether the module has been initialized properly. */
+
+static const ble_uuid_t m_gatts_uuid = {BLE_UUID_GATT, BLE_UUID_TYPE_BLE}; /**< Service Changed indication UUID. */
+
+
+/**@brief Function for handling the indication and notifications from the GATT Service Server.
+
+ @param[in] p_gatts_c Pointer to Service Changed client structure.
+ @param[in] p_ble_gattc_evt Pointer to a gattc event.
+*/
+static void on_hvx(nrf_ble_gatts_c_t const * const p_gatts_c,
+ ble_gattc_evt_t const * const p_ble_gattc_evt)
+{
+ uint16_t srv_changed_handle = p_gatts_c->srv_changed_char.characteristic.handle_value;
+
+ if ((p_ble_gattc_evt->params.hvx.handle == srv_changed_handle)
+ && (p_gatts_c->evt_handler != NULL))
+ {
+ ret_code_t err_code = sd_ble_gattc_hv_confirm(p_ble_gattc_evt->conn_handle,
+ srv_changed_handle);
+
+ if ((err_code != NRF_SUCCESS) && (p_gatts_c->err_handler != NULL))
+ {
+ p_gatts_c->err_handler(err_code);
+ }
+
+ nrf_ble_gatts_c_evt_t evt;
+ nrf_ble_gatts_c_evt_handler_t evt_handler = p_gatts_c->evt_handler;
+
+ /*lint --e{415} --e{416} -save suppress Warning 415: Likely access of out-of-bounds pointer */
+ evt.params.handle_range.start_handle = uint16_decode(p_ble_gattc_evt->params.hvx.data);
+ evt.params.handle_range.end_handle = uint16_decode(p_ble_gattc_evt->params.hvx.data + sizeof(uint16_t));
+ /*lint -restore*/
+
+ evt.evt_type = NRF_BLE_GATTS_C_EVT_SRV_CHANGED;
+ evt.conn_handle = p_ble_gattc_evt->conn_handle;
+
+ GATTS_LOG ("Service Changed Indication.\n\r");
+ evt_handler(&evt);
+
+ }
+}
+
+
+ret_code_t nrf_ble_gatts_c_init(nrf_ble_gatts_c_t * p_gatts_c,
+ nrf_ble_gatts_c_init_t * p_gatts_c_init)
+{
+ ret_code_t err_code = NRF_SUCCESS;
+ VERIFY_PARAM_NOT_NULL(p_gatts_c);
+ VERIFY_PARAM_NOT_NULL(p_gatts_c_init);
+ VERIFY_PARAM_NOT_NULL(p_gatts_c_init->evt_handler);
+ memset (p_gatts_c, 0, sizeof(nrf_ble_gatts_c_t));
+
+ p_gatts_c->conn_handle = BLE_CONN_HANDLE_INVALID;
+ p_gatts_c->evt_handler = p_gatts_c_init->evt_handler;
+
+ err_code = ble_db_discovery_evt_register(&m_gatts_uuid);
+ VERIFY_SUCCESS(err_code);
+
+ p_gatts_c->initialized = true;
+ return err_code;
+}
+
+
+/**@brief Function for checking whether the peer's GATT Service instance and the Service Changed
+ Characteristic have been discovered.
+
+ @param[in] p_gatts_c Pointer to the GATT Service client structure instance.
+
+ @return True if the Service Changed Characteristic handle is valid.
+ @return False if the Service Changed Characteristic handle is invalid.
+ */
+static bool gatts_gatt_handles_are_valid(nrf_ble_gatts_c_t const * const p_gatts_c)
+{
+ return (p_gatts_c->srv_changed_char.characteristic.handle_value != BLE_GATT_HANDLE_INVALID);
+}
+
+
+ret_code_t nrf_ble_gatts_c_enable_indication(nrf_ble_gatts_c_t * const p_gatts_c,
+ bool const enable)
+{
+ VERIFY_MODULE_INITIALIZED();
+
+ if ( (p_gatts_c->conn_handle == BLE_CONN_HANDLE_INVALID)
+ || !(gatts_gatt_handles_are_valid(p_gatts_c)))
+ {
+ return NRF_ERROR_INVALID_STATE;
+ }
+
+ ret_code_t err_code = NRF_SUCCESS;
+ uint16_t cccd_val = (enable) ? BLE_GATT_HVX_INDICATION : 0;
+
+ ble_gattc_write_params_t gattc_params =
+ {
+ .handle = p_gatts_c->srv_changed_char.cccd_handle,
+ .len = BLE_CCCD_VALUE_LEN,
+ .p_value = (uint8_t *)&cccd_val,
+ .offset = 0,
+ .write_op = BLE_GATT_OP_WRITE_REQ,
+ };
+
+ err_code = sd_ble_gattc_write(p_gatts_c->conn_handle, &gattc_params);
+ return err_code;
+}
+
+
+void nrf_ble_gatts_c_on_db_disc_evt(nrf_ble_gatts_c_t const * const p_gatts_c,
+ ble_db_discovery_evt_t * const p_evt)
+{
+ VERIFY_MODULE_INITIALIZED_VOID();
+
+ nrf_ble_gatts_c_evt_t evt;
+ ble_gatt_db_char_t * p_chars;
+
+ p_chars = p_evt->params.discovered_db.charateristics;
+ evt.evt_type = NRF_BLE_GATTS_C_EVT_DISCOVERY_FAILED;
+
+ if ( (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE)
+ && (p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_GATT)
+ && (p_evt->params.discovered_db.srv_uuid.type == BLE_UUID_TYPE_BLE))
+ {
+ // Find the handles of the Service Changed Characteristics.
+ for (uint32_t i = 0; i < p_evt->params.discovered_db.char_count; i++)
+ {
+ if ( (p_chars[i].characteristic.uuid.uuid == BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED)
+ && (p_chars[i].characteristic.char_props.indicate != 0))
+ {
+ memcpy(&evt.params.srv_changed_char,
+ &p_chars[i],
+ sizeof(ble_gatt_db_char_t));
+
+ evt.evt_type = NRF_BLE_GATTS_C_EVT_DISCOVERY_COMPLETE;
+ GATTS_LOG("Service Changed Characteristic found.\n\r");
+ break;
+ }
+ }
+ }
+
+ if (p_gatts_c->evt_handler != NULL)
+ {
+ nrf_ble_gatts_c_evt_handler_t evt_handler = p_gatts_c->evt_handler;
+ evt.conn_handle = p_evt->conn_handle;
+ evt_handler(&evt);
+ }
+}
+
+
+/**@brief Function for handling the Disconnect event.
+
+ @param[in] p_cts Pointer to the GATT Service client structure instance.
+ @param[in] p_ble_evt Event received from the BLE stack.
+ */
+static void on_disconnect(nrf_ble_gatts_c_t * p_gatts_c, ble_evt_t const * p_ble_evt)
+{
+ if (p_gatts_c->conn_handle == p_ble_evt->evt.gap_evt.conn_handle)
+ {
+ p_gatts_c->conn_handle = BLE_CONN_HANDLE_INVALID;
+
+ if (gatts_gatt_handles_are_valid(p_gatts_c))
+ {
+ // There was a valid instance of GATTS on the peer. Send an event to the
+ // application, so that it can do any clean up related to this module.
+ nrf_ble_gatts_c_evt_t evt;
+
+ evt.evt_type = NRF_BLE_GATTS_C_EVT_DISCONN_COMPLETE;
+
+ p_gatts_c->evt_handler(&evt);
+ p_gatts_c->srv_changed_char.characteristic.handle_value = BLE_GATT_HANDLE_INVALID;
+ p_gatts_c->srv_changed_char.cccd_handle = BLE_GATT_HANDLE_INVALID;
+ p_gatts_c->srv_changed_char.ext_prop_handle = BLE_GATT_HANDLE_INVALID;
+ p_gatts_c->srv_changed_char.report_ref_handle = BLE_GATT_HANDLE_INVALID;
+ p_gatts_c->srv_changed_char.user_desc_handle = BLE_GATT_HANDLE_INVALID;
+ }
+ }
+}
+
+
+void nrf_ble_gatts_c_on_ble_evt(ble_evt_t const * p_ble_evt,
+ void * p_context)
+{
+ nrf_ble_gatts_c_t * p_gatts_c;
+ p_gatts_c = p_context;
+
+ VERIFY_MODULE_INITIALIZED_VOID();
+ VERIFY_PARAM_NOT_NULL_VOID(p_gatts_c);
+ VERIFY_PARAM_NOT_NULL_VOID(p_ble_evt);
+
+ switch (p_ble_evt->header.evt_id)
+ {
+ case BLE_GAP_EVT_DISCONNECTED:
+ on_disconnect(p_gatts_c, p_ble_evt);
+ break;
+
+ case BLE_GATTC_EVT_HVX:
+ on_hvx(p_gatts_c, &(p_ble_evt->evt.gattc_evt));
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+ret_code_t nrf_ble_gatts_c_handles_assign(nrf_ble_gatts_c_t * const p_gatts_c,
+ uint16_t const conn_handle,
+ ble_gatt_db_char_t const * const p_peer_handles)
+{
+ VERIFY_PARAM_NOT_NULL(p_gatts_c);
+ VERIFY_MODULE_INITIALIZED();
+
+ p_gatts_c->conn_handle = conn_handle;
+ if (p_peer_handles != NULL)
+ {
+ p_gatts_c->srv_changed_char.cccd_handle = p_peer_handles->cccd_handle;
+ p_gatts_c->srv_changed_char.ext_prop_handle = p_peer_handles->ext_prop_handle;
+ p_gatts_c->srv_changed_char.report_ref_handle = p_peer_handles->report_ref_handle;
+ p_gatts_c->srv_changed_char.user_desc_handle = p_peer_handles->user_desc_handle;
+ p_gatts_c->srv_changed_char.characteristic.handle_value = p_peer_handles->characteristic.handle_value;
+
+ }
+ return NRF_SUCCESS;
+}
+#endif // NRF_MODULE_ENABLED(BLE_GATTS_C)
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.h
new file mode 100644
index 0000000..fb488f0
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/ble/ble_services/experimental_gatts_c/nrf_ble_gatts_c.h
@@ -0,0 +1,229 @@
+/**
+ * Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, must reproduce the above copyright notice, this list of
+ * conditions and the following disclaimer in the documentation and/or other
+ * materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/** @file
+ *
+ * @defgroup nrf_ble_gatts_c GATT Service Client
+ * @{
+ * @ingroup ble_sdk_srv
+ * @brief GATT Service Client module.
+ *
+ * @details This module implements a client for the Generic Attribute Profile (GATT) Service.
+ * It subscribes to indications from the Service Changed Characteristic (0x2A05).
+ *
+ * @note The application must register this module as a BLE event observer using the
+ * NRF_SDH_BLE_OBSERVER macro. Example:
+ * @code
+ * ble_gatts_t instance;
+ * NRF_SDH_BLE_OBSERVER(anything, BLE_GATTS_BLE_OBSERVER_PRIO,
+ * nrf_ble_gatts_c_on_ble_evt, &instance);
+ * @endcode
+*/
+
+
+#ifndef NRF_BLE_GATTS_C_H__
+#define NRF_BLE_GATTS_C_H__
+
+#include <stdint.h>
+#include "ble_gattc.h"
+#include "ble.h"
+#include "nrf_error.h"
+#include "ble_srv_common.h"
+#include "ble_db_discovery.h"
+#include "sdk_errors.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Macro for defining a nrf_ble_gatts_c instance.
+ *
+ * @param _name Name of the instance.
+ * @hideinitializer
+ */
+#define NRF_BLE_GATTS_C_DEF(_name) \
+static nrf_ble_gatts_c_t _name; \
+NRF_SDH_BLE_OBSERVER(_name ## _obs, \
+ NRF_BLE_GATTS_C_BLE_OBSERVER_PRIO, \
+ nrf_ble_gatts_c_on_ble_evt, &_name)
+
+/** @brief Macro for defining multiple nrf_ble_gatts_c instances.
+ *
+ * @param _name Name of the array of instances.
+ * @param _cnt Number of instances to define.
+ * @hideinitializer
+ */
+#define NRF_BLE_GATTS_C_ARRAY_DEF(_name, _cnt) \
+static nrf_ble_gatts_c_t _name[_cnt]; \
+NRF_SDH_BLE_OBSERVERS(_name ## _obs, \
+ NRF_BLE_GATTS_C_BLE_OBSERVER_PRIO, \
+ nrf_ble_gatts_c_on_ble_evt, &_name, _cnt)
+
+/**@brief Type of the GATT Service client event. */
+typedef enum
+{
+ NRF_BLE_GATTS_C_EVT_DISCOVERY_COMPLETE, /**< Event indicating that the GATT Service and Service Changed Characteristic have been found on the peer. */
+ NRF_BLE_GATTS_C_EVT_DISCOVERY_FAILED, /**< Event indicating that the Service Changed characteristic has not been found on the peer. */
+ NRF_BLE_GATTS_C_EVT_DISCONN_COMPLETE, /**< Event indicating that the GATT Service client module has finished processing the BLE_GAP_EVT_DISCONNECTED event. The event can be used by the application to do cleanup related to the GATT Service client.*/
+ NRF_BLE_GATTS_C_EVT_SRV_CHANGED, /**< Event indicating that a Service Changed indication has been received. */
+} nrf_ble_gatts_c_evt_type_t;
+
+/**@brief Structure containing the event from the Service Changed client module to the application.
+ */
+typedef struct
+{
+ nrf_ble_gatts_c_evt_type_t evt_type; /**< Type of event. See @ref nrf_ble_gatts_c_evt_type_t. */
+ uint16_t conn_handle; /**< Handle of the connection for which this event has occurred. */
+ union
+ {
+ ble_gatt_db_char_t srv_changed_char; /**< Handles for the Service Changed characteristic. Will be filled if the event type is @ref NRF_BLE_GATTS_C_EVT_DISCOVERY_COMPLETE. */
+ ble_gattc_handle_range_t handle_range; /**< The affected attribute handle range where the service has changed. Will be provided if the event type is @ref NRF_BLE_GATTS_C_EVT_SRV_CHANGED.*/
+ } params;
+} nrf_ble_gatts_c_evt_t;
+
+/**@brief Service Changed handler type. */
+typedef void (* nrf_ble_gatts_c_evt_handler_t)(nrf_ble_gatts_c_evt_t * p_evt);
+
+/**@brief Structure for holding the information related to the Service Changed indication at the server.
+ *
+ * @details A GATT Server will never have more than one instance of the Service Changed Characteristic.
+ * Therefore, you never need more than one instance of the GATT Service client structure.
+ *
+ * @warning This structure must be zero-initialized.
+ */
+typedef struct
+{
+ bool initialized; /**< Boolean indicating whether the context has been initialized or not. */
+ bool char_found; /**< Boolean indicating whether the Service Changed indication has been found.*/
+ ble_gatt_db_char_t srv_changed_char; /**< Information of the Service Changed characteristics. */
+ uint16_t conn_handle; /**< Active connection handle. */
+ nrf_ble_gatts_c_evt_handler_t evt_handler; /**< Pointer to event handler function. */
+ ble_srv_error_handler_t err_handler; /**< Pointer to error handler function. */
+} nrf_ble_gatts_c_t;
+
+/**@brief Initialization parameters. These must be supplied when calling @ref nrf_ble_gatts_c_init. */
+typedef struct
+{
+ nrf_ble_gatts_c_evt_handler_t evt_handler; /**< Event handler that is called by the Service Changed client module when any related event occurs. */
+ ble_srv_error_handler_t err_handler; /**< Error handler that is called by the Service Changed client module if any error occurs. */
+} nrf_ble_gatts_c_init_t;
+
+
+/**@brief Function for initializing the Service Changed client module.
+ *
+ * @param[in,out] p_gatts_c Pointer to the GATT Service client structure instance.
+ * @param[in] p_gatts_c_init Init parameters containing the event handler that is called by
+ * the Service Changed client module when any related event occurs.
+ *
+ * @retval NRF_SUCCESS If the service was initialized successfully.
+ * @retval NRF_ERROR_NULL If any of the input parameters are NULL.
+ * @return If functions from other modules return errors to this function,
+ * the @ref nrf_error are propagated.
+ */
+ret_code_t nrf_ble_gatts_c_init(nrf_ble_gatts_c_t * p_gatts_c,
+ nrf_ble_gatts_c_init_t * p_gatts_c_init);
+
+
+/**@brief Function for enabling remote indication.
+ *
+ * @param[in,out] p_gatts_c Pointer to the Service Changed client structure.
+ * @param[in] enable True to enable Service Changed remote indication, false to disable.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ * @return If functions from other modules return errors to this function,
+ * the @ref nrf_error are propagated.
+ */
+ret_code_t nrf_ble_gatts_c_enable_indication(nrf_ble_gatts_c_t * p_gatts_c,
+ bool enable);
+
+
+/**@brief Function for handling events from the database discovery module.
+ *
+ * @details This function handles an event from the database discovery module, and determine
+ * if it relates to the discovery of Service Changed characteristics at the peer. If so,
+ * it will call the application's event handler indicating that Service Changed
+ * characteristic has been discovered at the peer.
+ *
+ * @param[in,out] p_gatts_c Pointer to the GATT Service client structure instance.
+ * @param[in] p_evt Pointer to the event received from the database discovery module.
+ */
+void nrf_ble_gatts_c_on_db_disc_evt(nrf_ble_gatts_c_t const * p_gatts_c,
+ ble_db_discovery_evt_t * p_evt);
+
+
+/**@brief Function for handling BLE events.
+ *
+ * @param[in] p_ble_evt Event received from the BLE stack.
+ * @param[in] p_context Context.
+ */
+void nrf_ble_gatts_c_on_ble_evt(ble_evt_t const * p_ble_evt,
+ void * p_context);
+
+
+/**@brief Function for assigning handles to a GATT Service client instance.
+ *
+ * @details Call this function when a link has been established with a peer to
+ * associate this link to an instance of the module. This makes it
+ * possible to handle several links and associate each link with a particular
+ * instance of the GATT Service client module. The connection handle and attribute
+ * handles will be provided from the discovery event
+ * @ref NRF_BLE_GATTS_C_EVT_DISCOVERY_COMPLETE.
+ *
+ * @param[in,out] p_gatts_c Pointer to the GATT Service client structure instance to
+ * associate with the handles.
+ * @param[in] conn_handle Connection handle to be associated with the given
+ * GATT Service client Instance.
+ * @param[in] p_peer_handles Attribute handles on the GATT Service server that you want this
+ * GATT Service client to interact with.
+ *
+ * @retval NRF_SUCCESS If the connection handle was successfully stored in the GATT Service instance.
+ * @retval NRF_ERROR_NULL If any of the input parameters are NULL.
+ */
+ret_code_t nrf_ble_gatts_c_handles_assign(nrf_ble_gatts_c_t * p_gatts_c,
+ uint16_t conn_handle,
+ ble_gatt_db_char_t const * p_peer_handles);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // NRF_BLE_GATTS_C_H__
+
+/** @} */