/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Fri Jul 25 09:46:51 2014 +0100
Revision:
87:6213f644d804
Release 87 of the mbed library

Main changes:

- error.h renamed to mbed_error.h to avoid name clashes
- upgraded to V7 of the nRF51822 soft-device 110
- New targets: HRM107
- Improved test infrastructure
- Bug fixes on various targets

Who changed what in which revision?

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