BLE_Nano nRF51 Central heart rate
Embed:
(wiki syntax)
Show/hide line numbers
ble_gattc.h
00001 /* 00002 * Copyright (c) Nordic Semiconductor ASA 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without modification, 00006 * are permitted provided that the following conditions are met: 00007 * 00008 * 1. Redistributions of source code must retain the above copyright notice, this 00009 * list of conditions and the following disclaimer. 00010 * 00011 * 2. Redistributions in binary form must reproduce the above copyright notice, this 00012 * list of conditions and the following disclaimer in the documentation and/or 00013 * other materials provided with the distribution. 00014 * 00015 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other 00016 * contributors to this software may be used to endorse or promote products 00017 * derived from this software without specific prior written permission. 00018 * 00019 * 4. This software must only be used in a processor manufactured by Nordic 00020 * Semiconductor ASA, or in a processor manufactured by a third party that 00021 * is used in combination with a processor manufactured by Nordic Semiconductor. 00022 * 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00025 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00026 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00028 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00029 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00031 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00033 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 /** 00038 @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client 00039 @{ 00040 @brief Definitions and prototypes for the GATT Client interface. 00041 */ 00042 00043 #ifndef BLE_GATTC_H__ 00044 #define BLE_GATTC_H__ 00045 00046 #include "ble_gatt.h" 00047 #include "ble_types.h" 00048 #include "ble_ranges.h" 00049 #include "nrf_svc.h" 00050 00051 #ifdef __cplusplus 00052 extern "C" { 00053 #endif 00054 00055 /** @addtogroup BLE_GATTC_ENUMERATIONS Enumerations 00056 * @{ */ 00057 00058 /**@brief GATTC API SVC numbers. */ 00059 enum BLE_GATTC_SVCS 00060 { 00061 SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */ 00062 SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */ 00063 SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */ 00064 SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */ 00065 SD_BLE_GATTC_ATTR_INFO_DISCOVER, /**< Attribute Information Discovery. */ 00066 SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */ 00067 SD_BLE_GATTC_READ, /**< Generic read. */ 00068 SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */ 00069 SD_BLE_GATTC_WRITE, /**< Generic write. */ 00070 SD_BLE_GATTC_HV_CONFIRM, /**< Handle Value Confirmation. */ 00071 }; 00072 00073 /** 00074 * @brief GATT Client Event IDs. 00075 */ 00076 enum BLE_GATTC_EVTS 00077 { 00078 BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. \n See @ref ble_gattc_evt_prim_srvc_disc_rsp_t. */ 00079 BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. \n See @ref ble_gattc_evt_rel_disc_rsp_t. */ 00080 BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. \n See @ref ble_gattc_evt_char_disc_rsp_t. */ 00081 BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. \n See @ref ble_gattc_evt_desc_disc_rsp_t. */ 00082 BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, /**< Attribute Information Response event. \n See @ref ble_gattc_evt_attr_info_disc_rsp_t. */ 00083 BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. \n See @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t. */ 00084 BLE_GATTC_EVT_READ_RSP, /**< Read Response event. \n See @ref ble_gattc_evt_read_rsp_t. */ 00085 BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. \n See @ref ble_gattc_evt_char_vals_read_rsp_t. */ 00086 BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. \n See @ref ble_gattc_evt_write_rsp_t. */ 00087 BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. \n Confirm indication with @ref sd_ble_gattc_hv_confirm. \n See @ref ble_gattc_evt_hvx_t. */ 00088 BLE_GATTC_EVT_TIMEOUT /**< Timeout event. \n See @ref ble_gattc_evt_timeout_t. */ 00089 }; 00090 00091 /** @} */ 00092 00093 /** @addtogroup BLE_GATTC_DEFINES Defines 00094 * @{ */ 00095 00096 /** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC 00097 * @{ */ 00098 #define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */ 00099 /** @} */ 00100 00101 /** @defgroup BLE_GATTC_ATTR_INFO_FORMAT Attribute Information Formats 00102 * @{ */ 00103 #define BLE_GATTC_ATTR_INFO_FORMAT_16BIT 1 /**< 16-bit Attribute Information Format. */ 00104 #define BLE_GATTC_ATTR_INFO_FORMAT_128BIT 2 /**< 128-bit Attribute Information Format. */ 00105 /** @} */ 00106 00107 /** @} */ 00108 00109 /** @addtogroup BLE_GATTC_STRUCTURES Structures 00110 * @{ */ 00111 00112 /**@brief Operation Handle Range. */ 00113 typedef struct 00114 { 00115 uint16_t start_handle; /**< Start Handle. */ 00116 uint16_t end_handle; /**< End Handle. */ 00117 } ble_gattc_handle_range_t; 00118 00119 00120 /**@brief GATT service. */ 00121 typedef struct 00122 { 00123 ble_uuid_t uuid; /**< Service UUID. */ 00124 ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */ 00125 } ble_gattc_service_t; 00126 00127 00128 /**@brief GATT include. */ 00129 typedef struct 00130 { 00131 uint16_t handle; /**< Include Handle. */ 00132 ble_gattc_service_t included_srvc; /**< Handle of the included service. */ 00133 } ble_gattc_include_t; 00134 00135 00136 /**@brief GATT characteristic. */ 00137 typedef struct 00138 { 00139 ble_uuid_t uuid; /**< Characteristic UUID. */ 00140 ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ 00141 uint8_t char_ext_props : 1; /**< Extended properties present. */ 00142 uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */ 00143 uint16_t handle_value; /**< Handle of the Characteristic Value. */ 00144 } ble_gattc_char_t; 00145 00146 00147 /**@brief GATT descriptor. */ 00148 typedef struct 00149 { 00150 uint16_t handle; /**< Descriptor Handle. */ 00151 ble_uuid_t uuid; /**< Descriptor UUID. */ 00152 } ble_gattc_desc_t; 00153 00154 00155 /**@brief Write Parameters. */ 00156 typedef struct 00157 { 00158 uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ 00159 uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ 00160 uint16_t handle; /**< Handle to the attribute to be written. */ 00161 uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ 00162 uint16_t len; /**< Length of data in bytes. */ 00163 uint8_t *p_value; /**< Pointer to the value data. */ 00164 } ble_gattc_write_params_t; 00165 00166 /**@brief Attribute Information. */ 00167 typedef struct 00168 { 00169 uint16_t handle; /**< Attribute handle. */ 00170 union { 00171 ble_uuid_t uuid16; /**< 16-bit Attribute UUID. */ 00172 ble_uuid128_t uuid128; /**< 128-bit Attribute UUID. */ 00173 } info; 00174 } ble_gattc_attr_info_t; 00175 00176 /**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */ 00177 typedef struct 00178 { 00179 uint16_t count; /**< Service count. */ 00180 ble_gattc_service_t services[1]; /**< Service data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00181 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00182 } ble_gattc_evt_prim_srvc_disc_rsp_t; 00183 00184 /**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */ 00185 typedef struct 00186 { 00187 uint16_t count; /**< Include count. */ 00188 ble_gattc_include_t includes[1]; /**< Include data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00189 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00190 } ble_gattc_evt_rel_disc_rsp_t; 00191 00192 /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */ 00193 typedef struct 00194 { 00195 uint16_t count; /**< Characteristic count. */ 00196 ble_gattc_char_t chars[1]; /**< Characteristic data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00197 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00198 } ble_gattc_evt_char_disc_rsp_t; 00199 00200 /**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */ 00201 typedef struct 00202 { 00203 uint16_t count; /**< Descriptor count. */ 00204 ble_gattc_desc_t descs[1]; /**< Descriptor data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00205 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00206 } ble_gattc_evt_desc_disc_rsp_t; 00207 00208 /**@brief Event structure for @ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP. */ 00209 typedef struct 00210 { 00211 uint16_t count; /**< Attribute count. */ 00212 uint8_t format; /**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */ 00213 ble_gattc_attr_info_t attr_info[1]; /**< Attribute information. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00214 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00215 } ble_gattc_evt_attr_info_disc_rsp_t; 00216 00217 /**@brief GATT read by UUID handle value pair. */ 00218 typedef struct 00219 { 00220 uint16_t handle; /**< Attribute Handle. */ 00221 uint8_t *p_value; /**< Pointer to value, variable length (length available as value_len in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t). 00222 Please note that this pointer is absolute to the memory provided by the user when retrieving the event, 00223 so it will effectively point to a location inside the handle_value array. */ 00224 } ble_gattc_handle_value_t; 00225 00226 /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */ 00227 typedef struct 00228 { 00229 uint16_t count; /**< Handle-Value Pair Count. */ 00230 uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */ 00231 ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00232 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00233 } ble_gattc_evt_char_val_by_uuid_read_rsp_t; 00234 00235 /**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */ 00236 typedef struct 00237 { 00238 uint16_t handle; /**< Attribute Handle. */ 00239 uint16_t offset; /**< Offset of the attribute data. */ 00240 uint16_t len; /**< Attribute data length. */ 00241 uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00242 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00243 } ble_gattc_evt_read_rsp_t; 00244 00245 /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */ 00246 typedef struct 00247 { 00248 uint16_t len; /**< Concatenated Attribute values length. */ 00249 uint8_t values[1]; /**< Attribute values. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00250 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00251 } ble_gattc_evt_char_vals_read_rsp_t; 00252 00253 /**@brief Event structure for @ref BLE_GATTC_EVT_WRITE_RSP. */ 00254 typedef struct 00255 { 00256 uint16_t handle; /**< Attribute Handle. */ 00257 uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */ 00258 uint16_t offset; /**< Data offset. */ 00259 uint16_t len; /**< Data length. */ 00260 uint8_t data[1]; /**< Data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00261 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00262 } ble_gattc_evt_write_rsp_t; 00263 00264 /**@brief Event structure for @ref BLE_GATTC_EVT_HVX. */ 00265 typedef struct 00266 { 00267 uint16_t handle; /**< Handle to which the HVx operation applies. */ 00268 uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ 00269 uint16_t len; /**< Attribute data length. */ 00270 uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. 00271 See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ 00272 } ble_gattc_evt_hvx_t; 00273 00274 /**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */ 00275 typedef struct 00276 { 00277 uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ 00278 } ble_gattc_evt_timeout_t; 00279 00280 /**@brief GATTC event structure. */ 00281 typedef struct 00282 { 00283 uint16_t conn_handle; /**< Connection Handle on which event occured. */ 00284 uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ 00285 uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases @ref BLE_GATT_HANDLE_INVALID. */ 00286 union 00287 { 00288 ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */ 00289 ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */ 00290 ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */ 00291 ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */ 00292 ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */ 00293 ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */ 00294 ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */ 00295 ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */ 00296 ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */ 00297 ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */ 00298 ble_gattc_evt_attr_info_disc_rsp_t attr_info_disc_rsp; /**< Attribute Information Discovery Event Parameters. */ 00299 } params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */ 00300 } ble_gattc_evt_t; 00301 /** @} */ 00302 00303 /** @addtogroup BLE_GATTC_FUNCTIONS Functions 00304 * @{ */ 00305 00306 /**@brief Initiate or continue a GATT Primary Service Discovery procedure. 00307 * 00308 * @details This function initiates or resumes a Primary Service discovery procedure, starting from the supplied handle. 00309 * If the last service has not been reached, this function must be called again with an updated start handle value to continue the search. 00310 * 00311 * @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 00312 * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. 00313 * 00314 * @events 00315 * @event{@ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP} 00316 * @endevents 00317 * 00318 * @mscs 00319 * @mmsc{@ref BLE_GATTC_PRIM_SRVC_DISC_MSC} 00320 * @endmscs 00321 * 00322 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00323 * @param[in] start_handle Handle to start searching from. 00324 * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned. 00325 * 00326 * @retval ::NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure. 00327 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00328 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00329 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. 00330 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00331 */ 00332 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 *p_srvc_uuid)); 00333 00334 00335 /**@brief Initiate or continue a GATT Relationship Discovery procedure. 00336 * 00337 * @details This function initiates or resumes the Find Included Services sub-procedure. If the last included service has not been reached, 00338 * this must be called again with an updated handle range to continue the search. 00339 * 00340 * @events 00341 * @event{@ref BLE_GATTC_EVT_REL_DISC_RSP} 00342 * @endevents 00343 * 00344 * @mscs 00345 * @mmsc{@ref BLE_GATTC_REL_DISC_MSC} 00346 * @endmscs 00347 * 00348 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00349 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. 00350 * 00351 * @retval ::NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure. 00352 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00353 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00354 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00355 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. 00356 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00357 */ 00358 SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); 00359 00360 00361 /**@brief Initiate or continue a GATT Characteristic Discovery procedure. 00362 * 00363 * @details This function initiates or resumes a Characteristic discovery procedure. If the last Characteristic has not been reached, 00364 * this must be called again with an updated handle range to continue the discovery. 00365 * 00366 * @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 00367 * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. 00368 * 00369 * @events 00370 * @event{@ref BLE_GATTC_EVT_CHAR_DISC_RSP} 00371 * @endevents 00372 * 00373 * @mscs 00374 * @mmsc{@ref BLE_GATTC_CHAR_DISC_MSC} 00375 * @endmscs 00376 * 00377 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00378 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. 00379 * 00380 * @retval ::NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure. 00381 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00382 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00383 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00384 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00385 */ 00386 SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); 00387 00388 00389 /**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure. 00390 * 00391 * @details This function initiates or resumes a Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached, 00392 * this must be called again with an updated handle range to continue the discovery. 00393 * 00394 * @events 00395 * @event{BLE_GATTC_EVT_DESC_DISC_RSP} 00396 * @endevents 00397 * 00398 * @mscs 00399 * @mmsc{@ref BLE_GATTC_DESC_DISC_MSC} 00400 * @endmscs 00401 * 00402 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00403 * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on. 00404 * 00405 * @retval ::NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure. 00406 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00407 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00408 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00409 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00410 */ 00411 SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); 00412 00413 00414 /**@brief Initiate or continue a GATT Read using Characteristic UUID procedure. 00415 * 00416 * @details This function initiates or resumes a Read using Characteristic UUID procedure. If the last Characteristic has not been reached, 00417 * this must be called again with an updated handle range to continue the discovery. 00418 * 00419 * @events 00420 * @event{BLE_GATTC_EVT_DESC_DISC_RSP} 00421 * @endevents 00422 * 00423 * @mscs 00424 * @mmsc{@ref BLE_GATTC_READ_UUID_MSC} 00425 * @endmscs 00426 * 00427 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00428 * @param[in] p_uuid Pointer to a Characteristic value UUID to read. 00429 * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on. 00430 * 00431 * @retval ::NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure. 00432 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00433 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00434 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00435 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00436 */ 00437 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 *p_uuid, ble_gattc_handle_range_t const *p_handle_range)); 00438 00439 00440 /**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure. 00441 * 00442 * @details This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor 00443 * to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the 00444 * complete value. 00445 * 00446 * @events 00447 * @event{@ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP} 00448 * @endevents 00449 * 00450 * @mscs 00451 * @mmsc{@ref BLE_GATTC_VALUE_READ_MSC} 00452 * @endmscs 00453 * 00454 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00455 * @param[in] handle The handle of the attribute to be read. 00456 * @param[in] offset Offset into the attribute value to be read. 00457 * 00458 * @retval ::NRF_SUCCESS Successfully started or resumed the Read (Long) procedure. 00459 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00460 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00461 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00462 */ 00463 SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset)); 00464 00465 00466 /**@brief Initiate a GATT Read Multiple Characteristic Values procedure. 00467 * 00468 * @details This function initiates a GATT Read Multiple Characteristic Values procedure. 00469 * 00470 * @events 00471 * @event{@ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP} 00472 * @endevents 00473 * 00474 * @mscs 00475 * @mmsc{@ref BLE_GATTC_READ_MULT_MSC} 00476 * @endmscs 00477 * 00478 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00479 * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read. 00480 * @param[in] handle_count The number of handles in p_handles. 00481 * 00482 * @retval ::NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure. 00483 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00484 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00485 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00486 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00487 */ 00488 SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count)); 00489 00490 00491 /**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure. 00492 * 00493 * @details This function can perform all write procedures described in GATT. 00494 * 00495 * @note It is important to note that a write without response will <b>consume an application buffer</b>, and will therefore 00496 * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write (with response) on the other hand will use the 00497 * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response 00498 * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. 00499 * 00500 * @events 00501 * @event{@ref BLE_GATTC_EVT_WRITE_RSP, Generated when using write request or queued writes.} 00502 * @endevents 00503 * 00504 * @mscs 00505 * @mmsc{@ref BLE_GATTC_VALUE_WRITE_MSC} 00506 * @mmsc{@ref BLE_GATTC_VALUE_LONG_WRITE_MSC} 00507 * @mmsc{@ref BLE_GATTC_VALUE_RELIABLE_WRITE_MSC} 00508 * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} 00509 * @endmscs 00510 * 00511 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00512 * @param[in] p_write_params A pointer to a write parameters structure. 00513 * 00514 * @retval ::NRF_SUCCESS Successfully started the Write procedure. 00515 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00516 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00517 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00518 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. 00519 * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. 00520 * @retval ::NRF_ERROR_BUSY Procedure already in progress. 00521 * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection. 00522 */ 00523 SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params)); 00524 00525 00526 /**@brief Send a Handle Value Confirmation to the GATT Server. 00527 * 00528 * @mscs 00529 * @mmsc{@ref BLE_GATTC_HVI_MSC} 00530 * @endmscs 00531 * 00532 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00533 * @param[in] handle The handle of the attribute in the indication. 00534 * 00535 * @retval ::NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission. 00536 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00537 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no Indication pending to be confirmed. 00538 * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle. 00539 */ 00540 SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle)); 00541 00542 /**@brief Discovers information about a range of attributes on a GATT server. 00543 * 00544 * @events 00545 * @event{@ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, Generated when information about a range of attributes has been received.} 00546 * @endevents 00547 * 00548 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00549 * @param[in] p_handle_range The range of handles to request information about. 00550 * 00551 * @retval ::NRF_SUCCESS Successfully started an attribute information discovery procedure. 00552 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. 00553 * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state 00554 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00555 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00556 */ 00557 SVCALL(SD_BLE_GATTC_ATTR_INFO_DISCOVER, uint32_t, sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * p_handle_range)); 00558 00559 /** @} */ 00560 00561 #ifdef __cplusplus 00562 } 00563 #endif 00564 #endif /* BLE_GATTC_H__ */ 00565 00566 /** 00567 @} 00568 @} 00569 */ 00570
Generated on Wed Jul 13 2022 07:07:19 by 1.7.2