project for nrf51822 qfab

Dependencies:   eddystone_URL mbed

Fork of eddystone_URL by vo dung

Committer:
jksoft
Date:
Wed Nov 12 02:40:34 2014 +0000
Revision:
0:76dfa9657d9d
????????

Who changed what in which revision?

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