The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
emilmont
Date:
Fri Feb 21 12:21:39 2014 +0000
Revision:
80:8e73be2a2ac1
First alpha release for the NRF51822 target (to be tested in the online IDE)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 80:8e73be2a2ac1 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
emilmont 80:8e73be2a2ac1 2 *
emilmont 80:8e73be2a2ac1 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
emilmont 80:8e73be2a2ac1 4 * copying, transfer or disclosure of such information is prohibited except by express written
emilmont 80:8e73be2a2ac1 5 * agreement with Nordic Semiconductor.
emilmont 80:8e73be2a2ac1 6 *
emilmont 80:8e73be2a2ac1 7 */
emilmont 80:8e73be2a2ac1 8 /**
emilmont 80:8e73be2a2ac1 9 @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client
emilmont 80:8e73be2a2ac1 10 @{
emilmont 80:8e73be2a2ac1 11 @brief Definitions and prototypes for the GATT Client interface.
emilmont 80:8e73be2a2ac1 12 */
emilmont 80:8e73be2a2ac1 13
emilmont 80:8e73be2a2ac1 14 #ifndef BLE_GATTC_H__
emilmont 80:8e73be2a2ac1 15 #define BLE_GATTC_H__
emilmont 80:8e73be2a2ac1 16
emilmont 80:8e73be2a2ac1 17 #include "ble_gatt.h"
emilmont 80:8e73be2a2ac1 18 #include "ble_types.h"
emilmont 80:8e73be2a2ac1 19 #include "ble_ranges.h"
emilmont 80:8e73be2a2ac1 20 #include "nrf_svc.h"
emilmont 80:8e73be2a2ac1 21
emilmont 80:8e73be2a2ac1 22
emilmont 80:8e73be2a2ac1 23 /**@brief GATTC API SVC numbers. */
emilmont 80:8e73be2a2ac1 24 enum BLE_GATTC_SVCS
emilmont 80:8e73be2a2ac1 25 {
emilmont 80:8e73be2a2ac1 26 SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */
emilmont 80:8e73be2a2ac1 27 SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */
emilmont 80:8e73be2a2ac1 28 SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */
emilmont 80:8e73be2a2ac1 29 SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */
emilmont 80:8e73be2a2ac1 30 SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */
emilmont 80:8e73be2a2ac1 31 SD_BLE_GATTC_READ, /**< Generic read. */
emilmont 80:8e73be2a2ac1 32 SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */
emilmont 80:8e73be2a2ac1 33 SD_BLE_GATTC_WRITE, /**< Generic write. */
emilmont 80:8e73be2a2ac1 34 SD_BLE_GATTC_HV_CONFIRM /**< Handle Value Confirmation. */
emilmont 80:8e73be2a2ac1 35 };
emilmont 80:8e73be2a2ac1 36
emilmont 80:8e73be2a2ac1 37 /** @addtogroup BLE_GATTC_DEFINES Defines
emilmont 80:8e73be2a2ac1 38 * @{ */
emilmont 80:8e73be2a2ac1 39
emilmont 80:8e73be2a2ac1 40 /** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC
emilmont 80:8e73be2a2ac1 41 * @{ */
emilmont 80:8e73be2a2ac1 42 #define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000)
emilmont 80:8e73be2a2ac1 43 /** @} */
emilmont 80:8e73be2a2ac1 44
emilmont 80:8e73be2a2ac1 45 /**@brief Last Attribute Handle. */
emilmont 80:8e73be2a2ac1 46 #define BLE_GATTC_HANDLE_END 0xFFFF
emilmont 80:8e73be2a2ac1 47
emilmont 80:8e73be2a2ac1 48 /** @} */
emilmont 80:8e73be2a2ac1 49
emilmont 80:8e73be2a2ac1 50 /**@brief Operation Handle Range. */
emilmont 80:8e73be2a2ac1 51 typedef struct
emilmont 80:8e73be2a2ac1 52 {
emilmont 80:8e73be2a2ac1 53 uint16_t start_handle; /**< Start Handle. */
emilmont 80:8e73be2a2ac1 54 uint16_t end_handle; /**< End Handle. */
emilmont 80:8e73be2a2ac1 55 } ble_gattc_handle_range_t;
emilmont 80:8e73be2a2ac1 56
emilmont 80:8e73be2a2ac1 57
emilmont 80:8e73be2a2ac1 58 /**@brief GATT service. */
emilmont 80:8e73be2a2ac1 59 typedef struct
emilmont 80:8e73be2a2ac1 60 {
emilmont 80:8e73be2a2ac1 61 ble_uuid_t uuid; /**< Service UUID. */
emilmont 80:8e73be2a2ac1 62 ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */
emilmont 80:8e73be2a2ac1 63 } ble_gattc_service_t;
emilmont 80:8e73be2a2ac1 64
emilmont 80:8e73be2a2ac1 65
emilmont 80:8e73be2a2ac1 66 /**@brief GATT include. */
emilmont 80:8e73be2a2ac1 67 typedef struct
emilmont 80:8e73be2a2ac1 68 {
emilmont 80:8e73be2a2ac1 69 uint16_t handle; /**< Include Handle. */
emilmont 80:8e73be2a2ac1 70 ble_gattc_service_t included_srvc; /**< Handle of the included service. */
emilmont 80:8e73be2a2ac1 71 } ble_gattc_include_t;
emilmont 80:8e73be2a2ac1 72
emilmont 80:8e73be2a2ac1 73
emilmont 80:8e73be2a2ac1 74 /**@brief GATT characteristic. */
emilmont 80:8e73be2a2ac1 75 typedef struct
emilmont 80:8e73be2a2ac1 76 {
emilmont 80:8e73be2a2ac1 77 ble_uuid_t uuid; /**< Characteristic UUID. */
emilmont 80:8e73be2a2ac1 78 ble_gatt_char_props_t char_props; /**< Characteristic Properties. */
emilmont 80:8e73be2a2ac1 79 uint8_t char_ext_props : 1; /**< Extended properties present. */
emilmont 80:8e73be2a2ac1 80 uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */
emilmont 80:8e73be2a2ac1 81 uint16_t handle_value; /**< Handle of the Characteristic Value. */
emilmont 80:8e73be2a2ac1 82 } ble_gattc_char_t;
emilmont 80:8e73be2a2ac1 83
emilmont 80:8e73be2a2ac1 84
emilmont 80:8e73be2a2ac1 85 /**@brief GATT descriptor. */
emilmont 80:8e73be2a2ac1 86 typedef struct
emilmont 80:8e73be2a2ac1 87 {
emilmont 80:8e73be2a2ac1 88 uint16_t handle; /**< Descriptor Handle. */
emilmont 80:8e73be2a2ac1 89 ble_uuid_t uuid; /**< Descriptor UUID. */
emilmont 80:8e73be2a2ac1 90 } ble_gattc_desc_t;
emilmont 80:8e73be2a2ac1 91
emilmont 80:8e73be2a2ac1 92
emilmont 80:8e73be2a2ac1 93 /**@brief Write Parameters. */
emilmont 80:8e73be2a2ac1 94 typedef struct
emilmont 80:8e73be2a2ac1 95 {
emilmont 80:8e73be2a2ac1 96 uint8_t write_op; /**< Write Operation to be performed, see BLE_GATT_WRITE_OPS. */
emilmont 80:8e73be2a2ac1 97 uint16_t handle; /**< Handle to the attribute to be written. */
emilmont 80:8e73be2a2ac1 98 uint16_t offset; /**< Offset in bytes. */
emilmont 80:8e73be2a2ac1 99 uint16_t len; /**< Length of data in bytes. */
emilmont 80:8e73be2a2ac1 100 uint8_t* p_value; /**< Pointer to the value data. */
emilmont 80:8e73be2a2ac1 101 uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */
emilmont 80:8e73be2a2ac1 102 } ble_gattc_write_params_t;
emilmont 80:8e73be2a2ac1 103
emilmont 80:8e73be2a2ac1 104
emilmont 80:8e73be2a2ac1 105 /**
emilmont 80:8e73be2a2ac1 106 * @brief GATT Client Event IDs.
emilmont 80:8e73be2a2ac1 107 */
emilmont 80:8e73be2a2ac1 108 enum BLE_GATTC_EVTS
emilmont 80:8e73be2a2ac1 109 {
emilmont 80:8e73be2a2ac1 110 BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. */
emilmont 80:8e73be2a2ac1 111 BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. */
emilmont 80:8e73be2a2ac1 112 BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. */
emilmont 80:8e73be2a2ac1 113 BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. */
emilmont 80:8e73be2a2ac1 114 BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. */
emilmont 80:8e73be2a2ac1 115 BLE_GATTC_EVT_READ_RSP, /**< Read Response event. */
emilmont 80:8e73be2a2ac1 116 BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. */
emilmont 80:8e73be2a2ac1 117 BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. */
emilmont 80:8e73be2a2ac1 118 BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. */
emilmont 80:8e73be2a2ac1 119 BLE_GATTC_EVT_TIMEOUT /**< Timeout event. */
emilmont 80:8e73be2a2ac1 120 };
emilmont 80:8e73be2a2ac1 121
emilmont 80:8e73be2a2ac1 122 /**@brief Event structure for BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */
emilmont 80:8e73be2a2ac1 123 typedef struct
emilmont 80:8e73be2a2ac1 124 {
emilmont 80:8e73be2a2ac1 125 uint16_t count; /**< Service count. */
emilmont 80:8e73be2a2ac1 126 ble_gattc_service_t services[1]; /**< Service data, variable length. */
emilmont 80:8e73be2a2ac1 127 } ble_gattc_evt_prim_srvc_disc_rsp_t;
emilmont 80:8e73be2a2ac1 128
emilmont 80:8e73be2a2ac1 129 /**@brief Event structure for BLE_GATTC_EVT_REL_DISC_RSP. */
emilmont 80:8e73be2a2ac1 130 typedef struct
emilmont 80:8e73be2a2ac1 131 {
emilmont 80:8e73be2a2ac1 132 uint16_t count; /**< Include count. */
emilmont 80:8e73be2a2ac1 133 ble_gattc_include_t includes[1]; /**< Include data, variable length. */
emilmont 80:8e73be2a2ac1 134 } ble_gattc_evt_rel_disc_rsp_t;
emilmont 80:8e73be2a2ac1 135
emilmont 80:8e73be2a2ac1 136 /**@brief Event structure for BLE_GATTC_EVT_CHAR_DISC_RSP. */
emilmont 80:8e73be2a2ac1 137 typedef struct
emilmont 80:8e73be2a2ac1 138 {
emilmont 80:8e73be2a2ac1 139 uint16_t count; /**< Characteristic count. */
emilmont 80:8e73be2a2ac1 140 ble_gattc_char_t chars[1]; /**< Characteristic data, variable length. */
emilmont 80:8e73be2a2ac1 141 } ble_gattc_evt_char_disc_rsp_t;
emilmont 80:8e73be2a2ac1 142
emilmont 80:8e73be2a2ac1 143 /**@brief Event structure for BLE_GATTC_EVT_DESC_DISC_RSP. */
emilmont 80:8e73be2a2ac1 144 typedef struct
emilmont 80:8e73be2a2ac1 145 {
emilmont 80:8e73be2a2ac1 146 uint16_t count; /**< Descriptor count. */
emilmont 80:8e73be2a2ac1 147 ble_gattc_desc_t descs[1]; /**< Descriptor data, variable length. */
emilmont 80:8e73be2a2ac1 148 } ble_gattc_evt_desc_disc_rsp_t;
emilmont 80:8e73be2a2ac1 149
emilmont 80:8e73be2a2ac1 150 /**@brief GATT read by UUID handle value pair. */
emilmont 80:8e73be2a2ac1 151 typedef struct
emilmont 80:8e73be2a2ac1 152 {
emilmont 80:8e73be2a2ac1 153 uint16_t handle; /**< Attribute Handle. */
emilmont 80:8e73be2a2ac1 154 uint8_t *p_value; /**< Pointer to value, variable length (length available as value_len in ble_gattc_evt_read_by_uuid_rsp_t).
emilmont 80:8e73be2a2ac1 155 Please note that this pointer is absolute to the memory provided by the user when retrieving the event,
emilmont 80:8e73be2a2ac1 156 so it will effectively point to a location inside the handle_value array. */
emilmont 80:8e73be2a2ac1 157 } ble_gattc_handle_value_t;
emilmont 80:8e73be2a2ac1 158
emilmont 80:8e73be2a2ac1 159 /**@brief Event structure for BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */
emilmont 80:8e73be2a2ac1 160 typedef struct
emilmont 80:8e73be2a2ac1 161 {
emilmont 80:8e73be2a2ac1 162 uint16_t count; /**< Handle-Value Pair Count. */
emilmont 80:8e73be2a2ac1 163 uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */
emilmont 80:8e73be2a2ac1 164 ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list, variable length. */
emilmont 80:8e73be2a2ac1 165 } ble_gattc_evt_char_val_by_uuid_read_rsp_t;
emilmont 80:8e73be2a2ac1 166
emilmont 80:8e73be2a2ac1 167 /**@brief Event structure for BLE_GATTC_EVT_READ_RSP. */
emilmont 80:8e73be2a2ac1 168 typedef struct
emilmont 80:8e73be2a2ac1 169 {
emilmont 80:8e73be2a2ac1 170 uint16_t handle; /**< Attribute Handle. */
emilmont 80:8e73be2a2ac1 171 uint16_t offset; /**< Offset of the attribute data. */
emilmont 80:8e73be2a2ac1 172 uint16_t len; /**< Attribute data length. */
emilmont 80:8e73be2a2ac1 173 uint8_t data[1]; /**< Attribute data, variable length. */
emilmont 80:8e73be2a2ac1 174 } ble_gattc_evt_read_rsp_t;
emilmont 80:8e73be2a2ac1 175
emilmont 80:8e73be2a2ac1 176 /**@brief Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */
emilmont 80:8e73be2a2ac1 177 typedef struct
emilmont 80:8e73be2a2ac1 178 {
emilmont 80:8e73be2a2ac1 179 uint16_t len; /**< Concatenated Attribute values length. */
emilmont 80:8e73be2a2ac1 180 uint8_t values[1]; /**< Attribute values, variable length. */
emilmont 80:8e73be2a2ac1 181 } ble_gattc_evt_char_vals_read_rsp_t;
emilmont 80:8e73be2a2ac1 182
emilmont 80:8e73be2a2ac1 183 /**@brief Event structure for BLE_GATTC_EVT_WRITE_RSP. */
emilmont 80:8e73be2a2ac1 184 typedef struct
emilmont 80:8e73be2a2ac1 185 {
emilmont 80:8e73be2a2ac1 186 uint16_t handle; /**< Attribute Handle. */
emilmont 80:8e73be2a2ac1 187 uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */
emilmont 80:8e73be2a2ac1 188 uint16_t offset; /**< Data Offset. */
emilmont 80:8e73be2a2ac1 189 uint16_t len; /**< Data length. */
emilmont 80:8e73be2a2ac1 190 uint8_t data[1]; /**< Data, variable length. */
emilmont 80:8e73be2a2ac1 191 } ble_gattc_evt_write_rsp_t;
emilmont 80:8e73be2a2ac1 192
emilmont 80:8e73be2a2ac1 193 /**@brief Event structure for BLE_GATTC_EVT_HVX. */
emilmont 80:8e73be2a2ac1 194 typedef struct
emilmont 80:8e73be2a2ac1 195 {
emilmont 80:8e73be2a2ac1 196 uint16_t handle; /**< Handle to which the HVx operation applies. */
emilmont 80:8e73be2a2ac1 197 uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */
emilmont 80:8e73be2a2ac1 198 uint16_t len; /**< Attribute data length. */
emilmont 80:8e73be2a2ac1 199 uint8_t data[1]; /**< Attribute data, variable length. */
emilmont 80:8e73be2a2ac1 200 } ble_gattc_evt_hvx_t;
emilmont 80:8e73be2a2ac1 201
emilmont 80:8e73be2a2ac1 202 /**@brief Event structure for BLE_GATTC_EVT_TIMEOUT. */
emilmont 80:8e73be2a2ac1 203 typedef struct
emilmont 80:8e73be2a2ac1 204 {
emilmont 80:8e73be2a2ac1 205 uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */
emilmont 80:8e73be2a2ac1 206 } ble_gattc_evt_timeout_t;
emilmont 80:8e73be2a2ac1 207
emilmont 80:8e73be2a2ac1 208 /**@brief GATTC event type. */
emilmont 80:8e73be2a2ac1 209 typedef struct
emilmont 80:8e73be2a2ac1 210 {
emilmont 80:8e73be2a2ac1 211 uint16_t conn_handle; /**< Connection Handle on which event occured. */
emilmont 80:8e73be2a2ac1 212 uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */
emilmont 80:8e73be2a2ac1 213 uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases BLE_GATT_HANDLE_INVALID. */
emilmont 80:8e73be2a2ac1 214 union
emilmont 80:8e73be2a2ac1 215 {
emilmont 80:8e73be2a2ac1 216 ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */
emilmont 80:8e73be2a2ac1 217 ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */
emilmont 80:8e73be2a2ac1 218 ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */
emilmont 80:8e73be2a2ac1 219 ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */
emilmont 80:8e73be2a2ac1 220 ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */
emilmont 80:8e73be2a2ac1 221 ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */
emilmont 80:8e73be2a2ac1 222 ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */
emilmont 80:8e73be2a2ac1 223 ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */
emilmont 80:8e73be2a2ac1 224 ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */
emilmont 80:8e73be2a2ac1 225 ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */
emilmont 80:8e73be2a2ac1 226 } params; /**< Event Parameters. @note Only valid if @ref gatt_status == BLE_GATT_STATUS_SUCCESS. */
emilmont 80:8e73be2a2ac1 227 } ble_gattc_evt_t;
emilmont 80:8e73be2a2ac1 228
emilmont 80:8e73be2a2ac1 229
emilmont 80:8e73be2a2ac1 230 /**@brief Initiate or continue a GATT Primary Service Discovery procedure.
emilmont 80:8e73be2a2ac1 231 *
emilmont 80:8e73be2a2ac1 232 * @details This function initiates a Primary Service discovery, starting from the supplied handle.
emilmont 80:8e73be2a2ac1 233 * If the last service has not been reached, this must be called again with an updated start handle value to continue the search.
emilmont 80:8e73be2a2ac1 234 *
emilmont 80:8e73be2a2ac1 235 * @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
emilmont 80:8e73be2a2ac1 236 * type BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
emilmont 80:8e73be2a2ac1 237 *
emilmont 80:8e73be2a2ac1 238 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 239 * @param[in] start_handle Handle to start searching from.
emilmont 80:8e73be2a2ac1 240 * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned.
emilmont 80:8e73be2a2ac1 241 *
emilmont 80:8e73be2a2ac1 242 * @return @ref NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure.
emilmont 80:8e73be2a2ac1 243 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 244 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
emilmont 80:8e73be2a2ac1 245 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
emilmont 80:8e73be2a2ac1 246 */
emilmont 80:8e73be2a2ac1 247 SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const * const p_srvc_uuid));
emilmont 80:8e73be2a2ac1 248
emilmont 80:8e73be2a2ac1 249
emilmont 80:8e73be2a2ac1 250 /**@brief Initiate or continue a GATT Relationship Discovery procedure.
emilmont 80:8e73be2a2ac1 251 *
emilmont 80:8e73be2a2ac1 252 * @details This function initiates the Find Included Services sub-procedure. If the last included service has not been reached,
emilmont 80:8e73be2a2ac1 253 * this must be called again with an updated handle range to continue the search.
emilmont 80:8e73be2a2ac1 254 *
emilmont 80:8e73be2a2ac1 255 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 256 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on.
emilmont 80:8e73be2a2ac1 257 *
emilmont 80:8e73be2a2ac1 258 * @return @ref NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure.
emilmont 80:8e73be2a2ac1 259 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 260 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
emilmont 80:8e73be2a2ac1 261 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
emilmont 80:8e73be2a2ac1 262 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
emilmont 80:8e73be2a2ac1 263 */
emilmont 80:8e73be2a2ac1 264 SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range));
emilmont 80:8e73be2a2ac1 265
emilmont 80:8e73be2a2ac1 266
emilmont 80:8e73be2a2ac1 267 /**@brief Initiate or continue a GATT Characteristic Discovery procedure.
emilmont 80:8e73be2a2ac1 268 *
emilmont 80:8e73be2a2ac1 269 * @details This function initiates a Characteristic discovery procedure. If the last Characteristic has not been reached,
emilmont 80:8e73be2a2ac1 270 * this must be called again with an updated handle range to continue the discovery.
emilmont 80:8e73be2a2ac1 271 *
emilmont 80:8e73be2a2ac1 272 * @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
emilmont 80:8e73be2a2ac1 273 * type BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
emilmont 80:8e73be2a2ac1 274 *
emilmont 80:8e73be2a2ac1 275 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 276 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on.
emilmont 80:8e73be2a2ac1 277 *
emilmont 80:8e73be2a2ac1 278 * @return @ref NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure.
emilmont 80:8e73be2a2ac1 279 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 280 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
emilmont 80:8e73be2a2ac1 281 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
emilmont 80:8e73be2a2ac1 282 */
emilmont 80:8e73be2a2ac1 283 SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range));
emilmont 80:8e73be2a2ac1 284
emilmont 80:8e73be2a2ac1 285
emilmont 80:8e73be2a2ac1 286 /**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure.
emilmont 80:8e73be2a2ac1 287 *
emilmont 80:8e73be2a2ac1 288 * @details This function initiates the Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached,
emilmont 80:8e73be2a2ac1 289 * this must be called again with an updated handle range to continue the discovery.
emilmont 80:8e73be2a2ac1 290 *
emilmont 80:8e73be2a2ac1 291 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 292 * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on.
emilmont 80:8e73be2a2ac1 293 *
emilmont 80:8e73be2a2ac1 294 * @return @ref NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure.
emilmont 80:8e73be2a2ac1 295 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 296 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
emilmont 80:8e73be2a2ac1 297 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
emilmont 80:8e73be2a2ac1 298 */
emilmont 80:8e73be2a2ac1 299 SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range));
emilmont 80:8e73be2a2ac1 300
emilmont 80:8e73be2a2ac1 301
emilmont 80:8e73be2a2ac1 302 /**@brief Initiate or continue a GATT Read using Characteristic UUID procedure.
emilmont 80:8e73be2a2ac1 303 *
emilmont 80:8e73be2a2ac1 304 * @details This function initiates the Read using Characteristic UUID procedure. If the last Characteristic has not been reached,
emilmont 80:8e73be2a2ac1 305 * this must be called again with an updated handle range to continue the discovery.
emilmont 80:8e73be2a2ac1 306 *
emilmont 80:8e73be2a2ac1 307 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 308 * @param[in] p_uuid Pointer to a Characteristic value UUID to read.
emilmont 80:8e73be2a2ac1 309 * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on.
emilmont 80:8e73be2a2ac1 310 *
emilmont 80:8e73be2a2ac1 311 * @return @ref NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure.
emilmont 80:8e73be2a2ac1 312 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 313 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
emilmont 80:8e73be2a2ac1 314 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
emilmont 80:8e73be2a2ac1 315 */
emilmont 80:8e73be2a2ac1 316 SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, 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));
emilmont 80:8e73be2a2ac1 317
emilmont 80:8e73be2a2ac1 318
emilmont 80:8e73be2a2ac1 319 /**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure.
emilmont 80:8e73be2a2ac1 320 *
emilmont 80:8e73be2a2ac1 321 * @details This function initiates a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor
emilmont 80:8e73be2a2ac1 322 * to be read is longer than GATT_MTU - 1, this function must be called multiple times with appropriate offset to read the
emilmont 80:8e73be2a2ac1 323 * complete value.
emilmont 80:8e73be2a2ac1 324 *
emilmont 80:8e73be2a2ac1 325 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 326 * @param[in] handle The handle of the attribute to be read.
emilmont 80:8e73be2a2ac1 327 * @param[in] offset Offset into the attribute value to be read.
emilmont 80:8e73be2a2ac1 328 *
emilmont 80:8e73be2a2ac1 329 * @return @ref NRF_SUCCESS Successfully started or resumed the Read (Long) procedure.
emilmont 80:8e73be2a2ac1 330 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 331 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
emilmont 80:8e73be2a2ac1 332 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
emilmont 80:8e73be2a2ac1 333 */
emilmont 80:8e73be2a2ac1 334 SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset));
emilmont 80:8e73be2a2ac1 335
emilmont 80:8e73be2a2ac1 336
emilmont 80:8e73be2a2ac1 337 /**@brief Initiate a GATT Read Multiple Characteristic Values procedure.
emilmont 80:8e73be2a2ac1 338 *
emilmont 80:8e73be2a2ac1 339 * @details This function initiates a GATT Read Multiple Characteristic Values procedure.
emilmont 80:8e73be2a2ac1 340 *
emilmont 80:8e73be2a2ac1 341 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 342 * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read.
emilmont 80:8e73be2a2ac1 343 * @param[in] handle_count The number of handles in p_handles.
emilmont 80:8e73be2a2ac1 344 *
emilmont 80:8e73be2a2ac1 345 * @return @ref NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure.
emilmont 80:8e73be2a2ac1 346 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 347 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
emilmont 80:8e73be2a2ac1 348 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
emilmont 80:8e73be2a2ac1 349 */
emilmont 80:8e73be2a2ac1 350 SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const * const p_handles, uint16_t handle_count));
emilmont 80:8e73be2a2ac1 351
emilmont 80:8e73be2a2ac1 352
emilmont 80:8e73be2a2ac1 353 /**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure.
emilmont 80:8e73be2a2ac1 354 *
emilmont 80:8e73be2a2ac1 355 * @details This function can perform all write procedures described in GATT.
emilmont 80:8e73be2a2ac1 356 *
emilmont 80:8e73be2a2ac1 357 * @note It is important to note that a write without response will <b>consume an application buffer</b>, and will therefore
emilmont 80:8e73be2a2ac1 358 * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write on the other hand will use the
emilmont 80:8e73be2a2ac1 359 * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response
emilmont 80:8e73be2a2ac1 360 * has been received from the peer. Please see the documentation of @ref sd_ble_tx_buffer_count_get for more details.
emilmont 80:8e73be2a2ac1 361 *
emilmont 80:8e73be2a2ac1 362 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 363 * @param[in] p_write_params A pointer to a write parameters structure.
emilmont 80:8e73be2a2ac1 364 *
emilmont 80:8e73be2a2ac1 365 * @return @ref NRF_SUCCESS Successfully started the Write procedure.
emilmont 80:8e73be2a2ac1 366 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 367 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
emilmont 80:8e73be2a2ac1 368 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
emilmont 80:8e73be2a2ac1 369 * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
emilmont 80:8e73be2a2ac1 370 * @return @ref NRF_ERROR_BUSY Procedure already in progress.
emilmont 80:8e73be2a2ac1 371 * @return @ref BLE_ERROR_NO_TX_BUFFERS There are no available buffers left.
emilmont 80:8e73be2a2ac1 372 */
emilmont 80:8e73be2a2ac1 373 SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const * const p_write_params));
emilmont 80:8e73be2a2ac1 374
emilmont 80:8e73be2a2ac1 375
emilmont 80:8e73be2a2ac1 376 /**@brief Send a Handle Value Confirmation to the GATT Server.
emilmont 80:8e73be2a2ac1 377 *
emilmont 80:8e73be2a2ac1 378 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
emilmont 80:8e73be2a2ac1 379 * @param[in] handle The handle of the attribute in the indication.
emilmont 80:8e73be2a2ac1 380 *
emilmont 80:8e73be2a2ac1 381 * @return @ref NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission.
emilmont 80:8e73be2a2ac1 382 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
emilmont 80:8e73be2a2ac1 383 * @return @ref NRF_ERROR_INVALID_STATE No Indication pending to be confirmed.
emilmont 80:8e73be2a2ac1 384 * @return @ref BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle.
emilmont 80:8e73be2a2ac1 385 * @return @ref BLE_ERROR_NO_TX_BUFFERS There are no available buffers left.
emilmont 80:8e73be2a2ac1 386 */
emilmont 80:8e73be2a2ac1 387 SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle));
emilmont 80:8e73be2a2ac1 388
emilmont 80:8e73be2a2ac1 389
emilmont 80:8e73be2a2ac1 390 #endif /* BLE_GATTC_H__ */
emilmont 80:8e73be2a2ac1 391
emilmont 80:8e73be2a2ac1 392 /**
emilmont 80:8e73be2a2ac1 393 @}
emilmont 80:8e73be2a2ac1 394 @}
emilmont 80:8e73be2a2ac1 395 */