![]() |
nRF Connect SDK Bare Metal API 2.0.99
|
| uint16_t ble_adv_data_search | ( | const uint8_t * | buf, |
| uint16_t | len, | ||
| uint16_t * | offset, | ||
| uint8_t | ad_type ) |
#include <ble_adv_data.h>
Search Advertising or Scan Response data for specific data types.
This function searches through encoded data e.g. the data produced by ble_adv_data_encode, or the data found in Advertising reports (BLE_GAP_EVT_ADV_REPORT), and returns the offset of the data within the data buffer.
The data with type ad_type can be found at buf[*offset] after calling the function. This function can iterate through multiple instances of data of one type by calling it again with the offset provided by the previous call.
Example code for finding multiple instances of one type of data: offset = 0; ble_advdata_search(&data, len, &offset, AD_TYPE); first_instance_of_data = data[offset]; ble_advdata_search(&data, len, &offset, AD_TYPE); second_instance_of_data = data[offset];
| [in] | buf | Encoded advertising data. |
| [in] | len | Buffer length. |
| [in,out] | offset | The offset to start searching from, on input. The offset the data type can be found at, on output. |
| [in] | ad_type | The type of data to search for. |
ad_type, or if buf or offset were NULL.