nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
parser.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_T2T_PARSER_H_
8#define NFC_T2T_PARSER_H_
9
10#include <stdint.h>
11#include <nfc/t2t/tlv_block.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
26struct nfc_t2t_sn {
31
34
37
41 uint8_t check_byte_0;
42
46 uint8_t check_byte_1;
47
49 uint8_t internal;
50};
51
54struct nfc_t2t_cc {
57
60
63
65 uint8_t read_access;
66
68 uint8_t write_access;
69};
70
73struct nfc_t2t {
75 struct nfc_t2t_sn sn;
76
78 uint16_t lock_bytes;
79
81 struct nfc_t2t_cc cc;
82
84 const uint16_t max_tlv_blocks;
85
88
90 uint16_t tlv_count;
91};
92
107#define NFC_T2T_DESC_DEF(_name, _max_blocks) \
108 static struct nfc_t2t_tlv_block _name##_tlv_block_array[_max_blocks]; \
109 static struct nfc_t2t NFC_T2T_DESC(_name) = \
110 { \
111 .max_tlv_blocks = _max_blocks, \
112 .tlv_block_array = _name##_tlv_block_array, \
113 .tlv_count = 0 \
114 }
115
119#define NFC_T2T_DESC(_name) (_name##_t2t)
120
122#define NFC_T2T_NFC_FORUM_DEFINED_DATA 0xE1
123
127#define NFC_T2T_UID_BCC_CASCADE_BYTE 0x88
128
129
131#define NFC_T2T_SUPPORTED_MAJOR_VERSION 1
132
134#define NFC_T2T_SUPPORTED_MINOR_VERSION 0
135
137#define NFC_T2T_BLOCK_SIZE 4
138
140#define NFC_T2T_CC_BLOCK_OFFSET 12
141
143#define NFC_T2T_FIRST_DATA_BLOCK_OFFSET 16
144
145
151void nfc_t2t_clear(struct nfc_t2t *t2t);
152
168int nfc_t2t_parse(struct nfc_t2t *t2t, const uint8_t *raw_data);
169
175void nfc_t2t_printout(const struct nfc_t2t *t2t);
176
182#ifdef __cplusplus
183}
184#endif
185
186#endif /* NFC_T2T_PARSER_H_ */
int nfc_t2t_parse(struct nfc_t2t *t2t, const uint8_t *raw_data)
Parse raw data that was read from a Type 2 Tag.
void nfc_t2t_clear(struct nfc_t2t *t2t)
Clear the nfc_t2t structure.
void nfc_t2t_printout(const struct nfc_t2t *t2t)
Print parsed contents of the Type 2 Tag.
uint8_t read_access
Definition parser.h:65
uint8_t write_access
Definition parser.h:68
uint8_t minor_version
Definition parser.h:59
uint16_t data_area_size
Definition parser.h:62
uint8_t major_version
Definition parser.h:56
Descriptor for the Capability Container (CC) bytes of a Type 2 Tag.
Definition parser.h:54
uint8_t internal
Definition parser.h:49
uint16_t serial_number_part_1
Definition parser.h:33
uint8_t manufacturer_id
Definition parser.h:30
uint8_t check_byte_1
Definition parser.h:46
uint32_t serial_number_part_2
Definition parser.h:36
uint8_t check_byte_0
Definition parser.h:41
Descriptor for the internal bytes of a Type 2 Tag.
Definition parser.h:26
TLV block descriptor.
Definition tlv_block.h:53
struct nfc_t2t_cc cc
Definition parser.h:81
uint16_t tlv_count
Definition parser.h:90
struct nfc_t2t_sn sn
Definition parser.h:75
struct nfc_t2t_tlv_block * tlv_block_array
Definition parser.h:87
uint16_t lock_bytes
Definition parser.h:78
const uint16_t max_tlv_blocks
Definition parser.h:84
Type 2 Tag descriptor.
Definition parser.h:73