![]() |
nRF Connect SDK Bare Metal API 2.0.99
|
| uint32_t ble_adv_data_encode | ( | const struct ble_adv_data * | ble_adv_data, |
| uint8_t * | buf, | ||
| uint16_t * | len ) |
#include <ble_adv_data.h>
Encode data in the Advertising and Scan Response data format.
This function encodes data into the Advertising and Scan Response data format based on the fields in the supplied structures. This function can be used to create a payload of Advertising packet or Scan Response packet, or a payload of NFC message intended for initiating the Out-of-Band pairing.
| [in] | ble_adv_data | Bluetooth LE advertising data context. |
| [out] | buf | Output buffer. |
| [in,out] | len | Size of buf on input, length of encoded data on output. |
| NRF_SUCCESS | If the operation was successful. |
| NRF_ERROR_INVALID_ADDR | Invalid address. |
| NRF_ERROR_INVALID_PARAM | Invalid parameter provided in the advertising data context. |
| NRF_ERROR_NULL | ble_adv_data, buf or len is NULL. |
| NRF_ERROR_DATA_SIZE | Buffer is too small to encode all data. |