Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nrf51-sdk by
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 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00021 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00022 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00023 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00024 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00025 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00026 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 00027 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00028 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 * 00031 */ 00032 00033 /** 00034 @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client 00035 @{ 00036 @brief Definitions and prototypes for the GATT Client interface. 00037 */ 00038 00039 #ifndef BLE_GATTC_H__ 00040 #define BLE_GATTC_H__ 00041 00042 #include "ble_gatt.h" 00043 #include "ble_types.h" 00044 #include "ble_ranges.h" 00045 #include "nrf_svc.h" 00046 00047 /** @addtogroup BLE_GATTC_ENUMERATIONS Enumerations 00048 * @{ */ 00049 00050 /**@brief GATTC API SVC numbers. */ 00051 enum BLE_GATTC_SVCS 00052 { 00053 SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */ 00054 SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */ 00055 SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */ 00056 SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */ 00057 SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */ 00058 SD_BLE_GATTC_READ, /**< Generic read. */ 00059 SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */ 00060 SD_BLE_GATTC_WRITE, /**< Generic write. */ 00061 SD_BLE_GATTC_HV_CONFIRM /**< Handle Value Confirmation. */ 00062 }; 00063 00064 /** 00065 * @brief GATT Client Event IDs. 00066 */ 00067 enum BLE_GATTC_EVTS 00068 { 00069 BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. @ref ble_gattc_evt_prim_srvc_disc_rsp_t */ 00070 BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. @ref ble_gattc_evt_rel_disc_rsp_t */ 00071 BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. @ref ble_gattc_evt_char_disc_rsp_t */ 00072 BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. @ref ble_gattc_evt_desc_disc_rsp_t */ 00073 BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t */ 00074 BLE_GATTC_EVT_READ_RSP, /**< Read Response event. @ref ble_gattc_evt_read_rsp_t */ 00075 BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. @ref ble_gattc_evt_char_vals_read_rsp_t */ 00076 BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. @ref ble_gattc_evt_write_rsp_t */ 00077 BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. @ref ble_gattc_evt_hvx_t */ 00078 BLE_GATTC_EVT_TIMEOUT /**< Timeout event. @ref ble_gattc_evt_timeout_t */ 00079 }; 00080 00081 /** @} */ 00082 00083 /** @addtogroup BLE_GATTC_DEFINES Defines 00084 * @{ */ 00085 00086 /** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC 00087 * @{ */ 00088 #define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */ 00089 /** @} */ 00090 00091 /**@brief Last Attribute Handle. */ 00092 #define BLE_GATTC_HANDLE_END 0xFFFF 00093 00094 /** @} */ 00095 00096 /** @addtogroup BLE_GATTC_STRUCTURES Structures 00097 * @{ */ 00098 00099 /**@brief Operation Handle Range. */ 00100 typedef struct 00101 { 00102 uint16_t start_handle; /**< Start Handle. */ 00103 uint16_t end_handle; /**< End Handle. */ 00104 } ble_gattc_handle_range_t; 00105 00106 00107 /**@brief GATT service. */ 00108 typedef struct 00109 { 00110 ble_uuid_t uuid; /**< Service UUID. */ 00111 ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */ 00112 } ble_gattc_service_t; 00113 00114 00115 /**@brief GATT include. */ 00116 typedef struct 00117 { 00118 uint16_t handle; /**< Include Handle. */ 00119 ble_gattc_service_t included_srvc; /**< Handle of the included service. */ 00120 } ble_gattc_include_t; 00121 00122 00123 /**@brief GATT characteristic. */ 00124 typedef struct 00125 { 00126 ble_uuid_t uuid; /**< Characteristic UUID. */ 00127 ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ 00128 uint8_t char_ext_props : 1; /**< Extended properties present. */ 00129 uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */ 00130 uint16_t handle_value; /**< Handle of the Characteristic Value. */ 00131 } ble_gattc_char_t; 00132 00133 00134 /**@brief GATT descriptor. */ 00135 typedef struct 00136 { 00137 uint16_t handle; /**< Descriptor Handle. */ 00138 ble_uuid_t uuid; /**< Descriptor UUID. */ 00139 } ble_gattc_desc_t; 00140 00141 00142 /**@brief Write Parameters. */ 00143 typedef struct 00144 { 00145 uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ 00146 uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ 00147 uint16_t handle; /**< Handle to the attribute to be written. */ 00148 uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ 00149 uint16_t len; /**< Length of data in bytes. */ 00150 uint8_t *p_value; /**< Pointer to the value data. */ 00151 } ble_gattc_write_params_t; 00152 00153 /**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */ 00154 typedef struct 00155 { 00156 uint16_t count; /**< Service count. */ 00157 ble_gattc_service_t services[1]; /**< Service data, variable length. */ 00158 } ble_gattc_evt_prim_srvc_disc_rsp_t; 00159 00160 /**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */ 00161 typedef struct 00162 { 00163 uint16_t count; /**< Include count. */ 00164 ble_gattc_include_t includes[1]; /**< Include data, variable length. */ 00165 } ble_gattc_evt_rel_disc_rsp_t; 00166 00167 /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */ 00168 typedef struct 00169 { 00170 uint16_t count; /**< Characteristic count. */ 00171 ble_gattc_char_t chars[1]; /**< Characteristic data, variable length. */ 00172 } ble_gattc_evt_char_disc_rsp_t; 00173 00174 /**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */ 00175 typedef struct 00176 { 00177 uint16_t count; /**< Descriptor count. */ 00178 ble_gattc_desc_t descs[1]; /**< Descriptor data, variable length. */ 00179 } ble_gattc_evt_desc_disc_rsp_t; 00180 00181 /**@brief GATT read by UUID handle value pair. */ 00182 typedef struct 00183 { 00184 uint16_t handle; /**< Attribute Handle. */ 00185 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). 00186 Please note that this pointer is absolute to the memory provided by the user when retrieving the event, 00187 so it will effectively point to a location inside the handle_value array. */ 00188 } ble_gattc_handle_value_t; 00189 00190 /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */ 00191 typedef struct 00192 { 00193 uint16_t count; /**< Handle-Value Pair Count. */ 00194 uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */ 00195 ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list, variable length. */ 00196 } ble_gattc_evt_char_val_by_uuid_read_rsp_t; 00197 00198 /**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */ 00199 typedef struct 00200 { 00201 uint16_t handle; /**< Attribute Handle. */ 00202 uint16_t offset; /**< Offset of the attribute data. */ 00203 uint16_t len; /**< Attribute data length. */ 00204 uint8_t data[1]; /**< Attribute data, variable length. */ 00205 } ble_gattc_evt_read_rsp_t; 00206 00207 /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */ 00208 typedef struct 00209 { 00210 uint16_t len; /**< Concatenated Attribute values length. */ 00211 uint8_t values[1]; /**< Attribute values, variable length. */ 00212 } ble_gattc_evt_char_vals_read_rsp_t; 00213 00214 /**@brief Event structure for @ref BLE_GATTC_EVT_WRITE_RSP. */ 00215 typedef struct 00216 { 00217 uint16_t handle; /**< Attribute Handle. */ 00218 uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */ 00219 uint16_t offset; /**< Data offset. */ 00220 uint16_t len; /**< Data length. */ 00221 uint8_t data[1]; /**< Data, variable length. */ 00222 } ble_gattc_evt_write_rsp_t; 00223 00224 /**@brief Event structure for @ref BLE_GATTC_EVT_HVX. */ 00225 typedef struct 00226 { 00227 uint16_t handle; /**< Handle to which the HVx operation applies. */ 00228 uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ 00229 uint16_t len; /**< Attribute data length. */ 00230 uint8_t data[1]; /**< Attribute data, variable length. */ 00231 } ble_gattc_evt_hvx_t; 00232 00233 /**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */ 00234 typedef struct 00235 { 00236 uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ 00237 } ble_gattc_evt_timeout_t; 00238 00239 /**@brief GATTC event structure. */ 00240 typedef struct 00241 { 00242 uint16_t conn_handle; /**< Connection Handle on which event occured. */ 00243 uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ 00244 uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases @ref BLE_GATT_HANDLE_INVALID. */ 00245 union 00246 { 00247 ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */ 00248 ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */ 00249 ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */ 00250 ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */ 00251 ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */ 00252 ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */ 00253 ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */ 00254 ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */ 00255 ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */ 00256 ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */ 00257 } params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */ 00258 } ble_gattc_evt_t; 00259 /** @} */ 00260 00261 /** @addtogroup BLE_GATTC_FUNCTIONS Functions 00262 * @{ */ 00263 00264 /**@brief Initiate or continue a GATT Primary Service Discovery procedure. 00265 * 00266 * @details This function initiates or resumes a Primary Service discovery procedure, starting from the supplied handle. 00267 * If the last service has not been reached, this function must be called again with an updated start handle value to continue the search. 00268 * 00269 * @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 00270 * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. 00271 * 00272 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00273 * @param[in] start_handle Handle to start searching from. 00274 * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned. 00275 * 00276 * @retval ::NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure. 00277 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00278 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00279 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. 00280 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00281 */ 00282 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)); 00283 00284 00285 /**@brief Initiate or continue a GATT Relationship Discovery procedure. 00286 * 00287 * @details This function initiates or resumes the Find Included Services sub-procedure. If the last included service has not been reached, 00288 * this must be called again with an updated handle range to continue the search. 00289 * 00290 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00291 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. 00292 * 00293 * @retval ::NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure. 00294 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00295 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00296 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00297 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. 00298 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00299 */ 00300 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)); 00301 00302 00303 /**@brief Initiate or continue a GATT Characteristic Discovery procedure. 00304 * 00305 * @details This function initiates or resumes a Characteristic discovery procedure. If the last Characteristic has not been reached, 00306 * this must be called again with an updated handle range to continue the discovery. 00307 * 00308 * @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 00309 * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. 00310 * 00311 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00312 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. 00313 * 00314 * @retval ::NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure. 00315 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00316 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00317 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00318 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00319 */ 00320 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)); 00321 00322 00323 /**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure. 00324 * 00325 * @details This function initiates or resumes a Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached, 00326 * this must be called again with an updated handle range to continue the discovery. 00327 * 00328 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00329 * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on. 00330 * 00331 * @retval ::NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure. 00332 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00333 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00334 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00335 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00336 */ 00337 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)); 00338 00339 00340 /**@brief Initiate or continue a GATT Read using Characteristic UUID procedure. 00341 * 00342 * @details This function initiates or resumes a Read using Characteristic UUID procedure. If the last Characteristic has not been reached, 00343 * this must be called again with an updated handle range to continue the discovery. 00344 * 00345 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00346 * @param[in] p_uuid Pointer to a Characteristic value UUID to read. 00347 * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on. 00348 * 00349 * @retval ::NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure. 00350 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00351 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00352 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00353 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00354 */ 00355 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)); 00356 00357 00358 /**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure. 00359 * 00360 * @details This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor 00361 * to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the 00362 * complete value. 00363 * 00364 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00365 * @param[in] handle The handle of the attribute to be read. 00366 * @param[in] offset Offset into the attribute value to be read. 00367 * 00368 * @retval ::NRF_SUCCESS Successfully started or resumed the Read (Long) procedure. 00369 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00370 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00371 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00372 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00373 */ 00374 SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset)); 00375 00376 00377 /**@brief Initiate a GATT Read Multiple Characteristic Values procedure. 00378 * 00379 * @details This function initiates a GATT Read Multiple Characteristic Values procedure. 00380 * 00381 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00382 * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read. 00383 * @param[in] handle_count The number of handles in p_handles. 00384 * 00385 * @retval ::NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure. 00386 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00387 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00388 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00389 * @retval ::NRF_ERROR_BUSY Client procedure already in progress. 00390 */ 00391 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)); 00392 00393 00394 /**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure. 00395 * 00396 * @details This function can perform all write procedures described in GATT. 00397 * 00398 * @note It is important to note that a write without response will <b>consume an application buffer</b>, and will therefore 00399 * 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 00400 * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response 00401 * has been received from the peer. Please see the documentation of @ref sd_ble_tx_buffer_count_get for more details. 00402 * 00403 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00404 * @param[in] p_write_params A pointer to a write parameters structure. 00405 * 00406 * @retval ::NRF_SUCCESS Successfully started the Write procedure. 00407 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00408 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. 00409 * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. 00410 * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. 00411 * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. 00412 * @retval ::NRF_ERROR_BUSY Procedure already in progress. 00413 * @retval ::BLE_ERROR_NO_TX_BUFFERS There are no available buffers left. 00414 */ 00415 SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params)); 00416 00417 00418 /**@brief Send a Handle Value Confirmation to the GATT Server. 00419 * 00420 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. 00421 * @param[in] handle The handle of the attribute in the indication. 00422 * 00423 * @retval ::NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission. 00424 * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. 00425 * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no Indication pending to be confirmed. 00426 * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle. 00427 */ 00428 SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle)); 00429 00430 /** @} */ 00431 00432 #endif /* BLE_GATTC_H__ */ 00433 00434 /** 00435 @} 00436 @} 00437 */
Generated on Tue Jul 12 2022 14:11:18 by
