nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
tnep_rec.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NFC_NDEF_TNEP_REC_H_
8#define NFC_NDEF_TNEP_REC_H_
9
18#include <zephyr/types.h>
19#include <nfc/ndef/record.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#define NFC_NDEF_TNEP_REC_TYPE_LEN 2
26
27/*
28 * @brief External reference to the type field of the TNEP records,
29 * defined in the file @c nfc_tnep_rec.c.
30 */
31extern const uint8_t nfc_ndef_tnep_rec_type_svc_param[];
32extern const uint8_t nfc_ndef_tnep_rec_type_svc_select[];
33extern const uint8_t nfc_ndef_tnep_rec_type_status[];
34
38 uint8_t status;
39};
40
44 uint8_t uri_len;
45
47 const uint8_t *uri;
48};
49
53 uint8_t version;
54
56 uint8_t uri_length;
57
59 const uint8_t *uri;
60
63
65 uint8_t min_time;
66
68 uint8_t max_time_ext;
69
71 uint16_t max_size;
72};
73
88 uint8_t *buffer, uint32_t *len);
89
104 uint8_t *buffer, uint32_t *len);
105
120 uint8_t *buffer, uint32_t *len);
121
136#define NFC_TNEP_STATUS_RECORD_DESC_DEF(_name, _status) \
137 struct nfc_ndef_tnep_rec_status _name = { \
138 .status = _status, \
139 }; \
140 \
141 NFC_NDEF_GENERIC_RECORD_DESC_DEF(_name, TNF_WELL_KNOWN, \
142 0, 0, \
143 nfc_ndef_tnep_rec_type_status, \
144 NFC_NDEF_TNEP_REC_TYPE_LEN, \
145 nfc_ndef_tnep_rec_status_payload,\
146 &(_name))
147
163#define NFC_TNEP_SERIVCE_SELECT_RECORD_DESC_DEF(_name, _uri_length, _uri) \
164 struct nfc_ndef_tnep_rec_svc_select _name = { \
165 .uri_len = _uri_length, \
166 .uri = _uri, \
167 }; \
168 \
169 NFC_NDEF_GENERIC_RECORD_DESC_DEF(_name, TNF_WELL_KNOWN, \
170 0, 0, \
171 nfc_ndef_tnep_rec_type_svc_select, \
172 NFC_NDEF_TNEP_REC_TYPE_LEN, \
173 nfc_ndef_tnep_rec_svc_select_payload, \
174 &(_name))
175
197#define NFC_TNEP_SERIVCE_PARAM_RECORD_DESC_DEF(_name, _tnep_version, \
198 _uri_length, _uri, \
199 _mode, _min_time, \
200 _max_time_ext, \
201 _max_message_size) \
202 struct nfc_ndef_tnep_rec_svc_param _name = { \
203 .version = _tnep_version, \
204 .uri_length = _uri_length, \
205 .uri = _uri, \
206 .communication_mode = _mode, \
207 .min_time = _min_time, \
208 .max_time_ext = _max_time_ext, \
209 .max_size = _max_message_size, \
210 }; \
211 \
212 NFC_NDEF_GENERIC_RECORD_DESC_DEF(_name, TNF_WELL_KNOWN, \
213 0, 0, \
214 nfc_ndef_tnep_rec_type_svc_param, \
215 NFC_NDEF_TNEP_REC_TYPE_LEN, \
216 nfc_ndef_tnep_rec_svc_param_payload, \
217 &(_name))
218
224#define NFC_NDEF_TNEP_RECORD_DESC(_name) NFC_NDEF_GENERIC_RECORD_DESC(_name)
225
226#ifdef __cplusplus
227}
228#endif
229
234#endif /* NFC_NDEF_TNEP_REC_H_ */
int nfc_ndef_tnep_rec_status_payload(struct nfc_ndef_tnep_rec_status *payload_desc, uint8_t *buffer, uint32_t *len)
Payload constructor for the NDEF TNEP Status Record.
const uint8_t nfc_ndef_tnep_rec_type_svc_select[]
int nfc_ndef_tnep_rec_svc_select_payload(struct nfc_ndef_tnep_rec_svc_select *payload_desc, uint8_t *buffer, uint32_t *len)
Payload constructor for the TNEP Service Select Record.
const uint8_t nfc_ndef_tnep_rec_type_svc_param[]
int nfc_ndef_tnep_rec_svc_param_payload(struct nfc_ndef_tnep_rec_svc_param *payload_desc, uint8_t *buffer, uint32_t *len)
Payload constructor for the Service Parameter Record.
const uint8_t nfc_ndef_tnep_rec_type_status[]
uint8_t status
Definition: tnep_rec.h:38
TNEP Status.
Definition: tnep_rec.h:36
uint8_t communication_mode
Definition: tnep_rec.h:62
const uint8_t * uri
Definition: tnep_rec.h:59
uint8_t min_time
Definition: tnep_rec.h:65
uint8_t uri_length
Definition: tnep_rec.h:56
uint16_t max_size
Definition: tnep_rec.h:71
uint8_t version
Definition: tnep_rec.h:53
uint8_t max_time_ext
Definition: tnep_rec.h:68
Service Parameters in the TNEP's Initial NDEF message.
Definition: tnep_rec.h:51
uint8_t uri_len
Definition: tnep_rec.h:44
const uint8_t * uri
Definition: tnep_rec.h:47
Service structure.
Definition: tnep_rec.h:42