Functions for parsing and decoding data in the Advertising and Scan Response Data format for NFC OOB pairing.
More...
Functions for parsing and decoding data in the Advertising and Scan Response Data format for NFC OOB pairing.
#define BLE_ADVDATA_APPEARANCE_NOT_PRESENT 0 |
Appearance AD structure not present.
Function for parsing BLE data encoded in AD Type format.
This function parses BLE data encoded in Advertising Data Type format which can be generated with adv_data_encode function. The result of the parsing is stored within nfc_ble_oob_pairing_data_t structure.
- Note
- Currently, module can be used to parse BLE AD Type data, which contains AD Structures with following GAP AD Types: Flags, Shortened and Complete Device Name, Security Manager TK Value and OOB Flags, Appearance, LE Bluetooth Device Address and LE Role.
- Warning
- Before passing
p_nfc_ble_pairing_data
structure to this function, it is necessary to provide buffers for AD Structures Data, which are expected to be found within parsed buffer. This applies to following GAP AD Types with corresponding structures: Shortened and Complete Device Name - ble_gap_dev_name_t, LE Bluetooth Device Address - ble_gap_addr_t, Security Manager TK Value - ble_advdata_tk_value_t and Security Manager OOB Flags - uint8_t.
- Parameters
-
[in] | p_advdata | Pointer to the data to be parsed. |
[in] | len | Size of the data to be parsed. |
[out] | p_nfc_ble_pairing_data | Pointer to the structure that will be used to hold parsed data. |
- Return values
-
NRF_SUCCESS | If the function completed successfully. |
NRF_ERROR_NO_MEM | If the provided buffer for device name is too small to hold parsed data. |
NRF_ERROR_INVALID_LENGTH | If any AD Structure Length field contains different value than expected. |
NRF_ERROR_INVALID_PARAM | If any AD Structure Data field contains invalid parameters. |
NRF_ERROR_NULL | If any function pointer parameter is NULL or any expected buffer in p_nfc_ble_pairing_data was not provided. |
NRF_ERROR_NOT_SUPPORTED | If any AD Structure Type field contains type which is not supported or any AD Structure Type occurs more than once. |
ret_code_t nfc_ble_oob_advdata_parser_field_find |
( |
uint8_t |
type, |
|
|
uint8_t * |
p_advdata, |
|
|
uint8_t * |
p_len, |
|
|
uint8_t ** |
pp_field_data |
|
) |
| |
Function for finding BLE AD Type data within buffer encoded in AD Type format.
This function finds BLE AD Type data within buffer encoded in AD Type format The AD Data to be found can be specified by its AD Type - type
.
- Parameters
-
[in] | type | AD Type of AD Structure to be found within p_advdata . |
[in] | p_advdata | Pointer to the data to be parsed. |
[in,out] | p_len | As input: size of the data to be parsed. As output: size of the AD Data within found AD structure. |
[out] | pp_field_data | Pointer to AD Data within found AD Structure. |
- Return values
-
NRF_SUCCESS | If chosen AD Type was found successfully. |
NRF_ERROR_INVALID_LENGTH | If any AD Structure Length field value indicates that AD Structure exceeds provided buffer. |
NRF_ERROR_NULL | If any function pointer parameter is NULL. |
NRF_ERROR_NOT_FOUND | If chosen AD Type - type was not found. |
Function for displaying values of basic BLE OOB Advertising data types.
- Parameters
-
[in] | p_pairing_data | Structure containing parsed data. |