テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

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