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:
bogdanm
Date:
Mon May 19 18:14:09 2014 +0100
Revision:
84:0b3ab51c8877
Parent:
82:6473597d706e
Release 84 of the mbed library

Main changes:

- added LPC11U68 to the official build
- Bug fixes and new features for ST Nucleo boards
- I2C fixes for Freescale targets
- Added nRF51822 exporters

Who changed what in which revision?

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