| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Macros | Functions
NDEF message parser (internal)
Parser for NDEF messages

Internal part of the parser for NFC NDEF messages. More...

## Data Structures
struct | nfc_ndef_parser_memo_desc_t
| Type for holding descriptors that are used by the NDEF parser. More...
struct | parsed_ndef_msg_1_t
| Memory allocated for a one-record message. More...
struct | parsed_ndef_msg_2_t
| Memory allocated for a two-record message. More...

## Macros
#define | NFC_PARSER_M_DELTA (sizeof(parsed_ndef_msg_2_t) - sizeof(parsed_ndef_msg_1_t))
| Amount of memory that is required per record in addition to the memory allocated for the message descriptor.

## Functions
ret_code_t | ndef_parser_memo_resolve (uint8_t *const p_result_buf, uint32_t *const p_result_buf_len, nfc_ndef_parser_memo_desc_t *const p_parser_memo_desc)
| Function for resolving data instances in the provided buffer according to requirements of the function internal_ndef_msg_parser. More...
ret_code_t | internal_ndef_msg_parser (nfc_ndef_parser_memo_desc_t *const p_parser_memo_desc, uint8_t const *p_nfc_data, uint32_t *const p_nfc_data_len)
| Function for parsing NFC NDEF messages. More...

## Detailed Description

Internal part of the parser for NFC NDEF messages.

## Function Documentation

ret_code_t internal_ndef_msg_parser | ( | nfc_ndef_parser_memo_desc_t *const | p_parser_memo_desc,
|  | uint8_t const * | p_nfc_data,
|  | uint32_t *const | p_nfc_data_len
| ) |  |

Function for parsing NFC NDEF messages.

This internal function parses NDEF messages into certain data instances.

This function should not be used directly.

Parameters

  [in,out] | p_parser_memo_desc | Pointer to the structure that holds descriptors of the allocated data instances for the parser. This structure contains the following fields: .p_msg_desc Pointer to the message descriptor that will be filled with parsed data. .p_bin_pay_desc Pointer to the array of binary payload descriptors that will be filled with parsed data. .p_rec_desc Pointer to the array of record descriptors that will be filled with parsed data. The arrays specified by ``.p_bin_pay_desc and ``.p_rec_desc must not contain more elements than the message descriptor specified by ``.p_msg_desc can hold.
  [in] | p_nfc_data | Pointer to the data to be parsed.
  [in,out] | p_nfc_data_len | As input: size of the NFC data in the `p_nfc_data` buffer. As output: size of the parsed message.

Return values

  NRF_SUCCESS | If the function completed successfully.
  NRF_ERROR_INVALID_LENGTH | If the expected message length is bigger than the amount of provided input data.
  NRF_ERROR_INVALID_DATA | If the message is not a valid NDEF message.
  NRF_ERROR_NO_MEM | If the provided memory resources are too small to hold the parsing result.

ret_code_t ndef_parser_memo_resolve | ( | uint8_t *const | p_result_buf,
|  | uint32_t *const | p_result_buf_len,
|  | nfc_ndef_parser_memo_desc_t *const | p_parser_memo_desc
| ) |  |

Function for resolving data instances in the provided buffer according to requirements of the function internal_ndef_msg_parser.

This internal function distributes the provided memory between certain data instances that are required by internal_ndef_msg_parser.

This function should not be used directly.

Parameters

  [in] | p_result_buf | Pointer to the buffer that will be used to allocate data instances.
  [in,out] | p_result_buf_len | As input: size of the buffer specified by `p_result_buf`. As output: size of the reserved (used) part of the buffer specified by `p_result_buf`.
  [out] | p_parser_memo_desc | Pointer to the structure for holding descriptors of the allocated data instances.

Return values

  NRF_SUCCESS | If the function completed successfully.
  NRF_ERROR_NO_MEM | If the provided buffer is too small to hold a one-record message.