David Kester / nRF51822

Dependents:   GonioTrainer

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble.h Source File

ble.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_COMMON BLE SoftDevice Common
00039   @{
00040   @defgroup ble_api Events, type definitions and API calls
00041   @{
00042 
00043   @brief Module independent events, type definitions and API calls for the BLE SoftDevice.
00044 
00045  */
00046 
00047 #ifndef BLE_H__
00048 #define BLE_H__
00049 
00050 #include "ble_ranges.h"
00051 #include "ble_types.h"
00052 #include "ble_gap.h"
00053 #include "ble_l2cap.h"
00054 #include "ble_gatt.h"
00055 #include "ble_gattc.h"
00056 #include "ble_gatts.h"
00057 
00058 /** @addtogroup BLE_COMMON_ENUMERATIONS Enumerations
00059  * @{ */
00060 
00061 /**
00062  * @brief Common API SVC numbers.
00063  */
00064 enum BLE_COMMON_SVCS
00065 {
00066   SD_BLE_ENABLE = BLE_SVC_BASE,         /**< Enable and initialize the BLE stack */
00067   SD_BLE_EVT_GET,                       /**< Get an event from the pending events queue. */
00068   SD_BLE_TX_BUFFER_COUNT_GET,           /**< Get the total number of available application transmission buffers from the BLE stack. */
00069   SD_BLE_UUID_VS_ADD,                   /**< Add a Vendor Specific UUID. */
00070   SD_BLE_UUID_DECODE,                   /**< Decode UUID bytes. */
00071   SD_BLE_UUID_ENCODE,                   /**< Encode UUID bytes. */
00072   SD_BLE_VERSION_GET,                   /**< Get the local version information (company id, Link Layer Version, Link Layer Subversion). */
00073   SD_BLE_USER_MEM_REPLY,                /**< User Memory Reply. */
00074   SD_BLE_OPT_SET,                       /**< Set a BLE option. */
00075   SD_BLE_OPT_GET,                       /**< Get a BLE option. */
00076 };
00077 
00078 /**
00079  * @brief BLE Module Independent Event IDs.
00080  */
00081 enum BLE_COMMON_EVTS
00082 {
00083   BLE_EVT_TX_COMPLETE  = BLE_EVT_BASE,  /**< Transmission Complete. @ref ble_evt_tx_complete_t */
00084   BLE_EVT_USER_MEM_REQUEST,             /**< User Memory request. @ref ble_evt_user_mem_request_t */
00085   BLE_EVT_USER_MEM_RELEASE              /**< User Memory release. @ref ble_evt_user_mem_release_t */
00086 };
00087 
00088 /**@brief Common Option IDs.
00089  * IDs that uniquely identify a common option.
00090  */
00091 enum BLE_COMMON_OPTS
00092 {
00093   BLE_COMMON_OPT_RADIO_CPU_MUTEX = BLE_OPT_BASE    /**< Radio CPU mutex option. @ref ble_common_opt_radio_cpu_mutex_t */
00094 };
00095 /** @} */
00096 
00097 /** @addtogroup BLE_COMMON_DEFINES Defines
00098  * @{ */
00099 
00100 /** @brief  Required pointer alignment for BLE Events.
00101 */
00102 #define BLE_EVTS_PTR_ALIGNMENT    4
00103 
00104 /** @defgroup BLE_USER_MEM_TYPES User Memory Types
00105  * @{ */
00106 #define BLE_USER_MEM_TYPE_INVALID               0x00  /**< Invalid User Memory Types. */
00107 #define BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES   0x01  /**< User Memory for GATTS queued writes. */
00108 /** @} */
00109 
00110 /** @brief  Maximum number of Vendor Specific UUIDs.
00111 */
00112 #define BLE_UUID_VS_MAX_COUNT     10
00113 
00114 /** @} */
00115 
00116 /** @addtogroup BLE_COMMON_STRUCTURES Structures
00117  * @{ */
00118 
00119 /**@brief User Memory Block. */
00120 typedef struct
00121 {
00122   uint8_t          *p_mem;      /**< Pointer to the start of the user memory block. */
00123   uint16_t          len;        /**< Length in bytes of the user memory block. */
00124 } ble_user_mem_block_t;
00125 
00126 /**
00127  * @brief Event structure for @ref BLE_EVT_TX_COMPLETE.
00128  */
00129 typedef struct
00130 {
00131   uint8_t count;                        /**< Number of packets transmitted. */
00132 } ble_evt_tx_complete_t;
00133 
00134 /**@brief Event structure for @ref BLE_EVT_USER_MEM_REQUEST. */
00135 typedef struct
00136 {
00137   uint8_t                     type;     /**< User memory type, see @ref BLE_USER_MEM_TYPES. */
00138 } ble_evt_user_mem_request_t;
00139 
00140 /**@brief Event structure for @ref BLE_EVT_USER_MEM_RELEASE. */
00141 typedef struct
00142 {
00143   uint8_t                     type;       /**< User memory type, see @ref BLE_USER_MEM_TYPES. */
00144   ble_user_mem_block_t        mem_block;  /**< User memory block */
00145 } ble_evt_user_mem_release_t;
00146 
00147 
00148 /**@brief Event structure for events not associated with a specific function module. */
00149 typedef struct
00150 {
00151   uint16_t conn_handle;                 /**< Connection Handle on which this event occurred. */
00152   union
00153   {
00154     ble_evt_tx_complete_t           tx_complete;        /**< Transmission Complete. */
00155     ble_evt_user_mem_request_t      user_mem_request;   /**< User Memory Request Event Parameters. */
00156     ble_evt_user_mem_release_t      user_mem_release;   /**< User Memory Release Event Parameters. */
00157   } params;
00158 } ble_common_evt_t;
00159 
00160 /**@brief BLE Event header. */
00161 typedef struct
00162 {
00163   uint16_t evt_id;                      /**< Value from a BLE_<module>_EVT series. */
00164   uint16_t evt_len;                     /**< Length in octets excluding this header. */
00165 } ble_evt_hdr_t;
00166 
00167 /**@brief Common BLE Event type, wrapping the module specific event reports. */
00168 typedef struct
00169 {
00170   ble_evt_hdr_t header;                 /**< Event header. */
00171   union
00172   {
00173     ble_common_evt_t  common_evt;         /**< Common Event, evt_id in BLE_EVT_* series. */
00174     ble_gap_evt_t     gap_evt;            /**< GAP originated event, evt_id in BLE_GAP_EVT_* series. */
00175     ble_l2cap_evt_t   l2cap_evt;          /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */
00176     ble_gattc_evt_t   gattc_evt;          /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */
00177     ble_gatts_evt_t   gatts_evt;          /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */
00178   } evt;
00179 } ble_evt_t;
00180 
00181 
00182 /**
00183  * @brief Version Information.
00184  */
00185 typedef struct
00186 {
00187   uint8_t   version_number;             /**< Link Layer Version number for BT 4.1 spec is 7 (https://www.bluetooth.org/en-us/specification/assigned-numbers/link-layer). */
00188   uint16_t  company_id;                 /**< Company ID, Nordic Semiconductor's company ID is 89 (0x0059) (https://www.bluetooth.org/apps/content/Default.aspx?doc_id=49708). */
00189   uint16_t  subversion_number;          /**< Link Layer Sub Version number, corresponds to the SoftDevice Config ID or Firmware ID (FWID). */
00190 } ble_version_t;
00191 
00192 /**@brief Mutual exclusion of radio activity and CPU execution.
00193  *
00194  *        This option configures the application's access to the CPU when the radio is active. The
00195  *        application can configure itself to be blocked from using the CPU while the radio is
00196  *        active. By default, the application will be able to share CPU time with the SoftDevice
00197  *        during radio activity. This parameter structure is used together with @ref sd_ble_opt_set
00198  *        to configure the @ref BLE_COMMON_OPT_RADIO_CPU_MUTEX option.
00199  *
00200  * @note  Note that the application should use this option to configure the SoftDevice to block the
00201  *        CPU during radio activity (i.e enable mutual exclusion) when running the SoftDevice on
00202  *        hardware affected by PAN #44 "CCM may exceed real time requirements"and PAN #45 "AAR may
00203  *        exceed real time requirements".
00204  *
00205  * @note  Note that when acting as a scanner, the mutex is only enabled for radio TX activity.
00206  *
00207  * @note  @ref sd_ble_opt_get is not supported for this option.
00208  *
00209  */
00210 typedef struct
00211 {
00212   uint8_t enable : 1;                          /**< Enable mutual exclusion of radio activity and the CPU execution. */
00213 } ble_common_opt_radio_cpu_mutex_t;
00214 
00215 /**@brief Option structure for common options. */
00216 typedef union
00217 {
00218   ble_common_opt_radio_cpu_mutex_t  radio_cpu_mutex;        /**< Parameters for the option for the mutual exclusion of radio activity and CPU execution. */
00219 } ble_common_opt_t;
00220 
00221 /**@brief Common BLE Option type, wrapping the module specific options. */
00222 typedef union
00223 {
00224   ble_common_opt_t  common_opt;         /**< Common option, opt_id in BLE_COMMON_OPT_* series. */
00225   ble_gap_opt_t     gap_opt;            /**< GAP option, opt_id in BLE_GAP_OPT_* series. */
00226 } ble_opt_t;
00227 
00228 /**
00229  * @brief BLE GATTS init options
00230  */
00231 typedef struct
00232 {
00233   ble_gatts_enable_params_t  gatts_enable_params; /**< GATTS init options @ref ble_gatts_enable_params_t. */
00234 } ble_enable_params_t;
00235 
00236 /** @} */
00237 
00238 /** @addtogroup BLE_COMMON_FUNCTIONS Functions
00239  * @{ */
00240 
00241 /**@brief Enable the BLE stack
00242  *
00243  * @param[in] p_ble_enable_params Pointer to ble_enable_params_t
00244  *
00245  * @details This call initializes the BLE stack, no other BLE related function can be called before this one.
00246  *
00247  * @return @ref NRF_SUCCESS BLE the BLE stack has been initialized successfully
00248  * @retval @ref NRF_ERROR_INVALID_STATE the BLE stack had already been initialized and cannot be reinitialized.
00249  * @return @ref NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied.
00250  * @return @ref NRF_ERROR_INVALID_LENGTH The specified Attribute Table size is either too small or not a multiple of 4.
00251  *                                       The minimum acceptable size is defined by @ref BLE_GATTS_ATTR_TAB_SIZE_MIN.
00252  * @return @ref NRF_ERROR_NO_MEM         The Attribute Table size is too large. Decrease size in @ref ble_gatts_enable_params_t.
00253  */
00254 SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params));
00255 
00256 /**@brief Get an event from the pending events queue.
00257  *
00258  * @param[out] p_dest Pointer to buffer to be filled in with an event, or NULL to retrieve the event length. This buffer <b>must be 4-byte aligned in memory</b>.
00259  * @param[in, out] p_len Pointer the length of the buffer, on return it is filled with the event length.
00260  *
00261  * @details This call allows the application to pull a BLE event from the BLE stack. The application is signalled that an event is 
00262  * available from the BLE stack by the triggering of the SD_EVT_IRQn interrupt.
00263  * The application is free to choose whether to call this function from thread mode (main context) or directly from the Interrupt Service Routine
00264  * that maps to SD_EVT_IRQn. In any case however, and because the BLE stack runs at a higher priority than the application, this function should be called
00265  * in a loop (until @ref NRF_ERROR_NOT_FOUND is returned) every time SD_EVT_IRQn is raised to ensure that all available events are pulled from the BLE stack. 
00266  * Failure to do so could potentially leave events in the internal queue without the application being aware of this fact.
00267  * Sizing the p_dest buffer is equally important, since the application needs to provide all the memory necessary for the event to be copied into
00268  * application memory. If the buffer provided is not large enough to fit the entire contents of the event, @ref NRF_ERROR_DATA_SIZE will be returned
00269  * and the application can then call again with a larger buffer size.
00270  * Please note that because of the variable length nature of some events, sizeof(ble_evt_t) will not always be large enough to fit certain events, 
00271  * and so it is the application's responsibility to provide an amount of memory large enough so that the relevant event is copied in full.
00272  * The application may "peek" the event length by providing p_dest as a NULL pointer and inspecting the value of *p_len upon return.
00273  *
00274  * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT
00275  *
00276  * @retval ::NRF_SUCCESS Event pulled and stored into the supplied buffer.
00277  * @retval ::NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied.
00278  * @retval ::NRF_ERROR_NOT_FOUND No events ready to be pulled.
00279  * @retval ::NRF_ERROR_DATA_SIZE Event ready but could not fit into the supplied buffer.
00280  */
00281 SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t *p_dest, uint16_t *p_len));
00282 
00283 
00284 /**@brief Get the total number of available application transmission buffers per link in the BLE stack.
00285  *
00286  * @details This call allows the application to obtain the total number of
00287  *          transmission buffers available per link for application data. Please note that
00288  *          this does not give the number of free buffers, but rather the total amount of them.
00289  *          The application has two options to handle its own application transmission buffers:
00290  *          - Use a simple arithmetic calculation: at boot time the application should use this function
00291  *          to find out the total amount of buffers available to it and store it in a variable.
00292  *          Every time a packet that consumes an application buffer is sent using any of the 
00293  *          exposed functions in this BLE API, the application should decrement that variable.
00294  *          Conversely, whenever a @ref BLE_EVT_TX_COMPLETE event is received by the application
00295  *          it should retrieve the count field in such event and add that number to the same
00296  *          variable storing the number of available packets.
00297  *          This mechanism allows the application to be aware at any time of the number of
00298  *          application packets available in the BLE stack's internal buffers, and therefore
00299  *          it can know with certainty whether it is possible to send more data or it has to
00300  *          wait for a @ref BLE_EVT_TX_COMPLETE event before it proceeds.
00301  *          - Choose to simply not keep track of available buffers at all, and instead handle the 
00302  *          @ref BLE_ERROR_NO_TX_BUFFERS error by queueing the packet to be transmitted and 
00303  *          try again as soon as a @ref BLE_EVT_TX_COMPLETE event arrives.
00304  *
00305  *          The API functions that <b>may</b> consume an application buffer depending on 
00306  *          the parameters supplied to them can be found below:
00307  *
00308  *          - @ref sd_ble_gattc_write (write without response only)
00309  *          - @ref sd_ble_gatts_hvx (notifications only)
00310  *          - @ref sd_ble_l2cap_tx (all packets)
00311  *
00312  * @param[out] p_count Pointer to a uint8_t which will contain the number of application transmission buffers upon
00313  *                     successful return.
00314  *
00315  * @retval ::NRF_SUCCESS Number of application transmission buffers retrieved successfully.
00316  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00317  */
00318 SVCALL(SD_BLE_TX_BUFFER_COUNT_GET, uint32_t, sd_ble_tx_buffer_count_get(uint8_t *p_count));
00319 
00320 
00321 /**@brief Add a Vendor Specific UUID.
00322  *
00323  * @details This call enables the application to add a vendor specific UUID to the BLE stack's table,
00324  *          for later use all other modules and APIs. This then allows the application to use the shorter,
00325  *          24-bit @ref ble_uuid_t format when dealing with both 16-bit and 128-bit UUIDs without having to
00326  *          check for lengths and having split code paths. The way that this is accomplished is by extending the 
00327  *          grouping mechanism that the Bluetooth SIG standard base UUID uses for all other 128-bit UUIDs. The 
00328  *          type field in the @ref ble_uuid_t structure is an index (relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN) 
00329  *          to the table populated by multiple calls to this function, and the uuid field in the same structure 
00330  *          contains the 2 bytes at indices 12 and 13. The number of possible 128-bit UUIDs available to the 
00331  *          application is therefore the number of Vendor Specific UUIDs added with the help of this function times 65536, 
00332  *          although restricted to modifying bytes 12 and 13 for each of the entries in the supplied array.
00333  *
00334  * @note Bytes 12 and 13 of the provided UUID will not be used internally, since those are always replaced by 
00335  * the 16-bit uuid field in @ref ble_uuid_t.
00336  *
00337  *
00338  * @param[in]  p_vs_uuid    Pointer to a 16-octet (128-bit) little endian Vendor Specific UUID disregarding
00339  *                          bytes 12 and 13.
00340  * @param[out] p_uuid_type  Pointer to a uint8_t where the type field in @ref ble_uuid_t corresponding to this UUID will be stored.
00341  *
00342  * @retval ::NRF_SUCCESS Successfully added the Vendor Specific UUID.
00343  * @retval ::NRF_ERROR_INVALID_ADDR If p_vs_uuid or p_uuid_type is NULL or invalid.
00344  * @retval ::NRF_ERROR_NO_MEM If there are no more free slots for VS UUIDs.
00345  * @retval ::NRF_ERROR_FORBIDDEN If p_vs_uuid has already been added to the VS UUID table.
00346  */
00347 SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type));
00348 
00349 
00350 /** @brief Decode little endian raw UUID bytes (16-bit or 128-bit) into a 24 bit @ref ble_uuid_t structure.
00351  * 
00352  * @details The raw UUID bytes excluding bytes 12 and 13 (i.e. bytes 0-11 and 14-15) of p_uuid_le are compared 
00353  * to the corresponding ones in each entry of the table of vendor specific UUIDs populated with @ref sd_ble_uuid_vs_add 
00354  * to look for a match. If there is such a match, bytes 12 and 13 are returned as p_uuid->uuid and the index 
00355  * relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN as p_uuid->type. 
00356  *
00357  * @note If the UUID length supplied is 2, then the type set by this call will always be @ref BLE_UUID_TYPE_BLE.
00358  *
00359  * @param[in]      uuid_le_len Length in bytes of the buffer pointed to by p_uuid_le (must be 2 or 16 bytes).
00360  * @param[in]      p_uuid_le   Pointer pointing to little endian raw UUID bytes.
00361  * @param[out]  p_uuid      Pointer to a @ref ble_uuid_t structure to be filled in.
00362  *
00363  * @retval ::NRF_SUCCESS Successfully decoded into the @ref ble_uuid_t structure.
00364  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00365  * @retval ::NRF_ERROR_INVALID_LENGTH Invalid UUID length.
00366  * @retval ::NRF_ERROR_NOT_FOUND For a 128-bit UUID, no match in the populated table of UUIDs.
00367  */                                                 
00368 SVCALL(SD_BLE_UUID_DECODE, uint32_t, sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const *p_uuid_le, ble_uuid_t *p_uuid));
00369 
00370 
00371 /** @brief Encode a @ref ble_uuid_t structure into little endian raw UUID bytes (16-bit or 128-bit).
00372  *
00373  * @note The pointer to the destination buffer p_uuid_le may be NULL, in which case only the validity and size of p_uuid is computed.
00374  *
00375  * @param[in]      p_uuid        Pointer to a @ref ble_uuid_t structure that will be encoded into bytes.
00376  * @param[out]     p_uuid_le_len Pointer to a uint8_t that will be filled with the encoded length (2 or 16 bytes).
00377  * @param[out]     p_uuid_le     Pointer to a buffer where the little endian raw UUID bytes (2 or 16) will be stored.
00378  *
00379  * @retval ::NRF_SUCCESS Successfully encoded into the buffer.
00380  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00381  * @retval ::NRF_ERROR_INVALID_PARAM Invalid UUID type.
00382  */
00383 SVCALL(SD_BLE_UUID_ENCODE, uint32_t, sd_ble_uuid_encode(ble_uuid_t const *p_uuid, uint8_t *p_uuid_le_len, uint8_t *p_uuid_le));
00384 
00385 
00386 /**@brief Get Version Information.
00387  *
00388  * @details This call allows the application to get the BLE stack version information.
00389  *
00390  * @param[out] p_version Pointer to a ble_version_t structure to be filled in.
00391  *
00392  * @retval ::NRF_SUCCESS  Version information stored successfully.
00393  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00394  * @retval ::NRF_ERROR_BUSY The BLE stack is busy (typically doing a locally-initiated disconnection procedure).
00395  */
00396 SVCALL(SD_BLE_VERSION_GET, uint32_t, sd_ble_version_get(ble_version_t *p_version));
00397 
00398 
00399 /**@brief Provide a user memory block.
00400  *
00401  * @note This call can only be used as a response to a @ref BLE_EVT_USER_MEM_REQUEST event issued to the application.
00402  *
00403  * @param[in] conn_handle Connection handle.
00404  * @param[in,out] p_block Pointer to a user memory block structure.
00405  *
00406  * @retval ::NRF_SUCCESS Successfully queued a response to the peer.
00407  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00408  * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection state or no execute write request pending.
00409  * @retval ::NRF_ERROR_BUSY The BLE stack is busy. Retry at later time.
00410  */
00411 SVCALL(SD_BLE_USER_MEM_REPLY, uint32_t, sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block));
00412 
00413 /**@brief Set a BLE option.
00414  *
00415  * @details This call allows the application to set the value of an option.
00416  *
00417  * @param[in] opt_id Option ID.
00418  * @param[in] p_opt Pointer to a ble_opt_t structure containing the option value.
00419  *
00420  * @retval ::NRF_SUCCESS  Option set successfully.
00421  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00422  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00423  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
00424  * @retval ::NRF_ERROR_INVALID_STATE Unable to set the parameter at this time.
00425  * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed.
00426  */
00427 SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt));
00428 
00429 
00430 /**@brief Get a BLE option.
00431  *
00432  * @details This call allows the application to retrieve the value of an option.
00433  *
00434  * @param[in] opt_id Option ID.
00435  * @param[out] p_opt Pointer to a ble_opt_t structure to be filled in.
00436  *
00437  * @retval ::NRF_SUCCESS  Option retrieved successfully.
00438  * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
00439  * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
00440  * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
00441  * @retval ::NRF_ERROR_INVALID_STATE Unable to retrieve the parameter at this time.
00442  * @retval ::NRF_ERROR_BUSY The BLE stack is busy or the previous procedure has not completed.
00443  * @retval ::NRF_ERROR_NOT_SUPPORTED This option is not supported.
00444  *
00445  */
00446 SVCALL(SD_BLE_OPT_GET, uint32_t, sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt));
00447 
00448 /** @} */
00449 
00450 #endif /* BLE_H__ */
00451 
00452 /**
00453   @}
00454   @}
00455 */