BLE_Nano nRF51 Central heart rate

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_gatts.h Source File

ble_gatts.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_GATTS Generic Attribute Profile (GATT) Server
00039   @{
00040   @brief  Definitions and prototypes for the GATTS interface.
00041  */
00042 
00043 #ifndef BLE_GATTS_H__
00044 #define BLE_GATTS_H__
00045 
00046 #include "ble_types.h"
00047 #include "ble_ranges.h"
00048 #include "ble_l2cap.h"
00049 #include "ble_gap.h"
00050 #include "ble_gatt.h"
00051 #include "nrf_svc.h"
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /** @addtogroup BLE_GATTS_ENUMERATIONS Enumerations
00058  * @{ */
00059 
00060 /**
00061  * @brief GATTS API SVC numbers.
00062  */
00063 enum BLE_GATTS_SVCS
00064 {
00065   SD_BLE_GATTS_SERVICE_ADD = BLE_GATTS_SVC_BASE, /**< Add a service. */
00066   SD_BLE_GATTS_INCLUDE_ADD,                      /**< Add an included service. */
00067   SD_BLE_GATTS_CHARACTERISTIC_ADD,               /**< Add a characteristic. */
00068   SD_BLE_GATTS_DESCRIPTOR_ADD,                   /**< Add a generic attribute. */
00069   SD_BLE_GATTS_VALUE_SET,                        /**< Set an attribute value. */
00070   SD_BLE_GATTS_VALUE_GET,                        /**< Get an attribute value. */
00071   SD_BLE_GATTS_HVX,                              /**< Handle Value Notification or Indication. */
00072   SD_BLE_GATTS_SERVICE_CHANGED,                  /**< Perform a Service Changed Indication to one or more peers. */
00073   SD_BLE_GATTS_RW_AUTHORIZE_REPLY,               /**< Reply to an authorization request for a read or write operation on one or more attributes. */
00074   SD_BLE_GATTS_SYS_ATTR_SET,                     /**< Set the persistent system attributes for a connection. */
00075   SD_BLE_GATTS_SYS_ATTR_GET,                     /**< Retrieve the persistent system attributes. */
00076   SD_BLE_GATTS_INITIAL_USER_HANDLE_GET,          /**< Retrieve the first valid user handle. */
00077   SD_BLE_GATTS_ATTR_GET                          /**< Retrieve the UUID and/or metadata of an attribute. */
00078 };
00079 
00080 /**
00081  * @brief GATT Server Event IDs.
00082  */
00083 enum BLE_GATTS_EVTS
00084 {
00085   BLE_GATTS_EVT_WRITE = BLE_GATTS_EVT_BASE,       /**< Write operation performed.                                           \n See @ref ble_gatts_evt_write_t.                 */
00086   BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST,             /**< Read/Write Authorization request.                                    \n Reply with @ref sd_ble_gatts_rw_authorize_reply. \n See @ref ble_gatts_evt_rw_authorize_request_t. */
00087   BLE_GATTS_EVT_SYS_ATTR_MISSING,                 /**< A persistent system attribute access is pending.                     \n Respond with @ref sd_ble_gatts_sys_attr_set.     \n See @ref ble_gatts_evt_sys_attr_missing_t.     */
00088   BLE_GATTS_EVT_HVC,                              /**< Handle Value Confirmation.                                           \n See @ref ble_gatts_evt_hvc_t.                   */
00089   BLE_GATTS_EVT_SC_CONFIRM,                       /**< Service Changed Confirmation. No additional event structure applies.                                                    */
00090   BLE_GATTS_EVT_TIMEOUT                           /**< Peer failed to resonpond to an ATT request in time.                  \n See @ref ble_gatts_evt_timeout_t.               */
00091 };
00092 /** @} */
00093 
00094 /** @addtogroup BLE_GATTS_DEFINES Defines
00095  * @{ */
00096 
00097 /** @defgroup BLE_ERRORS_GATTS SVC return values specific to GATTS
00098  * @{ */
00099 #define BLE_ERROR_GATTS_INVALID_ATTR_TYPE   (NRF_GATTS_ERR_BASE + 0x000) /**< Invalid attribute type. */
00100 #define BLE_ERROR_GATTS_SYS_ATTR_MISSING    (NRF_GATTS_ERR_BASE + 0x001) /**< System Attributes missing. */
00101 /** @} */
00102 
00103 /** @defgroup BLE_GATTS_ATTR_LENS_MAX Maximum attribute lengths
00104  * @{ */
00105 #define BLE_GATTS_FIX_ATTR_LEN_MAX (510)  /**< Maximum length for fixed length Attribute Values. */
00106 #define BLE_GATTS_VAR_ATTR_LEN_MAX (512)  /**< Maximum length for variable length Attribute Values. */
00107 /** @} */
00108 
00109 /** @defgroup BLE_GATTS_SRVC_TYPES GATT Server Service Types
00110  * @{ */
00111 #define BLE_GATTS_SRVC_TYPE_INVALID          0x00  /**< Invalid Service Type. */
00112 #define BLE_GATTS_SRVC_TYPE_PRIMARY          0x01  /**< Primary Service. */
00113 #define BLE_GATTS_SRVC_TYPE_SECONDARY        0x02  /**< Secondary Type. */
00114 /** @} */
00115 
00116 
00117 /** @defgroup BLE_GATTS_ATTR_TYPES GATT Server Attribute Types
00118  * @{ */
00119 #define BLE_GATTS_ATTR_TYPE_INVALID         0x00  /**< Invalid Attribute Type. */
00120 #define BLE_GATTS_ATTR_TYPE_PRIM_SRVC_DECL  0x01  /**< Primary Service Declaration. */
00121 #define BLE_GATTS_ATTR_TYPE_SEC_SRVC_DECL   0x02  /**< Secondary Service Declaration. */
00122 #define BLE_GATTS_ATTR_TYPE_INC_DECL        0x03  /**< Include Declaration. */
00123 #define BLE_GATTS_ATTR_TYPE_CHAR_DECL       0x04  /**< Characteristic Declaration. */
00124 #define BLE_GATTS_ATTR_TYPE_CHAR_VAL        0x05  /**< Characteristic Value. */
00125 #define BLE_GATTS_ATTR_TYPE_DESC            0x06  /**< Descriptor. */
00126 #define BLE_GATTS_ATTR_TYPE_OTHER           0x07  /**< Other, non-GATT specific type. */
00127 /** @} */
00128 
00129 
00130 /** @defgroup BLE_GATTS_OPS GATT Server Operations
00131  * @{ */
00132 #define BLE_GATTS_OP_INVALID                0x00  /**< Invalid Operation. */
00133 #define BLE_GATTS_OP_WRITE_REQ              0x01  /**< Write Request. */
00134 #define BLE_GATTS_OP_WRITE_CMD              0x02  /**< Write Command. */
00135 #define BLE_GATTS_OP_SIGN_WRITE_CMD         0x03  /**< Signed Write Command. */
00136 #define BLE_GATTS_OP_PREP_WRITE_REQ         0x04  /**< Prepare Write Request. */
00137 #define BLE_GATTS_OP_EXEC_WRITE_REQ_CANCEL  0x05  /**< Execute Write Request: Cancel all prepared writes. */
00138 #define BLE_GATTS_OP_EXEC_WRITE_REQ_NOW     0x06  /**< Execute Write Request: Immediately execute all prepared writes. */
00139 /** @} */
00140 
00141 /** @defgroup BLE_GATTS_VLOCS GATT Value Locations
00142  * @{ */
00143 #define BLE_GATTS_VLOC_INVALID       0x00  /**< Invalid Location. */
00144 #define BLE_GATTS_VLOC_STACK         0x01  /**< Attribute Value is located in stack memory, no user memory is required. */
00145 #define BLE_GATTS_VLOC_USER          0x02  /**< Attribute Value is located in user memory. This requires the user to maintain a valid buffer through the lifetime of the attribute, since the stack
00146                                                 will read and write directly to the memory using the pointer provided in the APIs. There are no alignment requirements for the buffer. */
00147 /** @} */
00148 
00149 /** @defgroup BLE_GATTS_AUTHORIZE_TYPES GATT Server Authorization Types
00150  * @{ */
00151 #define BLE_GATTS_AUTHORIZE_TYPE_INVALID    0x00  /**< Invalid Type. */
00152 #define BLE_GATTS_AUTHORIZE_TYPE_READ       0x01  /**< Authorize a Read Operation. */
00153 #define BLE_GATTS_AUTHORIZE_TYPE_WRITE      0x02  /**< Authorize a Write Request Operation. */
00154 /** @} */
00155 
00156 /** @defgroup BLE_GATTS_SYS_ATTR_FLAGS System Attribute Flags
00157  * @{ */
00158 #define BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS (1 << 0)  /**< Restrict system attributes to system services only. */
00159 #define BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS (1 << 1)  /**< Restrict system attributes to user services only. */
00160 /** @} */
00161 
00162 /** @defgroup BLE_GATTS_ATTR_TAB_SIZE Attribute Table size
00163  * @{
00164  */
00165 #define BLE_GATTS_ATTR_TAB_SIZE_MIN         216    /**< Minimum Attribute Table size */
00166 #define BLE_GATTS_ATTR_TAB_SIZE_DEFAULT     0x0000 /**< Default Attribute Table size (0x580 bytes for this version of the SoftDevice). */
00167 /** @} */
00168 
00169 /** @} */
00170 
00171 /** @addtogroup BLE_GATTS_STRUCTURES Structures
00172  * @{ */
00173 
00174 /**
00175  * @brief BLE GATTS initialization parameters.
00176  */
00177 typedef struct
00178 {
00179   uint8_t   service_changed:1;             /**< Include the Service Changed characteristic in the Attribute Table. */
00180   uint32_t  attr_tab_size;                 /**< Attribute Table size in bytes. The size must be a multiple of 4. @ref BLE_GATTS_ATTR_TAB_SIZE_DEFAULT is used to set the default size. */
00181 } ble_gatts_enable_params_t;
00182 
00183 /**@brief Attribute metadata. */
00184 typedef struct
00185 {
00186   ble_gap_conn_sec_mode_t read_perm;       /**< Read permissions. */
00187   ble_gap_conn_sec_mode_t write_perm;      /**< Write permissions. */
00188   uint8_t                 vlen       :1;   /**< Variable length attribute. */
00189   uint8_t                 vloc       :2;   /**< Value location, see @ref BLE_GATTS_VLOCS.*/
00190   uint8_t                 rd_auth    :1;   /**< Read authorization and value will be requested from the application on every read operation. */
00191   uint8_t                 wr_auth    :1;   /**< Write authorization will be requested from the application on every Write Request operation (but not Write Command). */
00192 } ble_gatts_attr_md_t;
00193 
00194 
00195 /**@brief GATT Attribute. */
00196 typedef struct
00197 {
00198   ble_uuid_t          *p_uuid;          /**< Pointer to the attribute UUID. */
00199   ble_gatts_attr_md_t *p_attr_md;       /**< Pointer to the attribute metadata structure. */
00200   uint16_t             init_len;        /**< Initial attribute value length in bytes. */
00201   uint16_t             init_offs;       /**< Initial attribute value offset in bytes. If different from zero, the first init_offs bytes of the attribute value will be left uninitialized. */
00202   uint16_t             max_len;         /**< Maximum attribute value length in bytes, see @ref BLE_GATTS_ATTR_LENS_MAX for maximum values. */
00203   uint8_t*             p_value;         /**< Pointer to the attribute data. Please note that if the @ref BLE_GATTS_VLOC_USER value location is selected in the attribute metadata, this will have to point to a buffer
00204                                              that remains valid through the lifetime of the attribute. This excludes usage of automatic variables that may go out of scope or any other temporary location.
00205                                              The stack may access that memory directly without the application's knowledge. For writable characteristics, this value must not be a location in flash memory.*/
00206 } ble_gatts_attr_t;
00207 
00208 /**@brief GATT Attribute Value. */
00209 typedef struct
00210 {
00211   uint16_t  len;        /**< Length in bytes to be written or read. Length in bytes written or read after successful return.*/
00212   uint16_t  offset;     /**< Attribute value offset. */
00213   uint8_t   *p_value;   /**< Pointer to where value is stored or will be stored.
00214                              If value is stored in user memory, only the attribute length is updated when p_value == NULL.
00215                              Set to NULL when reading to obtain the complete length of the attribute value */
00216 } ble_gatts_value_t;
00217 
00218 
00219 /**@brief GATT Characteristic Presentation Format. */
00220 typedef struct
00221 {
00222   uint8_t          format;      /**< Format of the value, see @ref BLE_GATT_CPF_FORMATS. */
00223   int8_t           exponent;    /**< Exponent for integer data types. */
00224   uint16_t         unit;        /**< Unit from Bluetooth Assigned Numbers. */
00225   uint8_t          name_space;  /**< Namespace from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */
00226   uint16_t         desc;        /**< Namespace description from Bluetooth Assigned Numbers, see @ref BLE_GATT_CPF_NAMESPACES. */
00227 } ble_gatts_char_pf_t;
00228 
00229 
00230 /**@brief GATT Characteristic metadata. */
00231 typedef struct
00232 {
00233   ble_gatt_char_props_t       char_props;               /**< Characteristic Properties. */
00234   ble_gatt_char_ext_props_t   char_ext_props;           /**< Characteristic Extended Properties. */
00235   uint8_t                    *p_char_user_desc;         /**< Pointer to a UTF-8 encoded string (non-NULL terminated), NULL if the descriptor is not required. */
00236   uint16_t                    char_user_desc_max_size;  /**< The maximum size in bytes of the user description descriptor. */
00237   uint16_t                    char_user_desc_size;      /**< The size of the user description, must be smaller or equal to char_user_desc_max_size. */
00238   ble_gatts_char_pf_t*        p_char_pf;                /**< Pointer to a presentation format structure or NULL if the CPF descriptor is not required. */
00239   ble_gatts_attr_md_t*        p_user_desc_md;           /**< Attribute metadata for the User Description descriptor, or NULL for default values. */
00240   ble_gatts_attr_md_t*        p_cccd_md;                /**< Attribute metadata for the Client Characteristic Configuration Descriptor, or NULL for default values. */
00241   ble_gatts_attr_md_t*        p_sccd_md;                /**< Attribute metadata for the Server Characteristic Configuration Descriptor, or NULL for default values. */
00242 } ble_gatts_char_md_t;
00243 
00244 
00245 /**@brief GATT Characteristic Definition Handles. */
00246 typedef struct
00247 {
00248   uint16_t          value_handle;       /**< Handle to the characteristic value. */
00249   uint16_t          user_desc_handle;   /**< Handle to the User Description descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */
00250   uint16_t          cccd_handle;        /**< Handle to the Client Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */
00251   uint16_t          sccd_handle;        /**< Handle to the Server Characteristic Configuration Descriptor, or @ref BLE_GATT_HANDLE_INVALID if not present. */
00252 } ble_gatts_char_handles_t;
00253 
00254 
00255 /**@brief GATT HVx parameters. */
00256 typedef struct
00257 {
00258   uint16_t          handle;             /**< Characteristic Value Handle. */
00259   uint8_t           type;               /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */
00260   uint16_t          offset;             /**< Offset within the attribute value. */
00261   uint16_t         *p_len;              /**< Length in bytes to be written, length in bytes written after successful return. */
00262   uint8_t          *p_data;             /**< Actual data content, use NULL to use the current attribute value. */
00263 } ble_gatts_hvx_params_t;
00264 
00265 /**@brief GATT Authorization parameters. */
00266 typedef struct
00267 {
00268   uint16_t          gatt_status;        /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */
00269   uint8_t           update : 1;         /**< If set, data supplied in p_data will be used to update the attribute value.
00270                                              Please note that for @ref BLE_GATTS_OP_WRITE_REQ operations this bit must always be set,
00271                                              as the data to be written needs to be stored and later provided by the application. */
00272   uint16_t          offset;             /**< Offset of the attribute value being updated. */
00273   uint16_t          len;                /**< Length in bytes of the value in p_data pointer, see @ref BLE_GATTS_ATTR_LENS_MAX. */
00274   const uint8_t    *p_data;             /**< Pointer to new value used to update the attribute value. */
00275 } ble_gatts_authorize_params_t;
00276 
00277 /**@brief GATT Read or Write Authorize Reply parameters. */
00278 typedef struct
00279 {
00280   uint8_t                               type;   /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */
00281   union {
00282     ble_gatts_authorize_params_t        read;   /**< Read authorization parameters. */
00283     ble_gatts_authorize_params_t        write;  /**< Write authorization parameters. */
00284   } params;                                     /**< Reply Parameters. */
00285 } ble_gatts_rw_authorize_reply_params_t;
00286 
00287 
00288 
00289 /**@brief Event structure for @ref BLE_GATTS_EVT_WRITE. */
00290 typedef struct
00291 {
00292   uint16_t                    handle;             /**< Attribute Handle. */
00293   ble_uuid_t                  uuid;               /**< Attribute UUID. */
00294   uint8_t                     op;                 /**< Type of write operation, see @ref BLE_GATTS_OPS. */
00295   uint8_t                     auth_required;      /**< Writing operation deferred due to authorization requirement. Application may use @ref sd_ble_gatts_value_set to finalise the writing operation. */
00296   uint16_t                    offset;             /**< Offset for the write operation. */
00297   uint16_t                    len;                /**< Length of the received data. */
00298   uint8_t                     data[1];            /**< Received data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation.
00299                                                        See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */
00300 } ble_gatts_evt_write_t;
00301 
00302 /**@brief Event substructure for authorized read requests, see @ref ble_gatts_evt_rw_authorize_request_t. */
00303 typedef struct
00304 {
00305   uint16_t                    handle;             /**< Attribute Handle. */
00306   ble_uuid_t                  uuid;               /**< Attribute UUID. */
00307   uint16_t                    offset;             /**< Offset for the read operation. */
00308 } ble_gatts_evt_read_t;
00309 
00310 /**@brief Event structure for @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. */
00311 typedef struct
00312 {
00313   uint8_t                     type;             /**< Type of authorize operation, see @ref BLE_GATTS_AUTHORIZE_TYPES. */
00314   union {
00315     ble_gatts_evt_read_t      read;             /**< Attribute Read Parameters. */
00316     ble_gatts_evt_write_t     write;            /**< Attribute Write Parameters. */
00317   } request;                                    /**< Request Parameters. */
00318 } ble_gatts_evt_rw_authorize_request_t;
00319 
00320 /**@brief Event structure for @ref BLE_GATTS_EVT_SYS_ATTR_MISSING. */
00321 typedef struct
00322 {
00323   uint8_t hint;                                 /**< Hint (currently unused). */
00324 } ble_gatts_evt_sys_attr_missing_t;
00325 
00326 
00327 /**@brief Event structure for @ref BLE_GATTS_EVT_HVC. */
00328 typedef struct
00329 {
00330   uint16_t          handle;                       /**< Attribute Handle. */
00331 } ble_gatts_evt_hvc_t;
00332 
00333 /**@brief Event structure for @ref BLE_GATTS_EVT_TIMEOUT. */
00334 typedef struct
00335 {
00336   uint8_t          src;                       /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */
00337 } ble_gatts_evt_timeout_t;
00338 
00339 
00340 /**@brief GATT Server event callback event structure. */
00341 typedef struct
00342 {
00343   uint16_t conn_handle;                                       /**< Connection Handle on which the event occurred. */
00344   union
00345   {
00346     ble_gatts_evt_write_t                 write;              /**< Write Event Parameters. */
00347     ble_gatts_evt_rw_authorize_request_t  authorize_request;  /**< Read or Write Authorize Request Parameters. */
00348     ble_gatts_evt_sys_attr_missing_t      sys_attr_missing;   /**< System attributes missing. */
00349     ble_gatts_evt_hvc_t                   hvc;                /**< Handle Value Confirmation Event Parameters. */
00350     ble_gatts_evt_timeout_t               timeout;            /**< Timeout Event. */
00351   } params;                                                   /**< Event Parameters. */
00352 } ble_gatts_evt_t;
00353 
00354 /** @} */
00355 
00356 /** @addtogroup BLE_GATTS_FUNCTIONS Functions
00357  * @{ */
00358 
00359 /**@brief Add a service declaration to the Attribute Table.
00360  *
00361  * @note Secondary Services are only relevant in the context of the entity that references them, it is therefore forbidden to
00362  *       add a secondary service declaration that is not referenced by another service later in the Attribute Table.
00363  *
00364  * @mscs
00365  * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC}
00366  * @endmscs
00367  *
00368  * @param[in] type      Toggles between primary and secondary services, see @ref BLE_GATTS_SRVC_TYPES.
00369  * @param[in] p_uuid    Pointer to service UUID.
00370  * @param[out] p_handle Pointer to a 16-bit word where the assigned handle will be stored.
00371  *
00372  * @retval ::NRF_SUCCESS Successfully added a service declaration.
00373  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00374  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, Vendor Specific UUIDs need to be present in the table.
00375  * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack.
00376  * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
00377  */
00378 SVCALL(SD_BLE_GATTS_SERVICE_ADD, uint32_t, sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle));
00379 
00380 
00381 /**@brief Add an include declaration to the Attribute Table.
00382  *
00383  * @note It is currently only possible to add an include declaration to the last added service (i.e. only sequential population is supported at this time).
00384  *
00385  * @note The included service must already be present in the Attribute Table prior to this call.
00386  *
00387  * @mscs
00388  * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC}
00389  * @endmscs
00390  *
00391  * @param[in] service_handle    Handle of the service where the included service is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
00392  * @param[in] inc_srvc_handle   Handle of the included service.
00393  * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored.
00394  *
00395  * @retval ::NRF_SUCCESS Successfully added an include declaration.
00396  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00397  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, handle values need to match previously added services.
00398  * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation.
00399  * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, self inclusions are not allowed.
00400  * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
00401  * @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
00402  */
00403 SVCALL(SD_BLE_GATTS_INCLUDE_ADD, uint32_t, sd_ble_gatts_include_add(uint16_t service_handle, uint16_t inc_srvc_handle, uint16_t *p_include_handle));
00404 
00405 
00406 /**@brief Add a characteristic declaration, a characteristic value declaration and optional characteristic descriptor declarations to the Attribute Table.
00407  *
00408  * @note It is currently only possible to add a characteristic to the last added service (i.e. only sequential population is supported at this time).
00409  *
00410  * @note Several restrictions apply to the parameters, such as matching permissions between the user description descriptor and the writeable auxiliaries bits,
00411  *       readable (no security) and writeable (selectable) CCCDs and SCCDs and valid presentation format values.
00412  *
00413  * @note If no metadata is provided for the optional descriptors, their permissions will be derived from the characteristic permissions.
00414  *
00415  * @mscs
00416  * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC}
00417  * @endmscs
00418  *
00419  * @param[in] service_handle    Handle of the service where the characteristic is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
00420  * @param[in] p_char_md         Characteristic metadata.
00421  * @param[in] p_attr_char_value Pointer to the attribute structure corresponding to the characteristic value.
00422  * @param[out] p_handles        Pointer to the structure where the assigned handles will be stored.
00423  *
00424  * @retval ::NRF_SUCCESS Successfully added a characteristic.
00425  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00426  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, service handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints.
00427  * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a service context is required.
00428  * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack.
00429  * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
00430  * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX.
00431  */
00432 SVCALL(SD_BLE_GATTS_CHARACTERISTIC_ADD, uint32_t, sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const *p_char_md, ble_gatts_attr_t const *p_attr_char_value, ble_gatts_char_handles_t *p_handles));
00433 
00434 
00435 /**@brief Add a descriptor to the Attribute Table.
00436  *
00437  * @note It is currently only possible to add a descriptor to the last added characteristic (i.e. only sequential population is supported at this time).
00438  *
00439  * @mscs
00440  * @mmsc{@ref BLE_GATTS_ATT_TABLE_POP_MSC}
00441  * @endmscs
00442  *
00443  * @param[in] char_handle   Handle of the characteristic where the descriptor is to be placed, if @ref BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially.
00444  * @param[in] p_attr        Pointer to the attribute structure.
00445  * @param[out] p_handle     Pointer to a 16-bit word where the assigned handle will be stored.
00446  *
00447  * @retval ::NRF_SUCCESS Successfully added a descriptor.
00448  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00449  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, characteristic handle, Vendor Specific UUIDs, lengths, and permissions need to adhere to the constraints.
00450  * @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation, a characteristic context is required.
00451  * @retval ::NRF_ERROR_FORBIDDEN Forbidden value supplied, certain UUIDs are reserved for the stack.
00452  * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
00453  * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX.
00454  */
00455 SVCALL(SD_BLE_GATTS_DESCRIPTOR_ADD, uint32_t, sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const *p_attr, uint16_t *p_handle));
00456 
00457 /**@brief Set the value of a given attribute.
00458  *
00459  * @note Values other than system attributes can be set at any time, regardless of wheter any active connections exist.
00460  *
00461  * @mscs
00462  * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC}
00463  * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC}
00464  * @endmscs
00465  *
00466  * @param[in] conn_handle  Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used.
00467  * @param[in] handle       Attribute handle.
00468  * @param[in,out] p_value  Attribute value information.
00469  *
00470  * @retval ::NRF_SUCCESS Successfully set the value of the attribute.
00471  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00472  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
00473  * @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
00474  * @retval ::NRF_ERROR_FORBIDDEN Forbidden handle supplied, certain attributes are not modifiable by the application.
00475  * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, attribute lengths are restricted by @ref BLE_GATTS_ATTR_LENS_MAX.
00476  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
00477  * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute.
00478  */
00479 SVCALL(SD_BLE_GATTS_VALUE_SET, uint32_t, sd_ble_gatts_value_set(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value));
00480 
00481 /**@brief Get the value of a given attribute.
00482  *
00483  * @note                 If the attribute value is longer than the size of the supplied buffer,
00484  *                       p_len will return the total attribute value length (excluding offset),
00485  *                       and not the number of bytes actually returned in p_data.
00486  *                       The application may use this information to allocate a suitable buffer size.
00487  *
00488  * @note                 When retrieving system attribute values with this function, the connection handle
00489  *                       may refer to an already disconnected connection. Refer to the documentation of
00490  *                       @ref sd_ble_gatts_sys_attr_get for further information.
00491  *
00492  * @param[in] conn_handle  Connection handle. If the value does not belong to a system attribute then @ref BLE_CONN_HANDLE_INVALID can be used.
00493  * @param[in] handle       Attribute handle.
00494  * @param[in,out] p_value  Attribute value information.
00495  *
00496  * @retval ::NRF_SUCCESS Successfully retrieved the value of the attribute.
00497  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00498  * @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
00499  * @retval ::NRF_ERROR_INVALID_PARAM Invalid attribute offset supplied.
00500  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle supplied.
00501  * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE @ref BLE_CONN_HANDLE_INVALID supplied on a system attribute.
00502  */
00503 SVCALL(SD_BLE_GATTS_VALUE_GET, uint32_t, sd_ble_gatts_value_get(uint16_t conn_handle, uint16_t handle, ble_gatts_value_t *p_value));
00504 
00505 /**@brief Notify or Indicate an attribute value.
00506  *
00507  * @details This function checks for the relevant Client Characteristic Configuration descriptor value to verify that the relevant operation
00508  *          (notification or indication) has been enabled by the client. It is also able to update the attribute value before issuing the PDU, so that
00509  *          the application can atomically perform a value update and a server initiated transaction with a single API call.
00510  *          If the application chooses to indicate an attribute value, a @ref BLE_GATTS_EVT_HVC event will be issued as soon as the confirmation arrives from
00511  *          the peer.
00512  *
00513  * @note    The local attribute value may be updated even if an outgoing packet is not sent to the peer due to an error during execution.
00514  *          When receiveing the error codes @ref NRF_ERROR_INVALID_STATE, @ref NRF_ERROR_BUSY, @ref BLE_ERROR_GATTS_SYS_ATTR_MISSING and
00515  *          @ref BLE_ERROR_NO_TX_PACKETS the Attribute Table has been updated.
00516  *          The caller can check whether the value has been updated by looking at the contents of *(p_hvx_params->p_len).
00517  *
00518  * @note    It is important to note that a notification will <b>consume an application buffer</b>, and will therefore
00519  *          generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. An indication on the other hand will use the
00520  *          standard server internal buffer and thus will only generate a @ref BLE_GATTS_EVT_HVC event as soon as the confirmation
00521  *          has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details.
00522  *
00523  * @events
00524  * @event{@ref BLE_EVT_TX_COMPLETE, Transmission complete.}
00525  * @event{@ref BLE_GATTS_EVT_HVC, Confirmation received from peer.}
00526  * @endevents
00527  *
00528  * @mscs
00529  * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC}
00530  * @mmsc{@ref BLE_GATTS_HVN_MSC}
00531  * @mmsc{@ref BLE_GATTS_HVI_MSC}
00532  * @mmsc{@ref BLE_GATTS_HVX_DISABLED_MSC}
00533  * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC}
00534  * @endmscs
00535  *
00536  * @param[in] conn_handle  Connection handle.
00537  * @param[in] p_hvx_params Pointer to an HVx parameters structure. If the p_data member contains a non-NULL pointer the attribute value will be updated with
00538  *                         the contents pointed by it before sending the notification or indication.
00539  *
00540  * @retval ::NRF_SUCCESS Successfully queued a notification or indication for transmission, and optionally updated the attribute value.
00541  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00542  * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD.
00543  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00544  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
00545  * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied. Only attributes added directly by the application are available to notify and indicate.
00546  * @retval ::BLE_ERROR_GATTS_INVALID_ATTR_TYPE Invalid attribute type(s) supplied, only characteristic values may be notified and indicated.
00547  * @retval ::NRF_ERROR_NOT_FOUND Attribute not found.
00548  * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
00549  * @retval ::NRF_ERROR_BUSY Procedure already in progress.
00550  * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
00551  * @retval ::BLE_ERROR_NO_TX_PACKETS  No available application packets for this connection, applies only to notifications.
00552  */
00553 SVCALL(SD_BLE_GATTS_HVX, uint32_t, sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const *p_hvx_params));
00554 
00555 /**@brief Indicate the Service Changed attribute value.
00556  *
00557  * @details This call will send a Handle Value Indication to one or more peers connected to inform them that the Attribute
00558  *          Table layout has changed. As soon as the peer has confirmed the indication, a @ref BLE_GATTS_EVT_SC_CONFIRM event will
00559  *          be issued.
00560  *
00561  * @note    Some of the restrictions and limitations that apply to @ref sd_ble_gatts_hvx also apply here.
00562  *
00563  * @events
00564  * @event{@ref BLE_GATTS_EVT_SC_CONFIRM, Confirmation of attribute table change received from peer.}
00565  * @endevents
00566  *
00567  * @mscs
00568  * @mmsc{@ref BLE_GATTS_SC_MSC}
00569  * @endmscs
00570  *
00571  * @param[in] conn_handle  Connection handle.
00572  * @param[in] start_handle Start of affected attribute handle range.
00573  * @param[in] end_handle   End of affected attribute handle range.
00574  *
00575  * @retval ::NRF_SUCCESS Successfully queued the Service Changed indication for transmission.
00576  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00577  * @retval ::NRF_ERROR_NOT_SUPPORTED Service Changed not enabled at initialization. See @ref sd_ble_enable and @ref ble_gatts_enable_params_t.
00578  * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or notifications and/or indications not enabled in the CCCD.
00579  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
00580  * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle(s) supplied, handles must be in the range populated by the application.
00581  * @retval ::NRF_ERROR_BUSY Procedure already in progress.
00582  * @retval ::BLE_ERROR_GATTS_SYS_ATTR_MISSING System attributes missing, use @ref sd_ble_gatts_sys_attr_set to set them to a known value.
00583  */
00584 SVCALL(SD_BLE_GATTS_SERVICE_CHANGED, uint32_t, sd_ble_gatts_service_changed(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle));
00585 
00586 /**@brief Respond to a Read/Write authorization request.
00587  *
00588  * @note This call should only be used as a response to a @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event issued to the application.
00589  *
00590  * @mscs
00591  * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_AUTH_MSC}
00592  * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_BUF_AUTH_MSC}
00593  * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_NOAUTH_MSC}
00594  * @mmsc{@ref BLE_GATTS_READ_REQ_AUTH_MSC}
00595  * @mmsc{@ref BLE_GATTS_WRITE_REQ_AUTH_MSC}
00596  * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_QUEUE_FULL_MSC}
00597  * @mmsc{@ref BLE_GATTS_QUEUED_WRITE_NOBUF_PEER_CANCEL_MSC}
00598  * @endmscs
00599  *
00600  * @param[in] conn_handle                 Connection handle.
00601  * @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application.
00602  *
00603  * @retval ::NRF_SUCCESS               Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated.
00604  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00605  * @retval ::NRF_ERROR_INVALID_ADDR    Invalid pointer supplied.
00606  * @retval ::NRF_ERROR_INVALID_STATE   Invalid Connection State or no authorization request pending.
00607  * @retval ::NRF_ERROR_INVALID_PARAM   Authorization op invalid,
00608  *                                         handle supplied does not match requested handle,
00609  *                                         or invalid data to be written provided by the application.
00610  * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time.
00611  */
00612 SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params));
00613 
00614 
00615 /**@brief Update persistent system attribute information.
00616  *
00617  * @details Supply information about persistent system attributes to the stack,
00618  *          previously obtained using @ref sd_ble_gatts_sys_attr_get.
00619  *          This call is only allowed for active connections, and is usually
00620  *          made immediately after a connection is established with an known bonded device,
00621  *          often as a response to a @ref BLE_GATTS_EVT_SYS_ATTR_MISSING.
00622  *
00623  *          p_sysattrs may point directly to the application's stored copy of the system attributes
00624  *          obtained using @ref sd_ble_gatts_sys_attr_get.
00625  *          If the pointer is NULL, the system attribute info is initialized, assuming that
00626  *          the application does not have any previously saved system attribute data for this device.
00627  *
00628  * @note The state of persistent system attributes is reset upon connection establishment and then remembered for its duration.
00629  *
00630  * @note If this call returns with an error code different from @ref NRF_SUCCESS, the storage of persistent system attributes may have been completed only partially.
00631  *       This means that the state of the attribute table is undefined, and the application should either provide a new set of attributes using this same call or
00632  *       reset the SoftDevice to return to a known state.
00633  *
00634  * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be modified.
00635  * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be modified.
00636  *
00637  * @mscs
00638  * @mmsc{@ref BLE_GATTS_HVX_SYS_ATTRS_MISSING_MSC}
00639  * @mmsc{@ref BLE_GATTS_SYS_ATTRS_UNK_PEER_MSC}
00640  * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC}
00641  * @endmscs
00642  *
00643  * @param[in]  conn_handle        Connection handle.
00644  * @param[in]  p_sys_attr_data    Pointer to a saved copy of system attributes supplied to the stack, or NULL.
00645  * @param[in]  len                Size of data pointed by p_sys_attr_data, in octets.
00646  * @param[in]  flags              Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS
00647  *
00648  * @retval ::NRF_SUCCESS Successfully set the system attribute information.
00649  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00650  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00651  * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State.
00652  * @retval ::NRF_ERROR_INVALID_DATA Invalid data supplied, the data should be exactly the same as retrieved with @ref sd_ble_gatts_sys_attr_get.
00653  * @retval ::NRF_ERROR_NO_MEM Not enough memory to complete operation.
00654  * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time.
00655  */
00656 SVCALL(SD_BLE_GATTS_SYS_ATTR_SET, uint32_t, sd_ble_gatts_sys_attr_set(uint16_t conn_handle, uint8_t const *p_sys_attr_data, uint16_t len, uint32_t flags));
00657 
00658 
00659 /**@brief Retrieve persistent system attribute information from the stack.
00660  *
00661  * @details This call is used to retrieve information about values to be stored perisistently by the application
00662  *          during the lifetime of a connection or after it has been terminated. When a new connection is established with the same bonded device,
00663  *          the system attribute information retrieved with this function should be restored using using @ref sd_ble_gatts_sys_attr_set.
00664  *          If retrieved after disconnection, the data should be read before a new connection established. The connection handle for
00665  *          the previous, now disconnected, connection will remain valid until a new one is created to allow this API call to refer to it.
00666  *          Connection handles belonging to active connections can be used as well, but care should be taken since the system attributes
00667  *          may be written to at any time by the peer during a connection's lifetime.
00668  *
00669  * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_SYS_SRVCS is used with this function, only the system attributes included in system services will be returned.
00670  * @note When the @ref BLE_GATTS_SYS_ATTR_FLAG_USR_SRVCS is used with this function, only the system attributes included in user services will be returned.
00671  *
00672  * @mscs
00673  * @mmsc{@ref BLE_GATTS_SYS_ATTRS_BONDED_PEER_MSC}
00674  * @endmscs
00675  *
00676  * @param[in]     conn_handle       Connection handle of the recently terminated connection.
00677  * @param[out]    p_sys_attr_data   Pointer to a buffer where updated information about system attributes will be filled in. The format of the data is described
00678  *                                  in @ref BLE_GATTS_SYS_ATTRS_FORMAT. NULL can be provided to obtain the length of the data.
00679  * @param[in,out] p_len             Size of application buffer if p_sys_attr_data is not NULL. Unconditially updated to actual length of system attribute data.
00680  * @param[in]     flags             Optional additional flags, see @ref BLE_GATTS_SYS_ATTR_FLAGS
00681  *
00682  * @retval ::NRF_SUCCESS Successfully retrieved the system attribute information.
00683  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00684  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00685  * @retval ::NRF_ERROR_DATA_SIZE The system attribute information did not fit into the provided buffer.
00686  * @retval ::NRF_ERROR_NOT_FOUND No system attributes found.
00687  */
00688 SVCALL(SD_BLE_GATTS_SYS_ATTR_GET, uint32_t, sd_ble_gatts_sys_attr_get(uint16_t conn_handle, uint8_t *p_sys_attr_data, uint16_t *p_len, uint32_t flags));
00689 
00690 
00691 /**@brief Retrieve the first valid user attribute handle.
00692  *
00693  * @param[out] p_handle   Pointer to an integer where the handle will be stored.
00694  *
00695  * @retval ::NRF_SUCCESS Successfully retrieved the handle.
00696  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00697  */
00698 SVCALL(SD_BLE_GATTS_INITIAL_USER_HANDLE_GET, uint32_t, sd_ble_gatts_initial_user_handle_get(uint16_t *p_handle));
00699 
00700 /**@brief Retrieve the attribute UUID and/or metadata.
00701  *
00702  * @param[in]  handle Attribute handle
00703  * @param[out] p_uuid UUID of the attribute. Use NULL to omit this field.
00704  * @param[out] p_md Metadata of the attribute. Use NULL to omit this field.
00705  *
00706  * @retval ::NRF_SUCCESS Successfully retrieved the attribute metadata,
00707  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00708  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameters supplied. Returned when both @c p_uuid and @c p_md are NULL.
00709  * @retval ::NRF_ERROR_NOT_FOUND Attribute was not found.
00710  */
00711 SVCALL(SD_BLE_GATTS_ATTR_GET, uint32_t, sd_ble_gatts_attr_get(uint16_t handle, ble_uuid_t * p_uuid, ble_gatts_attr_md_t * p_md));
00712 
00713 /** @} */
00714 
00715 #ifdef __cplusplus
00716 }
00717 #endif
00718 #endif // BLE_GATTS_H__
00719 
00720 /**
00721   @}
00722 */
00723