Nordic stack and drivers for the mbed BLE API

Dependents:   BLE_Health_Thermometer2

Fork of nRF51822 by Nordic Semiconductor

Committer:
Rohit Grover
Date:
Thu May 29 09:51:36 2014 +0100
Revision:
14:5ca08f962e4f
Parent:
0:eff01767de02
Child:
37:c29c330d942c
use accessors for GattCharacteristic

Who changed what in which revision?

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