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