来自中国的硬件平台

Dependents:   mbed_in_china_blink_led

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Tue Mar 18 12:30:07 2014 +0000
Revision:
123:8a356fb1000a
Parent:
targets/hal/TARGET_NORDIC/TARGET_NRF51822/Lib/s110_nrf51822_6.0.0/s110_nrf51822_6.0.0_API/include/ble_gattc.h@104:a6a92e2e5a92
Synchronized with git revision 3e40310534d854400e01b2e9612ef7edf44a2dc9

Full URL: https://github.com/mbedmicro/mbed/commit/3e40310534d854400e01b2e9612ef7edf44a2dc9/

Who changed what in which revision?

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