Loading...
Searching...
No Matches
iso14443_3a.h
1#pragma once
2
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#define ISO14443_3A_UID_4_BYTES (4U)
11#define ISO14443_3A_UID_7_BYTES (7U)
12#define ISO14443_3A_UID_10_BYTES (10U)
13#define ISO14443_3A_MAX_UID_SIZE ISO14443_3A_UID_10_BYTES
14
15#define ISO14443_3A_GUARD_TIME_US (5000)
16#define ISO14443_3A_FDT_POLL_FC (1620)
17#define ISO14443_3A_FDT_LISTEN_FC (1172)
18#define ISO14443_3A_POLLER_MASK_RX_FS ((ISO14443_3A_FDT_LISTEN_FC) / 2)
19#define ISO14443_3A_POLL_POLL_MIN_US (1100)
20
21typedef enum {
22 Iso14443_3aErrorNone,
23 Iso14443_3aErrorNotPresent,
24 Iso14443_3aErrorColResFailed,
25 Iso14443_3aErrorBufferOverflow,
26 Iso14443_3aErrorCommunication,
27 Iso14443_3aErrorFieldOff,
28 Iso14443_3aErrorWrongCrc,
29 Iso14443_3aErrorTimeout,
30} Iso14443_3aError;
31
32typedef struct {
33 uint8_t sens_resp[2];
35
36typedef struct {
37 uint8_t sel_cmd;
38 uint8_t sel_par;
39 uint8_t data[4]; // max data bit is 32
41
42typedef struct {
43 uint8_t nfcid[4];
44 uint8_t bss;
46
47typedef struct {
48 uint8_t sel_cmd;
49 uint8_t sel_par;
50 uint8_t nfcid[4];
51 uint8_t bcc;
53
54typedef struct {
55 uint8_t sak;
57
58typedef struct {
59 uint8_t uid[ISO14443_3A_MAX_UID_SIZE];
60 uint8_t uid_len;
61 uint8_t atqa[2];
62 uint8_t sak;
64
65Iso14443_3aData* iso14443_3a_alloc(void);
66
67void iso14443_3a_free(Iso14443_3aData* data);
68
69void iso14443_3a_reset(Iso14443_3aData* data);
70
71void iso14443_3a_copy(Iso14443_3aData* data, const Iso14443_3aData* other);
72
73bool iso14443_3a_verify(Iso14443_3aData* data, const FuriString* device_type);
74
75bool iso14443_3a_load(Iso14443_3aData* data, FlipperFormat* ff, uint32_t version);
76
77bool iso14443_3a_save(const Iso14443_3aData* data, FlipperFormat* ff);
78
79bool iso14443_3a_is_equal(const Iso14443_3aData* data, const Iso14443_3aData* other);
80
81const char* iso14443_3a_get_device_name(const Iso14443_3aData* data, NfcDeviceNameType name_type);
82
83const uint8_t* iso14443_3a_get_uid(const Iso14443_3aData* data, size_t* uid_len);
84
85bool iso14443_3a_set_uid(Iso14443_3aData* data, const uint8_t* uid, size_t uid_len);
86
87Iso14443_3aData* iso14443_3a_get_base_data(const Iso14443_3aData* data);
88
89uint32_t iso14443_3a_get_cuid(const Iso14443_3aData* data);
90
91// Getters and tests
92
93bool iso14443_3a_supports_iso14443_4(const Iso14443_3aData* data);
94
95uint8_t iso14443_3a_get_sak(const Iso14443_3aData* data);
96
97void iso14443_3a_get_atqa(const Iso14443_3aData* data, uint8_t atqa[2]);
98
99// Setters
100
101void iso14443_3a_set_sak(Iso14443_3aData* data, uint8_t sak);
102
103void iso14443_3a_set_atqa(Iso14443_3aData* data, const uint8_t atqa[2]);
104
105#ifdef __cplusplus
106}
107#endif
Bit Buffer.
NfcDeviceNameType
Verbosity level of the displayed NFC device name.
Definition nfc_device_base.h:14
Abstract interface definitions for the NFC device system.
Definition flipper_format.c:12
Definition string.c:4
Definition iso14443_3a.h:58
Definition iso14443_3a.h:36
Definition iso14443_3a.h:42
Definition iso14443_3a.h:47
Definition iso14443_3a.h:54
Definition iso14443_3a.h:32