Committer:
jinu
Date:
Thu Feb 09 06:08:17 2017 +0000
Revision:
0:6ba9b94b8997
NRF51 serialization libraries for mDot

Who changed what in which revision?

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