nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
msg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NFC_NDEF_MSG_H_
8#define NFC_NDEF_MSG_H_
9
10#include <zephyr/types.h>
11#include <nfc/ndef/record.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
38 uint32_t record_count;
39};
40
56int nfc_ndef_msg_encode(struct nfc_ndef_msg_desc const *ndef_msg_desc,
57 uint8_t *msg_buffer,
58 uint32_t *msg_len);
59
69
80 struct nfc_ndef_record_desc const *record);
81
98#define NFC_NDEF_MSG_DEF(name, max_record_cnt) \
99 struct nfc_ndef_record_desc const \
100 *name##_nfc_ndef_record_desc_array[max_record_cnt]; \
101 struct nfc_ndef_msg_desc name##_nfc_ndef_msg_desc = \
102 { \
103 .record = name##_nfc_ndef_record_desc_array, \
104 .max_record_count = max_record_cnt, \
105 .record_count = 0 \
106 }
107
111#define NFC_NDEF_MSG(name) (name##_nfc_ndef_msg_desc)
112
136#define NFC_NDEF_NESTED_NDEF_MSG_RECORD_DEF(name, \
137 tnf_arg, \
138 id_arg, \
139 id_len, \
140 type_arg, \
141 type_len, \
142 nested_message) \
143 struct nfc_ndef_record_desc name##_ndef_record_nested_desc = \
144 { \
145 .tnf = tnf_arg, \
146 .id_length = id_len, \
147 .id = id_arg, \
148 .type_length = type_len, \
149 .type = type_arg, \
150 .payload_constructor = \
151 (payload_constructor_t)(nfc_ndef_msg_encode), \
152 .payload_descriptor = (void *) (nested_message) \
153 }
154
158#define NFC_NDEF_NESTED_NDEF_MSG_RECORD(name) (name##_ndef_record_nested_desc)
159
164#ifdef __cplusplus
165}
166#endif
167
168#endif /* NFC_NDEF_MSG_H_*/
int nfc_ndef_msg_encode(struct nfc_ndef_msg_desc const *ndef_msg_desc, uint8_t *msg_buffer, uint32_t *msg_len)
Encode an NDEF message.
int nfc_ndef_msg_record_add(struct nfc_ndef_msg_desc *msg, struct nfc_ndef_record_desc const *record)
Add a record to an NDEF message.
void nfc_ndef_msg_clear(struct nfc_ndef_msg_desc *msg)
Clear an NDEF message.
uint32_t max_record_count
Definition: msg.h:36
uint32_t record_count
Definition: msg.h:38
struct nfc_ndef_record_desc const ** record
Definition: msg.h:32
NDEF message descriptor.
Definition: msg.h:30
NDEF record descriptor.
Definition: record.h:91