To get started with Seeed Tiny BLE, include detecting motion, button and battery level.

Dependencies:   BLE_API eMPL_MPU6050 mbed nRF51822

Committer:
yihui
Date:
Wed Apr 22 07:47:17 2015 +0000
Revision:
1:fc2f9d636751
update libraries; ; delete nRF51822/nordic-sdk/components/gpiote/app_gpiote.c to solve GPIOTE_IRQHandler multiply defined issue. temperarily change nRF51822 library to folder

Who changed what in which revision?

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