iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。

Dependencies:   BLE_API_Native_IRC Servo mbed

Fork of BLE_RCBController by Junichi Katsu

  • 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
  • ライブラリ類はUpdateしないでください。コンパイルエラーになります。

うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。

/media/uploads/robo8080/img_1560.jpg

Committer:
jksoft
Date:
Thu Jul 10 14:21:52 2014 +0000
Revision:
0:8c643bfe55b7
??

Who changed what in which revision?

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