The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
emilmont
Date:
Fri Feb 21 12:21:39 2014 +0000
Revision:
80:8e73be2a2ac1
First alpha release for the NRF51822 target (to be tested in the online IDE)

Who changed what in which revision?

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