来自中国的硬件平台

Dependents:   mbed_in_china_blink_led

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Tue Mar 18 12:30:07 2014 +0000
Revision:
123:8a356fb1000a
Parent:
targets/hal/TARGET_NORDIC/TARGET_NRF51822/Lib/s110_nrf51822_6.0.0/s110_nrf51822_6.0.0_API/include/ble.h@104:a6a92e2e5a92
Synchronized with git revision 3e40310534d854400e01b2e9612ef7edf44a2dc9

Full URL: https://github.com/mbedmicro/mbed/commit/3e40310534d854400e01b2e9612ef7edf44a2dc9/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 104:a6a92e2e5a92 1 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
mbed_official 104:a6a92e2e5a92 2 *
mbed_official 104:a6a92e2e5a92 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
mbed_official 104:a6a92e2e5a92 4 * copying, transfer or disclosure of such information is prohibited except by express written
mbed_official 104:a6a92e2e5a92 5 * agreement with Nordic Semiconductor.
mbed_official 104:a6a92e2e5a92 6 *
mbed_official 104:a6a92e2e5a92 7 */
mbed_official 104:a6a92e2e5a92 8 /**
mbed_official 104:a6a92e2e5a92 9 @addtogroup BLE_COMMON BLE SoftDevice Common
mbed_official 104:a6a92e2e5a92 10 @{
mbed_official 104:a6a92e2e5a92 11 @defgroup ble_api Events, type definitions and API calls
mbed_official 104:a6a92e2e5a92 12 @{
mbed_official 104:a6a92e2e5a92 13
mbed_official 104:a6a92e2e5a92 14 @brief Module independent events, type definitions and API calls for the S110 SoftDevice.
mbed_official 104:a6a92e2e5a92 15
mbed_official 104:a6a92e2e5a92 16 */
mbed_official 104:a6a92e2e5a92 17
mbed_official 104:a6a92e2e5a92 18 #ifndef BLE_H__
mbed_official 104:a6a92e2e5a92 19 #define BLE_H__
mbed_official 104:a6a92e2e5a92 20
mbed_official 104:a6a92e2e5a92 21 #include "ble_ranges.h"
mbed_official 104:a6a92e2e5a92 22 #include "ble_types.h"
mbed_official 104:a6a92e2e5a92 23 #include "ble_gap.h"
mbed_official 104:a6a92e2e5a92 24 #include "ble_l2cap.h"
mbed_official 104:a6a92e2e5a92 25 #include "ble_gatt.h"
mbed_official 104:a6a92e2e5a92 26 #include "ble_gattc.h"
mbed_official 104:a6a92e2e5a92 27 #include "ble_gatts.h"
mbed_official 104:a6a92e2e5a92 28
mbed_official 104:a6a92e2e5a92 29 /**
mbed_official 104:a6a92e2e5a92 30 * @brief Common API SVC numbers.
mbed_official 104:a6a92e2e5a92 31 */
mbed_official 104:a6a92e2e5a92 32 enum BLE_COMMON_SVCS
mbed_official 104:a6a92e2e5a92 33 {
mbed_official 104:a6a92e2e5a92 34 SD_BLE_EVT_GET = BLE_SVC_BASE, /**< Get an event from the pending events queue. */
mbed_official 104:a6a92e2e5a92 35 SD_BLE_TX_BUFFER_COUNT_GET, /**< Get the total number of available application transmission buffers from the stack. */
mbed_official 104:a6a92e2e5a92 36 SD_BLE_UUID_VS_ADD, /**< Add a Vendor Specific UUID. */
mbed_official 104:a6a92e2e5a92 37 SD_BLE_UUID_DECODE, /**< Decode UUID bytes. */
mbed_official 104:a6a92e2e5a92 38 SD_BLE_UUID_ENCODE, /**< Encode UUID bytes. */
mbed_official 104:a6a92e2e5a92 39 SD_BLE_VERSION_GET, /**< Get the local version information (company id, LMP Version, LMP Subversion). */
mbed_official 104:a6a92e2e5a92 40 SD_BLE_USER_MEM_REPLY, /**< User Memory Reply. */
mbed_official 104:a6a92e2e5a92 41 };
mbed_official 104:a6a92e2e5a92 42
mbed_official 104:a6a92e2e5a92 43 /** @brief Required pointer alignment for BLE Events.
mbed_official 104:a6a92e2e5a92 44 */
mbed_official 104:a6a92e2e5a92 45 #define BLE_EVTS_PTR_ALIGNMENT 4
mbed_official 104:a6a92e2e5a92 46
mbed_official 104:a6a92e2e5a92 47 /** @defgroup BLE_USER_MEM_TYPES User Memory Types
mbed_official 104:a6a92e2e5a92 48 * @{ */
mbed_official 104:a6a92e2e5a92 49 #define BLE_USER_MEM_TYPE_INVALID 0x00 /**< Invalid User Memory Types. */
mbed_official 104:a6a92e2e5a92 50 #define BLE_USER_MEM_TYPE_GATTS_QUEUED_WRITES 0x01 /**< User Memory for GATTS queued writes. */
mbed_official 104:a6a92e2e5a92 51 /** @} */
mbed_official 104:a6a92e2e5a92 52
mbed_official 104:a6a92e2e5a92 53 /** @brief Maximum number of Vendor Specific UUIDs.
mbed_official 104:a6a92e2e5a92 54 */
mbed_official 104:a6a92e2e5a92 55 #define BLE_UUID_VS_MAX_COUNT 10
mbed_official 104:a6a92e2e5a92 56
mbed_official 104:a6a92e2e5a92 57 /**
mbed_official 104:a6a92e2e5a92 58 * @brief BLE Module Independent Event IDs.
mbed_official 104:a6a92e2e5a92 59 */
mbed_official 104:a6a92e2e5a92 60 enum BLE_COMMON_EVTS
mbed_official 104:a6a92e2e5a92 61 {
mbed_official 104:a6a92e2e5a92 62 BLE_EVT_TX_COMPLETE = BLE_EVT_BASE, /**< Transmission Complete. */
mbed_official 104:a6a92e2e5a92 63 BLE_EVT_USER_MEM_REQUEST, /**< User Memory request. */
mbed_official 104:a6a92e2e5a92 64 BLE_EVT_USER_MEM_RELEASE /**< User Memory release. */
mbed_official 104:a6a92e2e5a92 65 };
mbed_official 104:a6a92e2e5a92 66
mbed_official 104:a6a92e2e5a92 67 /**@brief User Memory Block. */
mbed_official 104:a6a92e2e5a92 68 typedef struct
mbed_official 104:a6a92e2e5a92 69 {
mbed_official 104:a6a92e2e5a92 70 uint8_t* p_mem; /**< Pointer to the start of the user memory block. */
mbed_official 104:a6a92e2e5a92 71 uint16_t len; /**< Length in bytes of the user memory block. */
mbed_official 104:a6a92e2e5a92 72 } ble_user_mem_block_t;
mbed_official 104:a6a92e2e5a92 73
mbed_official 104:a6a92e2e5a92 74 /**
mbed_official 104:a6a92e2e5a92 75 * @brief TX complete event.
mbed_official 104:a6a92e2e5a92 76 */
mbed_official 104:a6a92e2e5a92 77 typedef struct
mbed_official 104:a6a92e2e5a92 78 {
mbed_official 104:a6a92e2e5a92 79 uint8_t count; /**< Number of packets transmitted. */
mbed_official 104:a6a92e2e5a92 80 } ble_evt_tx_complete_t;
mbed_official 104:a6a92e2e5a92 81
mbed_official 104:a6a92e2e5a92 82 /**@brief Event structure for BLE_EVT_USER_MEM_REQUEST. */
mbed_official 104:a6a92e2e5a92 83 typedef struct
mbed_official 104:a6a92e2e5a92 84 {
mbed_official 104:a6a92e2e5a92 85 uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */
mbed_official 104:a6a92e2e5a92 86 } ble_evt_user_mem_request_t;
mbed_official 104:a6a92e2e5a92 87
mbed_official 104:a6a92e2e5a92 88 /**@brief Event structure for BLE_EVT_USER_MEM_RELEASE. */
mbed_official 104:a6a92e2e5a92 89 typedef struct
mbed_official 104:a6a92e2e5a92 90 {
mbed_official 104:a6a92e2e5a92 91 uint8_t type; /**< User memory type, see @ref BLE_USER_MEM_TYPES. */
mbed_official 104:a6a92e2e5a92 92 ble_user_mem_block_t mem_block; /**< User memory block */
mbed_official 104:a6a92e2e5a92 93 } ble_evt_user_mem_release_t;
mbed_official 104:a6a92e2e5a92 94
mbed_official 104:a6a92e2e5a92 95
mbed_official 104:a6a92e2e5a92 96 /**@brief Event structure for events not associated with a specific function module. */
mbed_official 104:a6a92e2e5a92 97 typedef struct
mbed_official 104:a6a92e2e5a92 98 {
mbed_official 104:a6a92e2e5a92 99 uint16_t conn_handle; /**< Connection Handle on which this event occured. */
mbed_official 104:a6a92e2e5a92 100 union
mbed_official 104:a6a92e2e5a92 101 {
mbed_official 104:a6a92e2e5a92 102 ble_evt_tx_complete_t tx_complete; /**< Transmission Complete. */
mbed_official 104:a6a92e2e5a92 103 ble_evt_user_mem_request_t user_mem_request; /**< User Memory Request Event Parameters. */
mbed_official 104:a6a92e2e5a92 104 ble_evt_user_mem_release_t user_mem_release; /**< User Memory Release Event Parameters. */
mbed_official 104:a6a92e2e5a92 105 } params;
mbed_official 104:a6a92e2e5a92 106 } ble_common_evt_t;
mbed_official 104:a6a92e2e5a92 107
mbed_official 104:a6a92e2e5a92 108 /**@brief BLE Event header. */
mbed_official 104:a6a92e2e5a92 109 typedef struct
mbed_official 104:a6a92e2e5a92 110 {
mbed_official 104:a6a92e2e5a92 111 uint16_t evt_id; /**< Value from a BLE_<module>_EVT series. */
mbed_official 104:a6a92e2e5a92 112 uint16_t evt_len; /**< Length in octets excluding this header. */
mbed_official 104:a6a92e2e5a92 113 } ble_evt_hdr_t;
mbed_official 104:a6a92e2e5a92 114
mbed_official 104:a6a92e2e5a92 115 /**@brief Common BLE Event type, wrapping the module specific event reports. */
mbed_official 104:a6a92e2e5a92 116 typedef struct
mbed_official 104:a6a92e2e5a92 117 {
mbed_official 104:a6a92e2e5a92 118 ble_evt_hdr_t header; /**< Event header. */
mbed_official 104:a6a92e2e5a92 119 union
mbed_official 104:a6a92e2e5a92 120 {
mbed_official 104:a6a92e2e5a92 121 ble_common_evt_t common_evt; /**< Common Event, evt_id in BLE_EVT_* series. */
mbed_official 104:a6a92e2e5a92 122 ble_gap_evt_t gap_evt; /**< GAP originated event, evt_id in BLE_GAP_EVT_* series. */
mbed_official 104:a6a92e2e5a92 123 ble_l2cap_evt_t l2cap_evt; /**< L2CAP originated event, evt_id in BLE_L2CAP_EVT* series. */
mbed_official 104:a6a92e2e5a92 124 ble_gattc_evt_t gattc_evt; /**< GATT client originated event, evt_id in BLE_GATTC_EVT* series. */
mbed_official 104:a6a92e2e5a92 125 ble_gatts_evt_t gatts_evt; /**< GATT server originated event, evt_id in BLE_GATTS_EVT* series. */
mbed_official 104:a6a92e2e5a92 126 } evt;
mbed_official 104:a6a92e2e5a92 127 } ble_evt_t;
mbed_official 104:a6a92e2e5a92 128
mbed_official 104:a6a92e2e5a92 129
mbed_official 104:a6a92e2e5a92 130 /**
mbed_official 104:a6a92e2e5a92 131 * @brief Version Information.
mbed_official 104:a6a92e2e5a92 132 */
mbed_official 104:a6a92e2e5a92 133 typedef struct
mbed_official 104:a6a92e2e5a92 134 {
mbed_official 104:a6a92e2e5a92 135 uint8_t version_number; /**< LMP Version number for BT 4.0 spec is 6 (https://www.bluetooth.org/technical/assignednumbers/link_layer.htm). */
mbed_official 104:a6a92e2e5a92 136 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). */
mbed_official 104:a6a92e2e5a92 137 uint16_t subversion_number; /**< LMP Sub Version number corresponds to the SoftDevice Config ID. */
mbed_official 104:a6a92e2e5a92 138 } ble_version_t;
mbed_official 104:a6a92e2e5a92 139
mbed_official 104:a6a92e2e5a92 140
mbed_official 104:a6a92e2e5a92 141 /**@brief Get an event from the pending events queue.
mbed_official 104:a6a92e2e5a92 142 *
mbed_official 104:a6a92e2e5a92 143 * @param[in] 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>.
mbed_official 104:a6a92e2e5a92 144 * @param[in, out] p_len Pointer the length of the buffer, on return it is filled with the event length.
mbed_official 104:a6a92e2e5a92 145 *
mbed_official 104:a6a92e2e5a92 146 * @details This call allows the application to pull a BLE event from the BLE stack. The application is signalled that an event is
mbed_official 104:a6a92e2e5a92 147 * available from the BLE Stack by the triggering of the SD_EVT_IRQn interrupt (mapped to IRQ 22).
mbed_official 104:a6a92e2e5a92 148 * The application is free to choose whether to call this function from thread mode (main context) or directly from the Interrupt Service Routine
mbed_official 104:a6a92e2e5a92 149 * 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
mbed_official 104:a6a92e2e5a92 150 * 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 stack.
mbed_official 104:a6a92e2e5a92 151 * Failure to do so could potentially leave events in the internal queue without the application being aware of this fact.
mbed_official 104:a6a92e2e5a92 152 * 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
mbed_official 104:a6a92e2e5a92 153 * 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
mbed_official 104:a6a92e2e5a92 154 * and the application can then call again with a larger buffer size.
mbed_official 104:a6a92e2e5a92 155 * 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,
mbed_official 104:a6a92e2e5a92 156 * and so it is the application's responsability to provide an amount of memory large enough so that the relevant event is copied in full.
mbed_official 104:a6a92e2e5a92 157 * The application may "peek" the event length by providing p_dest as a NULL pointer and inspecting the value of *p_len upon return.
mbed_official 104:a6a92e2e5a92 158 *
mbed_official 104:a6a92e2e5a92 159 * @note The pointer supplied must be aligned to the extend defined by @ref BLE_EVTS_PTR_ALIGNMENT
mbed_official 104:a6a92e2e5a92 160 *
mbed_official 104:a6a92e2e5a92 161 * @return @ref NRF_SUCCESS Event pulled and stored into the supplied buffer.
mbed_official 104:a6a92e2e5a92 162 * @return @ref NRF_ERROR_INVALID_ADDR Invalid or not sufficiently aligned pointer supplied.
mbed_official 104:a6a92e2e5a92 163 * @return @ref NRF_ERROR_NOT_FOUND No events ready to be pulled.
mbed_official 104:a6a92e2e5a92 164 * @return @ref NRF_ERROR_DATA_SIZE Event ready but could not fit into the supplied buffer.
mbed_official 104:a6a92e2e5a92 165 */
mbed_official 104:a6a92e2e5a92 166 SVCALL(SD_BLE_EVT_GET, uint32_t, sd_ble_evt_get(uint8_t* p_dest, uint16_t *p_len));
mbed_official 104:a6a92e2e5a92 167
mbed_official 104:a6a92e2e5a92 168
mbed_official 104:a6a92e2e5a92 169 /**@brief Get the total number of available application transmission buffers in the BLE stack.
mbed_official 104:a6a92e2e5a92 170 *
mbed_official 104:a6a92e2e5a92 171 * @details This call allows the application to obtain the total number of
mbed_official 104:a6a92e2e5a92 172 * transmission buffers available for application data. Please note that
mbed_official 104:a6a92e2e5a92 173 * this does not give the number of free buffers, but rather the total amount of them.
mbed_official 104:a6a92e2e5a92 174 * The application has two options to handle its own application transmission buffers:
mbed_official 104:a6a92e2e5a92 175 * - Use a simple arithmetic calculation: at boot time the application should use this function
mbed_official 104:a6a92e2e5a92 176 * to find out the total amount of buffers available to it and store it in a variable.
mbed_official 104:a6a92e2e5a92 177 * Every time a packet that consumes an application buffer is sent using any of the
mbed_official 104:a6a92e2e5a92 178 * exposed functions in this BLE API, the application should decrement that variable.
mbed_official 104:a6a92e2e5a92 179 * Conversely, whenever a @ref BLE_EVT_TX_COMPLETE event is received by the application
mbed_official 104:a6a92e2e5a92 180 * it should retrieve the count field in such event and add that number to the same
mbed_official 104:a6a92e2e5a92 181 * variable storing the number of available packets.
mbed_official 104:a6a92e2e5a92 182 * This mechanism allows the application to be aware at any time of the number of
mbed_official 104:a6a92e2e5a92 183 * application packets available in the BLE stack's internal buffers, and therefore
mbed_official 104:a6a92e2e5a92 184 * it can know with certainty whether it is possible to send more data or it has to
mbed_official 104:a6a92e2e5a92 185 * wait for a @ref BLE_EVT_TX_COMPLETE event before it proceeds.
mbed_official 104:a6a92e2e5a92 186 * - Choose to simply not keep track of available buffers at all, and instead handle the
mbed_official 104:a6a92e2e5a92 187 * @ref BLE_ERROR_NO_TX_BUFFERS error by queueing the packet to be transmitted and
mbed_official 104:a6a92e2e5a92 188 * try again as soon as a @ref BLE_EVT_TX_COMPLETE event arrives.
mbed_official 104:a6a92e2e5a92 189 *
mbed_official 104:a6a92e2e5a92 190 * The API functions that <b>may</b> consume an application buffer depending on
mbed_official 104:a6a92e2e5a92 191 * the parameters supplied to them can be found below:
mbed_official 104:a6a92e2e5a92 192 *
mbed_official 104:a6a92e2e5a92 193 * - @ref sd_ble_gattc_write (write witout response only)
mbed_official 104:a6a92e2e5a92 194 * - @ref sd_ble_gatts_hvx (notifications only)
mbed_official 104:a6a92e2e5a92 195 * - @ref sd_ble_l2cap_tx (all packets)
mbed_official 104:a6a92e2e5a92 196 *
mbed_official 104:a6a92e2e5a92 197 * @param[out] p_count Pointer to a uint8_t which will contain the number of application transmission buffers upon
mbed_official 104:a6a92e2e5a92 198 * successful return.
mbed_official 104:a6a92e2e5a92 199 *
mbed_official 104:a6a92e2e5a92 200 * @return @ref NRF_SUCCESS Number of application transmission buffers retrieved successfully.
mbed_official 104:a6a92e2e5a92 201 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
mbed_official 104:a6a92e2e5a92 202 */
mbed_official 104:a6a92e2e5a92 203 SVCALL(SD_BLE_TX_BUFFER_COUNT_GET, uint32_t, sd_ble_tx_buffer_count_get(uint8_t* p_count));
mbed_official 104:a6a92e2e5a92 204
mbed_official 104:a6a92e2e5a92 205
mbed_official 104:a6a92e2e5a92 206 /**@brief Add a Vendor Specific UUID.
mbed_official 104:a6a92e2e5a92 207 *
mbed_official 104:a6a92e2e5a92 208 * @details This call enables the application to add a vendor specific UUID to the BLE stack's table,
mbed_official 104:a6a92e2e5a92 209 * for later use all other modules and APIs. This then allows the application to use the shorter,
mbed_official 104:a6a92e2e5a92 210 * 24-bit @ref ble_uuid_t format when dealing with both 16-bit and 128-bit UUIDs without having to
mbed_official 104:a6a92e2e5a92 211 * check for lengths and having split code paths. The way that this is accomplished is by extending the
mbed_official 104:a6a92e2e5a92 212 * grouping mechanism that the Bluetooth SIG standard base UUID uses for all other 128-bit UUIDs. The
mbed_official 104:a6a92e2e5a92 213 * type field in the @ref ble_uuid_t structure is an index (relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN)
mbed_official 104:a6a92e2e5a92 214 * to the table populated by multiple calls to this function, and the uuid field in the same structure
mbed_official 104:a6a92e2e5a92 215 * contains the 2 bytes at indices 12 and 13. The number of possible 128-bit UUIDs available to the
mbed_official 104:a6a92e2e5a92 216 * application is therefore the number of Vendor Specific UUIDs added with the help of this function times 65536,
mbed_official 104:a6a92e2e5a92 217 * although restricted to modifying bytes 12 and 13 for each of the entries in the supplied array.
mbed_official 104:a6a92e2e5a92 218 *
mbed_official 104:a6a92e2e5a92 219 * @note Bytes 12 and 13 of the provided UUID will not be used internally, since those are always replaced by
mbed_official 104:a6a92e2e5a92 220 * the 16-bit uuid field in @ref ble_uuid_t.
mbed_official 104:a6a92e2e5a92 221 *
mbed_official 104:a6a92e2e5a92 222 *
mbed_official 104:a6a92e2e5a92 223 * @param[in] p_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor Specific UUID disregarding
mbed_official 104:a6a92e2e5a92 224 * bytes 12 and 13.
mbed_official 104:a6a92e2e5a92 225 * @param[out] p_uuid_type Pointer where the type field in @ref ble_uuid_t corresponding to this UUID will be stored.
mbed_official 104:a6a92e2e5a92 226 *
mbed_official 104:a6a92e2e5a92 227 * @return @ref NRF_SUCCESS Successfully added the Vendor Specific UUID.
mbed_official 104:a6a92e2e5a92 228 * @return @ref NRF_ERROR_INVALID_ADDR If p_vs_uuid or p_uuid_type is NULL or invalid.
mbed_official 104:a6a92e2e5a92 229 * @return @ref NRF_ERROR_NO_MEM If there are no more free slots for VS UUIDs.
mbed_official 104:a6a92e2e5a92 230 * @return @ref NRF_ERROR_FORBIDDEN If p_vs_uuid has already been added to the VS UUID table.
mbed_official 104:a6a92e2e5a92 231 */
mbed_official 104:a6a92e2e5a92 232 SVCALL(SD_BLE_UUID_VS_ADD, uint32_t, sd_ble_uuid_vs_add(ble_uuid128_t const * const p_vs_uuid, uint8_t * const p_uuid_type));
mbed_official 104:a6a92e2e5a92 233
mbed_official 104:a6a92e2e5a92 234
mbed_official 104:a6a92e2e5a92 235 /** @brief Decode little endian raw UUID bytes (16-bit or 128-bit) into a 24 bit @ref ble_uuid_t structure.
mbed_official 104:a6a92e2e5a92 236 *
mbed_official 104:a6a92e2e5a92 237 * @details The raw UUID bytes excluding bytes 12 and 13 (i.e. bytes 0-11 and 14-15) of p_uuid_le are compared
mbed_official 104:a6a92e2e5a92 238 * to the corresponding ones in each entry of the table of vendor specific UUIDs pouplated with @ref sd_ble_uuid_vs_add
mbed_official 104:a6a92e2e5a92 239 * to look for a match. If there is such a match, bytes 12 and 13 are returned as p_uuid->uuid and the index
mbed_official 104:a6a92e2e5a92 240 * relative to @ref BLE_UUID_TYPE_VENDOR_BEGIN as p_uuid->type.
mbed_official 104:a6a92e2e5a92 241 *
mbed_official 104:a6a92e2e5a92 242 * @note If the UUID length supplied is 2, then the type set by this call will always be @ref BLE_UUID_TYPE_BLE.
mbed_official 104:a6a92e2e5a92 243 *
mbed_official 104:a6a92e2e5a92 244 * @param[in] uuid_le_len Length in bytes of the buffer pointed to by p_uuid_le (must be 2 or 16 bytes).
mbed_official 104:a6a92e2e5a92 245 * @param[in] p_uuid_le Pointer pointing to little endian raw UUID bytes.
mbed_official 104:a6a92e2e5a92 246 * @param[in,out] p_uuid Pointer to a @ref ble_uuid_t structure to be filled in.
mbed_official 104:a6a92e2e5a92 247 *
mbed_official 104:a6a92e2e5a92 248 * @return @ref NRF_SUCCESS Successfully decoded into the @ref ble_uuid_t structure.
mbed_official 104:a6a92e2e5a92 249 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
mbed_official 104:a6a92e2e5a92 250 * @return @ref NRF_ERROR_INVALID_LENGTH Invalid UUID length.
mbed_official 104:a6a92e2e5a92 251 * @return @ref NRF_ERROR_NOT_FOUND For a 128-bit UUID, no match in the populated table of UUIDs.
mbed_official 104:a6a92e2e5a92 252 */
mbed_official 104:a6a92e2e5a92 253 SVCALL(SD_BLE_UUID_DECODE, uint32_t, sd_ble_uuid_decode(uint8_t uuid_le_len, uint8_t const * const p_uuid_le, ble_uuid_t * const p_uuid));
mbed_official 104:a6a92e2e5a92 254
mbed_official 104:a6a92e2e5a92 255
mbed_official 104:a6a92e2e5a92 256 /** @brief Encode a @ref ble_uuid_t structure into little endian raw UUID bytes (16-bit or 128-bit).
mbed_official 104:a6a92e2e5a92 257 *
mbed_official 104:a6a92e2e5a92 258 * @note The pointer to the destination buffer p_uuid_le may be NULL, in which case only the validitiy and size of p_uuid is computed.
mbed_official 104:a6a92e2e5a92 259 *
mbed_official 104:a6a92e2e5a92 260 * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes.
mbed_official 104:a6a92e2e5a92 261 * @param[out] p_uuid_le_len Pointer to a uint8_t that will be filled with the encoded length (2 or 16 bytes).
mbed_official 104:a6a92e2e5a92 262 * @param[out] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes (2 or 16) will be stored.
mbed_official 104:a6a92e2e5a92 263 *
mbed_official 104:a6a92e2e5a92 264 * @return @ref NRF_SUCCESS Successfully encoded into the buffer.
mbed_official 104:a6a92e2e5a92 265 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
mbed_official 104:a6a92e2e5a92 266 * @return @ref NRF_ERROR_INVALID_PARAM Invalid UUID type.
mbed_official 104:a6a92e2e5a92 267 */
mbed_official 104:a6a92e2e5a92 268 SVCALL(SD_BLE_UUID_ENCODE, uint32_t, sd_ble_uuid_encode(ble_uuid_t const * const p_uuid, uint8_t * const p_uuid_le_len, uint8_t * const p_uuid_le));
mbed_official 104:a6a92e2e5a92 269
mbed_official 104:a6a92e2e5a92 270
mbed_official 104:a6a92e2e5a92 271 /**@brief Get Version Information.
mbed_official 104:a6a92e2e5a92 272 *
mbed_official 104:a6a92e2e5a92 273 * @details This call allows the application to get the BLE stack version information.
mbed_official 104:a6a92e2e5a92 274 *
mbed_official 104:a6a92e2e5a92 275 * @param[in] p_version Pointer to ble_version_t structure to be filled in.
mbed_official 104:a6a92e2e5a92 276 *
mbed_official 104:a6a92e2e5a92 277 * @return @ref NRF_SUCCESS Version information stored successfully.
mbed_official 104:a6a92e2e5a92 278 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
mbed_official 104:a6a92e2e5a92 279 * @return @ref NRF_ERROR_BUSY The stack is busy (typically doing a locally-initiated disconnection procedure).
mbed_official 104:a6a92e2e5a92 280 */
mbed_official 104:a6a92e2e5a92 281 SVCALL(SD_BLE_VERSION_GET, uint32_t, sd_ble_version_get(ble_version_t * p_version));
mbed_official 104:a6a92e2e5a92 282
mbed_official 104:a6a92e2e5a92 283
mbed_official 104:a6a92e2e5a92 284 /**@brief Provide a user memory block.
mbed_official 104:a6a92e2e5a92 285 *
mbed_official 104:a6a92e2e5a92 286 * @note This call can only be used as a response to a @ref BLE_EVT_USER_MEM_REQUEST event issued to the application.
mbed_official 104:a6a92e2e5a92 287 *
mbed_official 104:a6a92e2e5a92 288 * @param[in] conn_handle Connection handle.
mbed_official 104:a6a92e2e5a92 289 * @param[in] p_block Pointer to a user memory block structure.
mbed_official 104:a6a92e2e5a92 290 *
mbed_official 104:a6a92e2e5a92 291 * @return @ref NRF_SUCCESS Successfully queued a response to the peer.
mbed_official 104:a6a92e2e5a92 292 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
mbed_official 104:a6a92e2e5a92 293 * @return @ref NRF_ERROR_INVALID_STATE No execute write request pending.
mbed_official 104:a6a92e2e5a92 294 */
mbed_official 104:a6a92e2e5a92 295 SVCALL(SD_BLE_USER_MEM_REPLY, uint32_t, sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t *p_block));
mbed_official 104:a6a92e2e5a92 296
mbed_official 104:a6a92e2e5a92 297 #endif /* BLE_H__ */
mbed_official 104:a6a92e2e5a92 298
mbed_official 104:a6a92e2e5a92 299 /**
mbed_official 104:a6a92e2e5a92 300 @}
mbed_official 104:a6a92e2e5a92 301 @}
mbed_official 104:a6a92e2e5a92 302 */