nRF51 SDK: Advertising Data Encoder

| nRF51 SDK

- Home
- Related Pages
- API Reference
- Data Structures

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Enumerations | Functions
Advertising Data Encoder
BLE Libraries

Function for encoding the advertising data and/or scan response data, and passing them to the stack. More...

## Data Structures

struct | ble_advdata_uuid_list_t
| UUID list type. More...
struct | ble_advdata_conn_int_t
| Connection interval range structure. More...
struct | ble_advdata_manuf_data_t
| Manufacturer specific data structure. More...
struct | ble_advdata_service_data_t
| Service data structure. More...
struct | ble_advdata_t
| Advertising data structure. This contains all options and data needed for encoding and setting the advertising data. More...

## Enumerations

enum | ble_advdata_name_type_t { BLE_ADVDATA_NO_NAME, BLE_ADVDATA_SHORT_NAME, BLE_ADVDATA_FULL_NAME }
| Advertising data name type. This contains the options available for the device name inside the advertising data. More...

## Functions

uint32_t | ble_advdata_set (const ble_advdata_t *p_advdata, const ble_advdata_t *p_srdata)
| Function for encoding and setting the advertising data and/or scan response data. More...

## Detailed Description

Function for encoding the advertising data and/or scan response data, and passing them to the stack.

## Enumeration Type Documentation

enum ble_advdata_name_type_t

Advertising data name type. This contains the options available for the device name inside the advertising data.

Enumerator
BLE_ADVDATA_NO_NAME | Include no device name in advertising data.
BLE_ADVDATA_SHORT_NAME | Include short device name in advertising data.
BLE_ADVDATA_FULL_NAME | Include full device name in advertising data.

## Function Documentation

uint32_t ble_advdata_set | ( | const ble_advdata_t * | p_advdata,
|  | const ble_advdata_t * | p_srdata
| ) |  |

Function for encoding and setting the advertising data and/or scan response data.

This function encodes advertising data and/or scan response data based on the selections in the supplied structures, and passes the encoded data to the stack.

Parameters

  [in] | p_advdata | Structure for specifying the content of the advertising data. Set to NULL if advertising data is not to be set.
  [in] | p_srdata | Structure for specifying the content of the scan response data. Set to NULL if scan response data is not to be set.

Returns
  NRF_SUCCESS on success, NRF_ERROR_DATA_SIZE if not all the requested data could fit into the advertising packet. The maximum size of the advertisement packet is BLE_GAP_ADV_MAX_SIZE.

Warning
  This API may override application's request to use the long name and use a short name instead. This truncation will occur in case the long name does not fit advertisement data size. Application is permitted to specify a preferred short name length in case truncation is required. For example, if the complete device name is ABCD_HRMonitor, application can specify short name length to 8 such that short device name appears as ABCD_HRM instead of ABCD_HRMo or ABCD_HRMoni etc if available size for short name is 9 or 12 respectively to have more apporpriate short name. However, it should be noted that this is just a preference that application can specify and if the preference too large to fit in Advertisement Data, this can be further truncated.