nRF Connect SDK API 2.8.99
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
39
55int nfc_ndef_msg_encode(struct nfc_ndef_msg_desc const *ndef_msg_desc,
56 uint8_t *msg_buffer,
57 uint32_t *msg_len);
58
68
79 struct nfc_ndef_record_desc const *record);
80
97#define NFC_NDEF_MSG_DEF(name, max_record_cnt) \
98 struct nfc_ndef_record_desc const \
99 *name##_nfc_ndef_record_desc_array[max_record_cnt]; \
100 struct nfc_ndef_msg_desc name##_nfc_ndef_msg_desc = \
101 { \
102 .record = name##_nfc_ndef_record_desc_array, \
103 .max_record_count = max_record_cnt, \
104 .record_count = 0 \
105 }
106
110#define NFC_NDEF_MSG(name) (name##_nfc_ndef_msg_desc)
111
135#define NFC_NDEF_NESTED_NDEF_MSG_RECORD_DEF(name, \
136 tnf_arg, \
137 id_arg, \
138 id_len, \
139 type_arg, \
140 type_len, \
141 nested_message) \
142 struct nfc_ndef_record_desc name##_ndef_record_nested_desc = \
143 { \
144 .tnf = tnf_arg, \
145 .id_length = id_len, \
146 .id = id_arg, \
147 .type_length = type_len, \
148 .type = type_arg, \
149 .payload_constructor = \
150 (payload_constructor_t)(nfc_ndef_msg_encode), \
151 .payload_descriptor = (void *) (nested_message) \
152 }
153
157#define NFC_NDEF_NESTED_NDEF_MSG_RECORD(name) (name##_ndef_record_nested_desc)
158
163#ifdef __cplusplus
164}
165#endif
166
167#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:35
uint32_t record_count
Definition msg.h:37
struct nfc_ndef_record_desc const ** record
Definition msg.h:31
NDEF message descriptor.
Definition msg.h:29
NDEF record descriptor.
Definition record.h:91