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:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 143:86740a56073b 1 /*
AnnaBridge 143:86740a56073b 2 * Copyright (c) 2012 Nordic Semiconductor ASA
AnnaBridge 143:86740a56073b 3 * All rights reserved.
AnnaBridge 143:86740a56073b 4 *
AnnaBridge 143:86740a56073b 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 143:86740a56073b 6 * are permitted provided that the following conditions are met:
AnnaBridge 143:86740a56073b 7 *
AnnaBridge 143:86740a56073b 8 * 1. Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 143:86740a56073b 9 * of conditions and the following disclaimer.
AnnaBridge 143:86740a56073b 10 *
AnnaBridge 143:86740a56073b 11 * 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
AnnaBridge 143:86740a56073b 12 * integrated circuit in a product or a software update for such product, must reproduce
AnnaBridge 143:86740a56073b 13 * the above copyright notice, this list of conditions and the following disclaimer in
AnnaBridge 143:86740a56073b 14 * the documentation and/or other materials provided with the distribution.
AnnaBridge 143:86740a56073b 15 *
AnnaBridge 143:86740a56073b 16 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
AnnaBridge 143:86740a56073b 17 * used to endorse or promote products derived from this software without specific prior
AnnaBridge 143:86740a56073b 18 * written permission.
AnnaBridge 143:86740a56073b 19 *
AnnaBridge 143:86740a56073b 20 * 4. This software, with or without modification, must only be used with a
AnnaBridge 143:86740a56073b 21 * Nordic Semiconductor ASA integrated circuit.
AnnaBridge 143:86740a56073b 22 *
AnnaBridge 143:86740a56073b 23 * 5. Any software provided in binary or object form under this license must not be reverse
AnnaBridge 143:86740a56073b 24 * engineered, decompiled, modified and/or disassembled.
AnnaBridge 143:86740a56073b 25 *
AnnaBridge 143:86740a56073b 26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 143:86740a56073b 27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 143:86740a56073b 28 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 143:86740a56073b 29 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 143:86740a56073b 30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 143:86740a56073b 31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 143:86740a56073b 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 143:86740a56073b 33 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 143:86740a56073b 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 143:86740a56073b 35 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 143:86740a56073b 36 *
AnnaBridge 143:86740a56073b 37 */
AnnaBridge 143:86740a56073b 38
AnnaBridge 143:86740a56073b 39
AnnaBridge 143:86740a56073b 40 /** @file
AnnaBridge 143:86740a56073b 41 *
AnnaBridge 143:86740a56073b 42 * @defgroup ble_sdk_lib_advdata Advertising and Scan Response Data Encoder
AnnaBridge 143:86740a56073b 43 * @{
AnnaBridge 143:86740a56073b 44 * @ingroup ble_sdk_lib
AnnaBridge 143:86740a56073b 45 * @brief Functions for encoding data in the Advertising and Scan Response Data format,
AnnaBridge 143:86740a56073b 46 * and for passing the data to the stack.
AnnaBridge 143:86740a56073b 47 */
AnnaBridge 143:86740a56073b 48
AnnaBridge 143:86740a56073b 49 #ifndef BLE_ADVDATA_H__
AnnaBridge 143:86740a56073b 50 #define BLE_ADVDATA_H__
AnnaBridge 143:86740a56073b 51
AnnaBridge 143:86740a56073b 52 #include <stdint.h>
AnnaBridge 143:86740a56073b 53 #include <stdbool.h>
AnnaBridge 143:86740a56073b 54 #include <string.h>
AnnaBridge 143:86740a56073b 55 #include "nrf_ble.h"
AnnaBridge 143:86740a56073b 56 #include "app_util.h"
AnnaBridge 143:86740a56073b 57
AnnaBridge 143:86740a56073b 58
AnnaBridge 143:86740a56073b 59 #define ADV_LENGTH_FIELD_SIZE 1UL /**< Advertising Data and Scan Response format contains 1 octet for the length. */
AnnaBridge 143:86740a56073b 60 #define ADV_AD_TYPE_FIELD_SIZE 1UL /**< Advertising Data and Scan Response format contains 1 octet for the AD type. */
AnnaBridge 143:86740a56073b 61 #define ADV_AD_DATA_OFFSET (ADV_LENGTH_FIELD_SIZE + \
AnnaBridge 143:86740a56073b 62 ADV_AD_TYPE_FIELD_SIZE) /**< Offset for the AD data field of the Advertising Data and Scan Response format. */
AnnaBridge 143:86740a56073b 63 #define AD_TYPE_TK_VALUE_DATA_SIZE (sizeof(ble_advdata_tk_value_t)) /**< Data size (in octets) of the Security Manager TK value AD type. */
AnnaBridge 143:86740a56073b 64 #define AD_TYPE_TK_VALUE_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 65 AD_TYPE_TK_VALUE_DATA_SIZE) /**< Size (in octets) of the Security Manager TK value AD type. */
AnnaBridge 143:86740a56073b 66 #define AD_TYPE_LE_ROLE_DATA_SIZE 1UL /**< Data size (in octets) of the LE Bluetooth Device Address AD type. */
AnnaBridge 143:86740a56073b 67 #define AD_TYPE_LE_ROLE_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 68 AD_TYPE_LE_ROLE_DATA_SIZE) /**< Size (in octets) of the LE Bluetooth Device Address AD type. */
AnnaBridge 143:86740a56073b 69 #define AD_TYPE_BLE_DEVICE_ADDR_TYPE_SIZE 1UL /**< Data size (in octets) of the Address type of the LE Bluetooth Device Address AD type. */
AnnaBridge 143:86740a56073b 70 #define AD_TYPE_BLE_DEVICE_ADDR_DATA_SIZE (BLE_GAP_ADDR_LEN + \
AnnaBridge 143:86740a56073b 71 AD_TYPE_BLE_DEVICE_ADDR_TYPE_SIZE) /**< Data size (in octets) of the LE Bluetooth Device Address AD type. */
AnnaBridge 143:86740a56073b 72 #define AD_TYPE_BLE_DEVICE_ADDR_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 73 AD_TYPE_BLE_DEVICE_ADDR_DATA_SIZE) /**< Size (in octets) of the LE Bluetooth Device Address AD type. */
AnnaBridge 143:86740a56073b 74 #define AD_TYPE_APPEARANCE_DATA_SIZE 2UL /**< Data size (in octets) of the Appearance AD type. */
AnnaBridge 143:86740a56073b 75 #define AD_TYPE_APPEARANCE_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 76 AD_TYPE_APPEARANCE_DATA_SIZE) /**< Size (in octets) of the Appearance AD type. */
AnnaBridge 143:86740a56073b 77 #define AD_TYPE_FLAGS_DATA_SIZE 1UL /**< Data size (in octets) of the Flags AD type. */
AnnaBridge 143:86740a56073b 78 #define AD_TYPE_FLAGS_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 79 AD_TYPE_FLAGS_DATA_SIZE) /**< Size (in octets) of the Flags AD type. */
AnnaBridge 143:86740a56073b 80 #define AD_TYPE_TX_POWER_LEVEL_DATA_SIZE 1UL /**< Data size (in octets) of the TX Power Level AD type. */
AnnaBridge 143:86740a56073b 81 #define AD_TYPE_TX_POWER_LEVEL_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 82 AD_TYPE_TX_POWER_LEVEL_DATA_SIZE) /**< Size (in octets) of the TX Power Level AD type. */
AnnaBridge 143:86740a56073b 83 #define AD_TYPE_CONN_INT_DATA_SIZE 4UL /**< Data size (in octets) of the Slave Connection Interval Range AD type. */
AnnaBridge 143:86740a56073b 84 #define AD_TYPE_CONN_INT_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 85 AD_TYPE_CONN_INT_DATA_SIZE) /**< Data size (in octets) of the Slave Connection Interval Range AD type. */
AnnaBridge 143:86740a56073b 86 #define AD_TYPE_MANUF_SPEC_DATA_ID_SIZE 2UL /**< Size (in octets) of the Company Identifier Code, which is a part of the Manufacturer Specific Data AD type. */
AnnaBridge 143:86740a56073b 87 #define AD_TYPE_SERV_DATA_16BIT_UUID_SIZE 2UL /**< Size (in octets) of the 16-bit UUID, which is a part of the Service Data AD type. */
AnnaBridge 143:86740a56073b 88 #define AD_TYPE_OOB_FLAGS_DATA_SIZE 1UL /**< Data size (in octets) of the Security Manager OOB Flags AD type. */
AnnaBridge 143:86740a56073b 89 #define AD_TYPE_OOB_FLAGS_SIZE (ADV_AD_DATA_OFFSET + \
AnnaBridge 143:86740a56073b 90 AD_TYPE_OOB_FLAGS_DATA_SIZE) /**< Size (in octets) of the Security Manager OOB Flags AD type. */
AnnaBridge 143:86740a56073b 91
AnnaBridge 143:86740a56073b 92 #define AD_TYPE_SEC_MGR_OOB_FLAG_SET 1U /**< Security Manager OOB Flag set. Flag selection is done using _POS defines */
AnnaBridge 143:86740a56073b 93 #define AD_TYPE_SEC_MGR_OOB_FLAG_CLEAR 0U /**< Security Manager OOB Flag clear. Flag selection is done using _POS defines */
AnnaBridge 143:86740a56073b 94 #define AD_TYPE_SEC_MGR_OOB_FLAG_OOB_DATA_PRESENT_POS 0UL /**< Security Manager OOB Data Present Flag position. */
AnnaBridge 143:86740a56073b 95 #define AD_TYPE_SEC_MGR_OOB_FLAG_OOB_LE_SUPPORTED_POS 1UL /**< Security Manager OOB Low Energy Supported Flag position. */
AnnaBridge 143:86740a56073b 96 #define AD_TYPE_SEC_MGR_OOB_FLAG_SIM_LE_AND_EP_POS 2UL /**< Security Manager OOB Simultaneous LE and BR/EDR to Same Device Capable Flag position. */
AnnaBridge 143:86740a56073b 97 #define AD_TYPE_SEC_MGR_OOB_ADDRESS_TYPE_PUBLIC 0UL /**< Security Manager OOB Public Address type. */
AnnaBridge 143:86740a56073b 98 #define AD_TYPE_SEC_MGR_OOB_ADDRESS_TYPE_RANDOM 1UL /**< Security Manager OOB Random Address type. */
AnnaBridge 143:86740a56073b 99 #define AD_TYPE_SEC_MGR_OOB_FLAG_ADDRESS_TYPE_POS 3UL /**< Security Manager OOB Address type Flag (0 = Public Address, 1 = Random Address) position. */
AnnaBridge 143:86740a56073b 100
AnnaBridge 143:86740a56073b 101
AnnaBridge 143:86740a56073b 102 /**@brief Security Manager TK value. */
AnnaBridge 143:86740a56073b 103 typedef struct
AnnaBridge 143:86740a56073b 104 {
AnnaBridge 143:86740a56073b 105 uint8_t tk[BLE_GAP_SEC_KEY_LEN]; /**< Array containing TK value. */
AnnaBridge 143:86740a56073b 106 } ble_advdata_tk_value_t;
AnnaBridge 143:86740a56073b 107
AnnaBridge 143:86740a56073b 108 /**@brief Advertising data LE Role types. This enumeration contains the options available for the LE role inside
AnnaBridge 143:86740a56073b 109 * the advertising data. */
AnnaBridge 143:86740a56073b 110 typedef enum
AnnaBridge 143:86740a56073b 111 {
AnnaBridge 143:86740a56073b 112 BLE_ADVDATA_ROLE_NOT_PRESENT = 0, /**< LE Role AD structure not present. */
AnnaBridge 143:86740a56073b 113 BLE_ADVDATA_ROLE_ONLY_PERIPH, /**< Only Peripheral Role supported. */
AnnaBridge 143:86740a56073b 114 BLE_ADVDATA_ROLE_ONLY_CENTRAL, /**< Only Central Role supported. */
AnnaBridge 143:86740a56073b 115 BLE_ADVDATA_ROLE_BOTH_PERIPH_PREFERRED, /**< Peripheral and Central Role supported. Peripheral Role preferred for connection establishment. */
AnnaBridge 143:86740a56073b 116 BLE_ADVDATA_ROLE_BOTH_CENTRAL_PREFERRED /**< Peripheral and Central Role supported. Central Role preferred for connection establishment */
AnnaBridge 143:86740a56073b 117 } ble_advdata_le_role_t;
AnnaBridge 143:86740a56073b 118
AnnaBridge 143:86740a56073b 119 /**@brief Advertising data name type. This enumeration contains the options available for the device name inside
AnnaBridge 143:86740a56073b 120 * the advertising data. */
AnnaBridge 143:86740a56073b 121 typedef enum
AnnaBridge 143:86740a56073b 122 {
AnnaBridge 143:86740a56073b 123 BLE_ADVDATA_NO_NAME, /**< Include no device name in advertising data. */
AnnaBridge 143:86740a56073b 124 BLE_ADVDATA_SHORT_NAME, /**< Include short device name in advertising data. */
AnnaBridge 143:86740a56073b 125 BLE_ADVDATA_FULL_NAME /**< Include full device name in advertising data. */
AnnaBridge 143:86740a56073b 126 } ble_advdata_name_type_t;
AnnaBridge 143:86740a56073b 127
AnnaBridge 143:86740a56073b 128 /**@brief UUID list type. */
AnnaBridge 143:86740a56073b 129 typedef struct
AnnaBridge 143:86740a56073b 130 {
AnnaBridge 143:86740a56073b 131 uint16_t uuid_cnt; /**< Number of UUID entries. */
AnnaBridge 143:86740a56073b 132 ble_uuid_t * p_uuids; /**< Pointer to UUID array entries. */
AnnaBridge 143:86740a56073b 133 } ble_advdata_uuid_list_t;
AnnaBridge 143:86740a56073b 134
AnnaBridge 143:86740a56073b 135 /**@brief Connection interval range structure. */
AnnaBridge 143:86740a56073b 136 typedef struct
AnnaBridge 143:86740a56073b 137 {
AnnaBridge 143:86740a56073b 138 uint16_t min_conn_interval; /**< Minimum connection interval, in units of 1.25 ms, range 6 to 3200 (7.5 ms to 4 s). */
AnnaBridge 143:86740a56073b 139 uint16_t max_conn_interval; /**< Maximum connection interval, in units of 1.25 ms, range 6 to 3200 (7.5 ms to 4 s). The value 0xFFFF indicates no specific maximum. */
AnnaBridge 143:86740a56073b 140 } ble_advdata_conn_int_t;
AnnaBridge 143:86740a56073b 141
AnnaBridge 143:86740a56073b 142 /**@brief Manufacturer specific data structure. */
AnnaBridge 143:86740a56073b 143 typedef struct
AnnaBridge 143:86740a56073b 144 {
AnnaBridge 143:86740a56073b 145 uint16_t company_identifier; /**< Company identifier code. */
AnnaBridge 143:86740a56073b 146 uint8_array_t data; /**< Additional manufacturer specific data. */
AnnaBridge 143:86740a56073b 147 } ble_advdata_manuf_data_t;
AnnaBridge 143:86740a56073b 148
AnnaBridge 143:86740a56073b 149 /**@brief Service data structure. */
AnnaBridge 143:86740a56073b 150 typedef struct
AnnaBridge 143:86740a56073b 151 {
AnnaBridge 143:86740a56073b 152 uint16_t service_uuid; /**< Service UUID. */
AnnaBridge 143:86740a56073b 153 uint8_array_t data; /**< Additional service data. */
AnnaBridge 143:86740a56073b 154 } ble_advdata_service_data_t;
AnnaBridge 143:86740a56073b 155
AnnaBridge 143:86740a56073b 156 /**@brief Advertising data structure. This structure contains all options and data needed for encoding and
AnnaBridge 143:86740a56073b 157 * setting the advertising data. */
AnnaBridge 143:86740a56073b 158 typedef struct
AnnaBridge 143:86740a56073b 159 {
AnnaBridge 143:86740a56073b 160 ble_advdata_name_type_t name_type; /**< Type of device name. */
AnnaBridge 143:86740a56073b 161 uint8_t short_name_len; /**< Length of short device name (if short type is specified). */
AnnaBridge 143:86740a56073b 162 bool include_appearance; /**< Determines if Appearance shall be included. */
AnnaBridge 143:86740a56073b 163 uint8_t flags; /**< Advertising data Flags field. */
AnnaBridge 143:86740a56073b 164 int8_t * p_tx_power_level; /**< TX Power Level field. */
AnnaBridge 143:86740a56073b 165 ble_advdata_uuid_list_t uuids_more_available; /**< List of UUIDs in the 'More Available' list. */
AnnaBridge 143:86740a56073b 166 ble_advdata_uuid_list_t uuids_complete; /**< List of UUIDs in the 'Complete' list. */
AnnaBridge 143:86740a56073b 167 ble_advdata_uuid_list_t uuids_solicited; /**< List of solicited UUIDs. */
AnnaBridge 143:86740a56073b 168 ble_advdata_conn_int_t * p_slave_conn_int; /**< Slave Connection Interval Range. */
AnnaBridge 143:86740a56073b 169 ble_advdata_manuf_data_t * p_manuf_specific_data; /**< Manufacturer specific data. */
AnnaBridge 143:86740a56073b 170 ble_advdata_service_data_t * p_service_data_array; /**< Array of Service data structures. */
AnnaBridge 143:86740a56073b 171 uint8_t service_data_count; /**< Number of Service data structures. */
AnnaBridge 143:86740a56073b 172 bool include_ble_device_addr; /**< Determines if LE Bluetooth Device Address shall be included. */
AnnaBridge 143:86740a56073b 173 ble_advdata_le_role_t le_role; /**< LE Role field. Included when different from @ref BLE_ADVDATA_ROLE_NOT_PRESENT. @warning This field can be used only for NFC. For BLE advertising, set it to NULL. */
AnnaBridge 143:86740a56073b 174 ble_advdata_tk_value_t * p_tk_value; /**< Security Manager TK value field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/
AnnaBridge 143:86740a56073b 175 uint8_t * p_sec_mgr_oob_flags; /**< Security Manager Out Of Band Flags field. Included when different from NULL. @warning This field can be used only for NFC. For BLE advertising, set it to NULL.*/
AnnaBridge 143:86740a56073b 176 } ble_advdata_t;
AnnaBridge 143:86740a56073b 177
AnnaBridge 143:86740a56073b 178 /**@brief Function for encoding data in the Advertising and Scan Response data format
AnnaBridge 143:86740a56073b 179 * (AD structures).
AnnaBridge 143:86740a56073b 180 *
AnnaBridge 143:86740a56073b 181 * @details This function encodes data into the Advertising and Scan Response data format
AnnaBridge 143:86740a56073b 182 * (AD structures) based on the selections in the supplied structures. This function can be used to
AnnaBridge 143:86740a56073b 183 * create a payload of Advertising packet or Scan Response packet, or a payload of NFC
AnnaBridge 143:86740a56073b 184 * message intended for initiating the Out-of-Band pairing.
AnnaBridge 143:86740a56073b 185 *
AnnaBridge 143:86740a56073b 186 * @param[in] p_advdata Pointer to the structure for specifying the content of encoded data.
AnnaBridge 143:86740a56073b 187 * @param[out] p_encoded_data Pointer to the buffer where encoded data will be returned.
AnnaBridge 143:86740a56073b 188 * @param[in,out] p_len \c in: Size of \p p_encoded_data buffer.
AnnaBridge 143:86740a56073b 189 * \c out: Length of encoded data.
AnnaBridge 143:86740a56073b 190 *
AnnaBridge 143:86740a56073b 191 * @retval NRF_SUCCESS If the operation was successful.
AnnaBridge 143:86740a56073b 192 * @retval NRF_ERROR_INVALID_PARAM If the operation failed because a wrong parameter was provided in \p p_advdata.
AnnaBridge 143:86740a56073b 193 * @retval NRF_ERROR_DATA_SIZE If the operation failed because not all the requested data could fit into the
AnnaBridge 143:86740a56073b 194 * provided buffer or some encoded AD structure is too long and its
AnnaBridge 143:86740a56073b 195 * length cannot be encoded with one octet.
AnnaBridge 143:86740a56073b 196 *
AnnaBridge 143:86740a56073b 197 * @warning This API may override the application's request to use the long name and use a short name
AnnaBridge 143:86740a56073b 198 * instead. This truncation will occur in case the long name does not fit the provided buffer size.
AnnaBridge 143:86740a56073b 199 * The application can specify a preferred short name length if truncation is required.
AnnaBridge 143:86740a56073b 200 * For example, if the complete device name is ABCD_HRMonitor, the application can specify the short name
AnnaBridge 143:86740a56073b 201 * length to be 8, so that the short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni
AnnaBridge 143:86740a56073b 202 * if the available size for the short name is 9 or 12 respectively, to have a more appropriate short name.
AnnaBridge 143:86740a56073b 203 * However, it should be noted that this is just a preference that the application can specify, and
AnnaBridge 143:86740a56073b 204 * if the preference is too large to fit in the provided buffer, the name can be truncated further.
AnnaBridge 143:86740a56073b 205 */
AnnaBridge 143:86740a56073b 206 uint32_t adv_data_encode(ble_advdata_t const * const p_advdata,
AnnaBridge 143:86740a56073b 207 uint8_t * const p_encoded_data,
AnnaBridge 143:86740a56073b 208 uint16_t * const p_len);
AnnaBridge 143:86740a56073b 209
AnnaBridge 143:86740a56073b 210 /**@brief Function for encoding and setting the advertising data and/or scan response data.
AnnaBridge 143:86740a56073b 211 *
AnnaBridge 143:86740a56073b 212 * @details This function encodes advertising data and/or scan response data based on the selections
AnnaBridge 143:86740a56073b 213 * in the supplied structures, and passes the encoded data to the stack.
AnnaBridge 143:86740a56073b 214 *
AnnaBridge 143:86740a56073b 215 * @param[in] p_advdata Structure for specifying the content of the advertising data.
AnnaBridge 143:86740a56073b 216 * Set to NULL if advertising data is not to be set.
AnnaBridge 143:86740a56073b 217 * @param[in] p_srdata Structure for specifying the content of the scan response data.
AnnaBridge 143:86740a56073b 218 * Set to NULL if scan response data is not to be set.
AnnaBridge 143:86740a56073b 219 *
AnnaBridge 143:86740a56073b 220 * @retval NRF_SUCCESS If the operation was successful.
AnnaBridge 143:86740a56073b 221 * @retval NRF_ERROR_INVALID_PARAM If the operation failed because a wrong parameter was provided in \p p_advdata.
AnnaBridge 143:86740a56073b 222 * @retval NRF_ERROR_DATA_SIZE If the operation failed because not all the requested data could fit into the
AnnaBridge 143:86740a56073b 223 * advertising packet. The maximum size of the advertisement packet
AnnaBridge 143:86740a56073b 224 * is @ref BLE_GAP_ADV_MAX_SIZE.
AnnaBridge 143:86740a56073b 225 *
AnnaBridge 143:86740a56073b 226 * @warning This API may override the application's request to use the long name and use a short name
AnnaBridge 143:86740a56073b 227 * instead. This truncation will occur in case the long name does not fit the provided buffer size.
AnnaBridge 143:86740a56073b 228 * The application can specify a preferred short name length if truncation is required.
AnnaBridge 143:86740a56073b 229 * For example, if the complete device name is ABCD_HRMonitor, the application can specify the short name
AnnaBridge 143:86740a56073b 230 * length to be 8, so that the short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni
AnnaBridge 143:86740a56073b 231 * if the available size for the short name is 9 or 12 respectively, to have a more appropriate short name.
AnnaBridge 143:86740a56073b 232 * However, it should be noted that this is just a preference that the application can specify, and
AnnaBridge 143:86740a56073b 233 * if the preference is too large to fit in the provided buffer, the name can be truncated further.
AnnaBridge 143:86740a56073b 234 */
AnnaBridge 143:86740a56073b 235 uint32_t ble_advdata_set(const ble_advdata_t * p_advdata, const ble_advdata_t * p_srdata);
AnnaBridge 143:86740a56073b 236
AnnaBridge 143:86740a56073b 237 #endif // BLE_ADVDATA_H__
AnnaBridge 143:86740a56073b 238
AnnaBridge 143:86740a56073b 239 /** @} */