Generation of NFC NDEF records for NFC messages. More...
Data Structures |
|
| struct | nfc_ndef_record_desc_t |
|
NDEF record descriptor.
More...
|
|
| struct | nfc_ndef_bin_payload_desc_t |
|
Binary data descriptor containing the payload for the record.
More...
|
|
Macros |
|
| #define | NDEF_RECORD_IL_MASK 0x08 |
|
Mask of the ID field presence bit in the flags byte of an NDEF record.
|
|
| #define | NDEF_RECORD_TNF_MASK 0x07 |
|
Mask of the TNF value field in the first byte of an NDEF record.
|
|
| #define | NDEF_RECORD_SR_MASK 0x10 |
|
Mask of the SR flag. If set, this flag indicates that the PAYLOAD_LENGTH field has a size of 1 byte. Otherwise, PAYLOAD_LENGTH has 4 bytes.
|
|
| #define | NDEF_RECORD_PAYLOAD_LEN_LONG_SIZE 4 |
|
Size of the Payload Length field in a long NDEF record.
|
|
| #define | NDEF_RECORD_PAYLOAD_LEN_SHORT_SIZE 1 |
|
Size of the Payload Length field in a short NDEF record.
|
|
| #define | NDEF_RECORD_ID_LEN_SIZE 1 |
|
Size of the ID Length field in an NDEF record.
|
|
| #define | NDEF_RECORD_LOCATION_MASK ( NDEF_LONE_RECORD ) |
|
Mask of the Record Location bits in the NDEF record's flags byte.
|
|
| #define | NFC_NDEF_GENERIC_RECORD_DESC_DEF (NAME,TNF,P_ID,ID_LEN,P_TYPE,TYPE_LEN,P_PAYLOAD_CONSTRUCTOR,P_PAYLOAD_DESCRIPTOR) |
|
Macro for creating and initializing an NFC NDEF record descriptor for a generic record.
More...
|
|
| #define | NFC_NDEF_GENERIC_RECORD_DESC (NAME) (NAME##_ndef_generic_record_desc) |
|
Macro for accessing the NFC NDEF record descriptor instance that you created with
NFC_NDEF_GENERIC_RECORD_DESC_DEF
.
|
|
| #define | NFC_NDEF_RECORD_BIN_DATA_DEF (NAME,TNF,P_ID, ID_LEN,P_TYPE,TYPE_LEN,P_PAYLOAD,PAYLOAD_LEN) |
|
Macro for creating and initializing an NFC NDEF record descriptor for a record with binary payload.
More...
|
|
| #define | NFC_NDEF_RECORD_BIN_DATA (NAME) (NAME##_nfc_ndef_bin_record_desc) |
|
Macro for accessing the NFC NDEF record descriptor instance that you created with
NFC_NDEF_RECORD_BIN_DATA_DEF
.
|
|
| #define | NFC_NDEF_BIN_PAYLOAD_DESC (NAME) (NAME##_nfc_ndef_bin_payload_desc) |
|
Macro for accessing the binary data descriptor that contains the payload of the record that you created with
NFC_NDEF_RECORD_BIN_DATA_DEF
.
|
|
Typedefs |
|
| typedef ret_code_t (* | p_payload_constructor_t )(void *p_payload_descriptor, uint8_t *p_buffer, uint32_t *p_len) |
|
Payload constructor type.
More...
|
|
Enumerations |
|
| enum |
nfc_ndef_record_tnf_t
{
TNF_EMPTY = 0x00, TNF_WELL_KNOWN = 0x01, TNF_MEDIA_TYPE = 0x02, TNF_ABSOLUTE_URI = 0x03, TNF_EXTERNAL_TYPE = 0x04, TNF_UNKNOWN_TYPE = 0x05, TNF_UNCHANGED = 0x06, TNF_RESERVED = 0x07 } |
|
Type Name Format (TNF) Field Values.
More...
|
|
| enum |
nfc_ndef_record_location_t
{
NDEF_FIRST_RECORD = 0x80, NDEF_MIDDLE_RECORD = 0x00, NDEF_LAST_RECORD = 0x40, NDEF_LONE_RECORD = 0xC0 } |
|
Record position within the NDEF message.
More...
|
|
Functions |
|
| ret_code_t | nfc_ndef_record_encode ( nfc_ndef_record_desc_t const *p_ndef_record_desc, nfc_ndef_record_location_t record_location, uint8_t *p_record_buffer, uint32_t *p_record_len) |
|
Function for encoding an NDEF record.
More...
|
|
| ret_code_t | nfc_ndef_bin_payload_memcopy ( nfc_ndef_bin_payload_desc_t *p_payload_descriptor, uint8_t *p_buffer, uint32_t *p_len) |
|
Function for constructing the payload for an NFC NDEF record from binary data.
More...
|
|
Detailed Description
Generation of NFC NDEF records for NFC messages.
Macro Definition Documentation
| #define NFC_NDEF_GENERIC_RECORD_DESC_DEF | ( | NAME, | |
| TNF, | |||
| P_ID, | |||
| ID_LEN, | |||
| P_TYPE, | |||
| TYPE_LEN, | |||
| P_PAYLOAD_CONSTRUCTOR, | |||
| P_PAYLOAD_DESCRIPTOR | |||
| ) |
Macro for creating and initializing an NFC NDEF record descriptor for a generic record.
This macro creates and initializes a static instance of type nfc_ndef_record_desc_t .
Use the macro NFC_NDEF_GENERIC_RECORD_DESC to access the NDEF record descriptor instance.
- Parameters
-
[in] NAME Name of the created descriptor instance. [in] TNF Type Name Format (TNF) value for the record. [in] P_ID Pointer to the ID string. [in] ID_LEN Length of the ID string. [in] P_TYPE Pointer to the type string. [in] TYPE_LEN Length of the type string. [in] P_PAYLOAD_CONSTRUCTOR Pointer to the payload constructor function. The constructor must be of type p_payload_constructor_t . [in] P_PAYLOAD_DESCRIPTOR Pointer to the data for the payload constructor.
| #define NFC_NDEF_RECORD_BIN_DATA_DEF | ( | NAME, | |
| TNF, | |||
| P_ID, | |||
| ID_LEN, | |||
| P_TYPE, | |||
| TYPE_LEN, | |||
| P_PAYLOAD, | |||
| PAYLOAD_LEN | |||
| ) |
Macro for creating and initializing an NFC NDEF record descriptor for a record with binary payload.
This macro creates and initializes a static instance of type nfc_ndef_record_desc_t and a binary data descriptor containing the payload data.
Use the macro NFC_NDEF_RECORD_BIN_DATA to access the NDEF record descriptor instance.
- Parameters
-
[in] NAME Name of the created descriptor instance. [in] TNF Type Name Format (TNF) value for the record. [in] P_ID Pointer to the ID string. [in] ID_LEN Length of the ID string. [in] P_TYPE Pointer to the type string. [in] TYPE_LEN Length of the type string. [in] P_PAYLOAD Pointer to the payload data that will be copied to the payload field. [in] PAYLOAD_LEN Length of the payload.
Typedef Documentation
| typedef ret_code_t (* p_payload_constructor_t)(void *p_payload_descriptor, uint8_t *p_buffer, uint32_t *p_len) |
Payload constructor type.
A payload constructor is a function for constructing the payload of an NDEF record.
- Parameters
-
[in] p_payload_descriptor Pointer to the input data for the constructor. [out] p_buffer Pointer to the payload destination. If NULL, function will calculate the expected size of the record payload. [in,out] p_len Size of the available memory to write as input. Size of the generated record payload as output. The implementation must check if the payload will fit in the provided buffer. This must be checked by the caller function.
- Return values
-
NRF_SUCCESS If the function completed successfully. NRF_ERROR_xxx If an error occurred.
Enumeration Type Documentation
Type Name Format (TNF) Field Values.
Values to specify the TNF of a record.
Function Documentation
| ret_code_t nfc_ndef_bin_payload_memcopy | ( | nfc_ndef_bin_payload_desc_t * | p_payload_descriptor , |
| uint8_t * | p_buffer , | ||
| uint32_t * | p_len | ||
| ) |
Function for constructing the payload for an NFC NDEF record from binary data.
This function copies data from a binary buffer to the payload field of the NFC NDEF record.
- Parameters
-
[in] p_payload_descriptor Pointer to the descriptor of the binary data location and size. [out] p_buffer Pointer to the payload destination. If NULL, function will calculate the expected size of the record payload. [in,out] p_len Size of the available memory for the payload as input. Size of the copied payload as output.
- Return values
-
NRF_SUCCESS If the function completed successfully. NRF_ERROR_NO_MEM If the payload size is bigger than the provided buffer space.
| ret_code_t nfc_ndef_record_encode | ( | nfc_ndef_record_desc_t const * | p_ndef_record_desc , |
| nfc_ndef_record_location_t | record_location , | ||
| uint8_t * | p_record_buffer , | ||
| uint32_t * | p_record_len | ||
| ) |
Function for encoding an NDEF record.
This function encodes an NDEF record according to the provided record descriptor.
- Parameters
-
[in] p_ndef_record_desc Pointer to the record descriptor. [in] record_location Location of the record within the NDEF message. [out] p_record_buffer Pointer to the record destination. If NULL, function will calculate the expected size of the record. [in,out] p_record_len Size of the available memory for the record as input. Size of the generated record as output.
- Return values
-
NRF_SUCCESS If the record was encoded successfully. NRF_ERROR_NO_MEM If the predicted record size is bigger than the provided buffer space. NRF_ERROR_INVALID_PARAM If the location of the record is erroneous. Other Other codes might be returned depending on the NDEF record payload constructor implementation.