7#ifndef NFC_NDEF_RECORD_H_
8#define NFC_NDEF_RECORD_H_
10#include <zephyr/types.h>
27#define NDEF_RECORD_IL_MASK 0x08
29#define NDEF_RECORD_TNF_MASK 0x07
33#define NDEF_RECORD_SR_MASK 0x10
35#define NDEF_RECORD_PAYLOAD_LEN_LONG_SIZE 4
37#define NDEF_RECORD_PAYLOAD_LEN_SHORT_SIZE 1
38#define NDEF_RECORD_ID_LEN_SIZE 1
123#define NDEF_RECORD_LOCATION_MASK (NDEF_LONE_RECORD)
157#define NFC_NDEF_GENERIC_RECORD_DESC_DEF(name, \
163 payload_constructor_arg, \
164 payload_descriptor_arg) \
165 struct nfc_ndef_record_desc name##_ndef_generic_record_desc = \
168 .id_length = id_len, \
170 .type_length = type_len, \
172 .payload_constructor = \
173 (payload_constructor_t)payload_constructor_arg, \
174 .payload_descriptor = (void *) payload_descriptor_arg \
180#define NFC_NDEF_GENERIC_RECORD_DESC(name) (name##_ndef_generic_record_desc)
205#define NFC_NDEF_RECORD_BIN_DATA_DEF(name, \
213 struct nfc_ndef_bin_payload_desc name##_nfc_ndef_bin_payload_desc = \
215 .payload = payload_arg, \
216 .payload_length = payload_len \
219 struct nfc_ndef_record_desc name##_nfc_ndef_bin_record_desc = \
222 .id_length = id_len, \
224 .type_length = type_len, \
226 .payload_constructor = \
227 (payload_constructor_t) nfc_ndef_bin_payload_memcopy, \
228 .payload_descriptor = \
229 (void *) &name##_nfc_ndef_bin_payload_desc \
235#define NFC_NDEF_RECORD_BIN_DATA(name) (name##_nfc_ndef_bin_record_desc)
241#define NFC_NDEF_BIN_PAYLOAD_DESC(name) (name##_nfc_ndef_bin_payload_desc)
261 uint8_t *record_buffer,
262 uint32_t *record_len);
int(* payload_constructor_t)(void *payload_descriptor, uint8_t *buffer, uint32_t *len)
Payload constructor type.
Definition: record.h:57
nfc_ndef_record_tnf
Type Name Format (TNF) Field Values.
Definition: record.h:65
@ TNF_UNKNOWN_TYPE
Definition: record.h:81
@ TNF_ABSOLUTE_URI
Definition: record.h:75
@ TNF_RESERVED
Definition: record.h:85
@ TNF_EMPTY
Definition: record.h:69
@ TNF_MEDIA_TYPE
Definition: record.h:73
@ TNF_UNCHANGED
Definition: record.h:83
@ TNF_WELL_KNOWN
Definition: record.h:71
@ TNF_EXTERNAL_TYPE
Definition: record.h:77
int nfc_ndef_bin_payload_memcopy(struct nfc_ndef_bin_payload_desc *payload_descriptor, uint8_t *buffer, uint32_t *len)
Construct the payload for an NFC NDEF record from binary data.
nfc_ndef_record_location
Record position within the NDEF message.
Definition: record.h:115
@ NDEF_LONE_RECORD
Definition: record.h:119
@ NDEF_FIRST_RECORD
Definition: record.h:116
@ NDEF_MIDDLE_RECORD
Definition: record.h:117
@ NDEF_LAST_RECORD
Definition: record.h:118
int nfc_ndef_record_encode(struct nfc_ndef_record_desc const *ndef_record_desc, enum nfc_ndef_record_location const record_location, uint8_t *record_buffer, uint32_t *record_len)
Encode an NDEF record.
uint32_t payload_length
Definition: record.h:130
uint8_t const * payload
Definition: record.h:129
Binary data descriptor containing the payload for the record.
Definition: record.h:128
uint8_t type_length
Definition: record.h:101
void * payload_descriptor
Definition: record.h:107
uint8_t const * id
Definition: record.h:99
payload_constructor_t payload_constructor
Definition: record.h:105
uint8_t const * type
Definition: record.h:103
enum nfc_ndef_record_tnf tnf
Definition: record.h:93
uint8_t id_length
Definition: record.h:97
NDEF record descriptor.
Definition: record.h:91