nRF Connect SDK API 3.3.99
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
87int nfc_ndef_tnep_rec_status_payload(struct nfc_ndef_tnep_rec_status *payload_desc, uint8_t *buffer,
88 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( \
142 _name, TNF_WELL_KNOWN, 0, 0, nfc_ndef_tnep_rec_type_status, \
143 NFC_NDEF_TNEP_REC_TYPE_LEN, nfc_ndef_tnep_rec_status_payload, &(_name))
144
160#define NFC_TNEP_SERVICE_SELECT_RECORD_DESC_DEF(_name, _uri_length, _uri) \
161 struct nfc_ndef_tnep_rec_svc_select _name = { \
162 .uri_len = _uri_length, \
163 .uri = _uri, \
164 }; \
165 \
166 NFC_NDEF_GENERIC_RECORD_DESC_DEF( \
167 _name, TNF_WELL_KNOWN, 0, 0, nfc_ndef_tnep_rec_type_svc_select, \
168 NFC_NDEF_TNEP_REC_TYPE_LEN, nfc_ndef_tnep_rec_svc_select_payload, &(_name))
169
191#define NFC_TNEP_SERVICE_PARAM_RECORD_DESC_DEF(_name, _tnep_version, _uri_length, _uri, _mode, \
192 _min_time, _max_time_ext, _max_message_size) \
193 struct nfc_ndef_tnep_rec_svc_param _name = { \
194 .version = _tnep_version, \
195 .uri_length = _uri_length, \
196 .uri = _uri, \
197 .communication_mode = _mode, \
198 .min_time = _min_time, \
199 .max_time_ext = _max_time_ext, \
200 .max_size = _max_message_size, \
201 }; \
202 \
203 NFC_NDEF_GENERIC_RECORD_DESC_DEF( \
204 _name, TNF_WELL_KNOWN, 0, 0, nfc_ndef_tnep_rec_type_svc_param, \
205 NFC_NDEF_TNEP_REC_TYPE_LEN, nfc_ndef_tnep_rec_svc_param_payload, &(_name))
206
212#define NFC_NDEF_TNEP_RECORD_DESC(_name) NFC_NDEF_GENERIC_RECORD_DESC(_name)
213
214#ifdef __cplusplus
215}
216#endif
217
222#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