M5Unit-NFC 0.0.3 git rev:59f5362
Loading...
Searching...
No Matches
nfca.hpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
3 *
4 * SPDX-License-Identifier: MIT
5 */
10#ifndef M5_UNIT_UNIFIED_NFC_NFC_A_NFCA_HPP
11#define M5_UNIT_UNIFIED_NFC_NFC_A_NFCA_HPP
12
13#include "nfc/nfc.hpp"
14#include "mifare.hpp"
15#include <cstdint>
16#include <string>
17#include <cstring>
18
19namespace m5 {
20namespace nfc {
25namespace a {
26
75
80enum class SubTypePlus : uint8_t {
81 None,
82 EV1,
83 EV2,
84 S,
85 X,
86 X_OR_EV,
87};
88
93enum SubTypeDESFire : uint8_t {
94 None,
95 EV1,
96 EV2,
97 EV3,
98};
99
101m5::nfc::NFCForumTag get_nfc_forum_tag_type(const Type t);
102
104inline bool is_mifare_classic(const Type t)
105{
106 return t >= Type::MIFARE_Classic_Mini && t <= Type::MIFARE_Classic_4K;
107}
108
110inline bool is_mifare_ultralight(const Type t)
111{
112 return t >= Type::MIFARE_Ultralight && t <= Type::MIFARE_UltralightC;
113}
114
116inline bool is_ntag2(const Type t)
117{
118 return t >= Type::NTAG_203 && t <= Type::NTAG_216;
119}
120
122inline bool is_ntag4(const Type t)
123{
124 return t == Type::NTAG_4XX;
125}
126
128inline bool is_mifare_plus(const Type t)
129{
130 return t >= Type::MIFARE_Plus_2K && t <= Type::MIFARE_Plus_SE;
131}
132
134inline bool is_mifare_classic_compatible(const Type t, const uint8_t sl)
135{
136 return is_mifare_plus(t) && (sl == 1);
137}
138
140inline bool is_mifare_desfire(const Type t)
141{
142 return t >= Type::MIFARE_DESFire_2K && t <= Type::MIFARE_DESFire_Light;
143}
144
146inline bool is_mifare(const Type t)
147{
149}
150
152inline bool is_st25ta(const Type t)
153{
154 return t >= Type::ST25TA_2K && t <= Type::ST25TA_64K;
155}
156
158inline bool is_iso14443_4(const Type t)
159{
160 return is_mifare_plus(t) || is_mifare_desfire(t) || is_st25ta(t) || (t == Type::ISO_14443_4);
161}
162
164inline bool is_iso14443_3(const Type t)
165{
166 return !is_iso14443_4(t);
167}
168
170inline bool supports_NFC(const Type t)
171{
172 return (t >= Type::MIFARE_Ultralight && t <= Type::MIFARE_UltralightC) || is_ntag2(t);
173}
174
176inline bool has_fast_read(const Type t)
177{
178 return t >= Type::NTAG_210 && t <= Type::NTAG_216;
179}
180
182inline bool has_sak_dependent_bit(const uint8_t sak)
183{
184 return (sak & 0x04);
185}
186
188inline bool is_sak_completed_14443_4(const uint8_t sak)
189{
190 return ((sak & 0x24) == 0x20);
191}
193inline bool is_sak_completed(const uint8_t sak)
194{
195 return ((sak & 0x24) == 0x00);
196}
197
203Type sak_to_type(const uint8_t sak);
205Type version3_to_type(const uint8_t info[8]);
207Type version4_to_type(uint8_t& sub, const uint8_t info[8]);
209Type historical_bytes_to_type(uint8_t& sub, const uint16_t atqa, const uint8_t sak, const uint8_t* bytes,
210 const uint8_t len);
211
213uint16_t get_number_of_blocks(const Type t);
215uint16_t get_number_of_user_blocks(const Type t);
217uint16_t get_user_area_size(const Type t);
223uint16_t get_unit_size(const Type t);
225uint16_t get_number_of_sectors(const Type t);
227uint16_t get_first_user_block(const Type t);
229uint16_t get_last_user_block(const Type t);
231bool is_user_block(const Type t, const uint16_t block);
232
234file_system_feature_t get_file_system_feature(const Type t);
236inline bool is_file_system_memory(const Type t)
237{
239}
245
247uint8_t calculate_bcc8(const uint8_t* data, const uint32_t len);
248
250const uint8_t* get_version3_response(const Type t);
251
256struct ATS {
257 union {
258 uint8_t header[5]{};
259 struct {
260 uint8_t TL;
261 uint8_t T0;
262 uint8_t TA;
263 uint8_t TB;
264 uint8_t TC;
265 };
266 };
267 std::array<uint8_t, 32> historical{};
268 uint8_t historical_len{};
269
270 inline bool validTA() const
271 {
272 return T0 & 0x10;
273 }
274 inline bool validTB() const
275 {
276 return T0 & 0x20;
277 }
278 inline bool validTC() const
279 {
280 return T0 & 0x40;
281 }
282 inline uint8_t fsci() const
283 {
284 return T0 & 0x0F;
285 }
286 inline Bitrate maximumBitrateDR() const
287 {
288 return validTA() ? static_cast<Bitrate>(TA & 0x07) : Bitrate::Invalid;
289 }
290 inline Bitrate maximumBitrateDS() const
291 {
292 return validTA() ? static_cast<Bitrate>((TA >> 4) & 0x07) : Bitrate::Invalid;
293 }
294 inline bool supportsAsymmetricSpeed() const
295 {
296 return validTA() && (TA & 0x80);
297 }
298 inline uint8_t fwi() const
299 {
300 return validTB() ? (TB >> 4) : 0x00;
301 }
302 inline uint8_t sfgi() const
303 {
304 return validTB() ? (TB & 0x0F) : 0x00;
305 }
306 inline uint32_t sfgt_fc() const
307 {
308 const uint8_t v = sfgi();
309 return (v == 0 || v == 15) ? 0u : (256u * 16u * (1u << v));
310 }
311 inline uint32_t sfgt_ms(const float fc) const
312 {
313 const uint32_t sfgt = sfgt_fc();
314 if (!sfgt || fc <= 0.0f) {
315 return 0;
316 }
317 const float us = (static_cast<float>(sfgt) / fc) * 1e6f;
318 uint32_t ms = static_cast<uint32_t>(us / 1000.f);
319 return ms ? ms : 1;
320 }
321 inline bool supportsNAD() const
322 {
323 return validTC() && (TC & 0x01);
324 }
325 inline bool supportsCID() const
326 {
327 return validTC() && (TC & 0x02);
328 }
329};
330
335struct PICC {
336 uint8_t _pad{};
338 uint8_t sak{};
339 uint8_t size{};
340 uint8_t uid[10]{};
341 uint16_t atqa{};
342 uint16_t blocks{};
345 union {
346 uint8_t sub_type{};
349 };
351 union {
352 uint8_t security_level{};
353 };
354
356 inline bool valid() const
357 {
358 return (size == 4 || size == 7 || size == 10) && (type != Type::Unknown) &&
360 }
362 void tail4(uint8_t buf[4]) const
363 {
364 if (buf) {
365 memcpy(buf, uid + size - 4, 4);
366 }
367 }
368 std::string uidAsString() const;
369 std::string typeAsString() const;
370
378 bool emulate(const Type t, const uint8_t* uid, const uint8_t uid_len);
379
383 inline bool isMifare() const
384 {
385 return is_mifare(type);
386 }
388 inline bool isMifareClassic() const
389 {
391 }
393 inline bool isMifareUltralight() const
394 {
396 }
398 inline bool isMifarePlus() const
399 {
400 return is_mifare_plus(type);
401 }
403 inline bool isMifarePlusX() const
404 {
405 return is_mifare_plus(type) && sub_type_plus == SubTypePlus::X;
406 }
408 inline bool isMifarePlusS() const
409 {
410 return is_mifare_plus(type) && sub_type_plus == SubTypePlus::S;
411 }
413 inline bool isMifarePlusSE() const
414 {
415 return type == Type::MIFARE_Plus_SE;
416 }
418 inline bool requiresPlusSL3PlainRead() const
419 {
420 return isMifarePlusS() || isMifarePlusSE();
421 }
422 inline bool isMifareClassicCompatible() const
423 {
425 }
427 inline bool isMifareDESFire() const
428 {
429 return is_mifare_desfire(type);
430 }
432 inline bool isNTAG2() const
433 {
434 return is_ntag2(type);
435 }
437 inline bool isISO14443_4() const
438 {
439 return is_iso14443_4(type);
440 }
442 inline bool isST25TA() const
443 {
444 return is_st25ta(type);
445 }
447
451 inline uint16_t totalSize() const
452 {
453 return valid()
455 : 0;
456 }
458 inline uint16_t userAreaSize() const
459 {
460 return valid() ? get_user_area_size(type) : 0;
461 }
463 inline uint16_t unitSize() const
464 {
465 return valid() ? get_unit_size(type) : 0;
466 }
467
469 inline uint16_t firstUserBlock() const
470 {
471 return valid() ? get_first_user_block(type) : 0xFFFF;
472 }
473 inline uint16_t lastUserBlock() const
474 {
475 return valid() ? get_last_user_block(type) : 0xFFFF;
476 }
478 inline bool isUserBlock(const uint8_t block) const
479 {
480 return valid() ? is_user_block(type, block) : false;
481 }
483
487 inline bool supportsNFC() const
488 {
489 return valid() && supports_NFC(type);
490 }
492 inline bool supportsNDEF() const
493 {
494 return valid() && nfcForumTagType() != NFCForumTag::None;
495 }
498 {
500 }
502 inline bool canFastRead() const
503 {
504 return valid() && has_fast_read(type);
505 }
508 {
509 return valid() ? get_file_system_feature(type) : 0;
510 }
511 inline bool isFileSystemMemory() const
512 {
513 return valid() && is_file_system_memory(type);
514 }
515 inline bool isFileSystemFile() const
516 {
517 return valid() && is_file_system_file(type);
518 }
520};
521
523inline bool operator==(const PICC& a, const PICC& b)
524{
525 return (a.size == b.size) && (a.sak == b.sak) && (a.type == b.type) && (a.blocks == b.blocks) &&
526 std::memcmp(a.uid, b.uid, 10) == 0;
527}
529inline bool operator!=(const PICC& a, const PICC& b)
530{
531 return !(a == b);
532}
533
538enum class Command : uint8_t {
539 // ISO/IEC 14443-3
540 REQA = 0x26,
541 WUPA = 0x52,
542 HLTA = 0x50,
543 SELECT_CL1 = 0x93,
544 SELECT_CL2 = 0x95,
545 SELECT_CL3 = 0x97,
546 SELCT_CL1_OPT = 0x92,
547 SELCT_CL2_OPT = 0x94,
548 SELCT_CL3_OPT = 0x96,
549 READ = 0x30,
550 // ISO/IEC 14443-4
551 RATS = 0xE0,
552 DESELECT = 0xC2,
553 // MIFARE
554 AUTH_WITH_KEY_A = 0x60,
555 AUTH_WITH_KEY_B = 0x61,
556 AUTHENTICATE_1 = 0x1A,
557 AUTHENTICATE_2 = 0xAF,
558 WRITE_BLOCK = 0xA0,
559 DECREMENT = 0xC0,
560 INCREMENT = 0xC1,
561 RESTORE = 0xC2,
562 TRANSFER = 0xB0,
563 PERSONALIZE_UID_USAGE = 0x40,
564 SET_MOD_TYPE = 0x43,
565 WRITE_PERSO = 0xA8,
566 COMMIT_PERSO = 0xAA,
567 // MIFARE,NTAG
568 WRITE_PAGE = 0xA2,
569 // NTAG
570 GET_VERSION = 0x60,
571 FAST_READ = 0x3A,
572 READ_CNT = 0x39,
573 PWD_AUTH = 0x1B,
574 READ_SIG = 0x3C,
575 WRITE_SIG = 0xA9,
576 LOCK_SIG = 0xAC,
577};
578
581constexpr uint32_t TIMEOUT_REQ_WUP{4}; // 4
582constexpr uint32_t TIMEOUT_SELECT{8}; // 4
583constexpr uint32_t TIMEOUT_ANTICOLL{8}; // 8
584constexpr uint32_t TIMEOUT_HALT{2};
585constexpr uint32_t TIMEOUT_GET_VERSION{5}; // 5
586constexpr uint32_t TIMEOUT_3DES{10};
587constexpr uint32_t TIMEOUT_AUTH1{4}; // 2
588constexpr uint32_t TIMEOUT_AUTH2{16}; // 10
589constexpr uint32_t TIMEOUT_READ{12};
590constexpr uint32_t TIMEOUT_FAST_READ{2};
591constexpr uint32_t TIMEOUT_FAST_READ_4PAGE{4}; // 3.7
592constexpr uint32_t TIMEOUT_FAST_READ_12PAGE{4}; // 3.7
593constexpr uint32_t TIMEOUT_FAST_READ_32PAGE{12}; // 11.8
594constexpr uint32_t TIMEOUT_WRITE1{5};
595constexpr uint32_t TIMEOUT_WRITE2{10};
596constexpr uint32_t TIMEOUT_VALUE_BLOCK{5}; // Value block operation
597constexpr uint32_t TIMEOUT_RATS{5};
598constexpr uint32_t TIMEOUT_DESELECT{8};
600
603constexpr uint8_t ACK_NIBBLE{0x0A};
605
610namespace st25ta {
611constexpr uint16_t SYSTEM_FILE_ID{0xE101};
612
615constexpr uint8_t IC_REFERENCE_ST25TA512B{0xE5};
616constexpr uint8_t IC_REFERENCE_ST25TA02KB{0xE2};
617constexpr uint8_t IC_REFERENCE_ST25TA02KB_D{0xF2};
618constexpr uint8_t IC_REFERENCE_ST25TA02KB_P{0xA2};
619constexpr uint8_t PRODUCT_CODE_ST25TA16K{0xC5};
620constexpr uint8_t PRODUCT_CODE_ST25TA64K{0xC4};
622
624inline Type get_type(const uint8_t ic_ref_or_product_code)
625{
626 return (ic_ref_or_product_code == IC_REFERENCE_ST25TA512B)
627 ? Type::ST25TA_512B
628 : ((ic_ref_or_product_code == IC_REFERENCE_ST25TA02KB ||
629 ic_ref_or_product_code == IC_REFERENCE_ST25TA02KB_D ||
630 ic_ref_or_product_code == IC_REFERENCE_ST25TA02KB_P)
631 ? Type::ST25TA_2K
632 : ((ic_ref_or_product_code == PRODUCT_CODE_ST25TA16K) ? Type::ST25TA_16K
633 : (ic_ref_or_product_code == PRODUCT_CODE_ST25TA64K) ? Type::ST25TA_64K
634 : Type::Unknown));
635}
636
642#if 0
647 struct ST25TA02K {
648 uint16_t sflen;
649 uint8_t gpo_config;
650 uint8_t event_counter_config;
651 uint8_t counter[3];
652 uint8_t product_version;
653 uint8_t uid[7];
654 uint16_t memory_size;
655 uint8_t ic_reference_code;
656 } __attribute__((packed));
657
659 struct ST25TA16K {
660 uint16_t sflen;
661 uint8_t reserved[6];
662 uint8_t uid[7];
663 uint16_t memory_size;
664 uint8_t product_code;
665 } __attribute__((packed_));
666
668 struct ST25TA64K {
669 uint16_t sflen;
670 uint8_t reserved[6];
671 uint8_t uid[7];
672 uint16_t memory_size;
673 uint8_t product_code;
674 } __attribute__((packed));
675
676 union{
677 block[18]{};
678 ST25TA02K st25ta02k;
679 ST25TA16K st25ta02k;
680 ST25TA64K st25ta02k;
681 };
682#else
683 uint8_t block[18]{};
684#endif
685 inline Type type() const
686 {
687 return get_type(block[17]);
688 }
689} __attribute__((packed));
690
691} // namespace st25ta
692
693} // namespace a
694} // namespace nfc
695} // namespace m5
696
697#endif
MIFARE definitions.
NFC-A definitions.
NFC-B definitions.
Top level namespace of M5stack.
NFC related definitions.
For ST25TA series.
NFC-V definitions.
NFC definitions.
uint8_t file_system_feature_t
Alias for file_system_feature_t.
Definition nfc.hpp:62
constexpr file_system_feature_t FILE_SYSTEM_FLAT_MEMORY
Block/Page base R/W (flat memory)
Definition nfc.hpp:63
constexpr file_system_feature_t FILE_SYSTEM_DESFIRE
MIFARE DESFire (multi file base)
Definition nfc.hpp:65
Bitrate
Communication bitrate.
Definition nfc.hpp:52
constexpr file_system_feature_t FILE_SYSTEM_ISO7816_4
ISO 7816-4 (multi file base)
Definition nfc.hpp:64
NFCForumTag
NFC Forum Tag Type.
Definition nfc.hpp:39
m5::nfc::NFCForumTag get_nfc_forum_tag_type(const Type t)
Get NFC Forum Tag Type from PICC type.
Definition nfca.cpp:591
uint16_t get_unit_size(const Type t)
Get the unit size of 1 block / 1 page.
Definition nfca.cpp:341
uint16_t get_last_user_block(const Type t)
Gets the last user area block.
Definition nfca.cpp:358
file_system_feature_t get_file_system_feature(const Type t)
Get file system fearure bits.
Definition nfca.cpp:376
uint16_t get_number_of_blocks(const Type t)
Gets the number of blocks.
Definition nfca.cpp:321
uint16_t get_user_area_size(const Type t)
Gets the user area bytes.
Definition nfca.cpp:335
bool is_user_block(const Type t, const uint16_t block)
Is block user area?
Definition nfca.cpp:364
uint16_t get_first_user_block(const Type t)
Gets the first user area block.
Definition nfca.cpp:352
bool is_file_system_memory(const Type t)
Memory file system?
Definition nfca.hpp:236
bool is_mifare_desfire(const Type t)
Is type MIFARE DESFire?
Definition nfca.hpp:140
Command
ISO-14443-3/4,MIFARE,NTAG commands.
Definition nfca.hpp:538
@ AUTH_WITH_KEY_A
MIFARE Classic. Authentication with Key A.
@ RATS
Request for Answer to Select.
@ LOCK_SIG
NTAG 210u Lock/Unlock signature.
@ PERSONALIZE_UID_USAGE
MIFARE Classic Personalize UID Usage.
@ COMMIT_PERSO
MIFARE Plus. CommitPerso.
@ GET_VERSION
NTAG 21x/UL EV1,Nano Gets the version information.
@ WRITE_BLOCK
MIFARE Classic. write.
@ FAST_READ
NTAG 21x. excluding 210u. Read multiple pages.
@ SELECT_CL3
Anticollison/Select CL3.
@ WRITE_PAGE
MIFARE Ultralight/C and NTAG write.
@ SELCT_CL1_OPT
Select CL1 and switch bit rate to fc/64 after receive SAK.
@ AUTH_WITH_KEY_B
MIFARE Classic. Authentication with Key B.
@ SELECT_CL1
Anticollison/Select CL1.
@ INCREMENT
MIFARE Classic. increment value block.
@ AUTHENTICATE_1
MIFARE UltralightC. Authentication 1st.
@ SELECT_CL2
Anticollison/Select CL2.
@ PWD_AUTH
NTAG 21x excluding 210u. Authentication for protected area.
@ SET_MOD_TYPE
MIFARE Classic SET_MOD_TYPE.
@ SELCT_CL2_OPT
Select CL2 and switch bit rate to fc/64 after receive SAK.
@ DECREMENT
MIFARE Classic. decrement value block.
@ SELCT_CL3_OPT
Select CL3 and switch bit rate to fc/64 after receive SAK.
@ RESTORE
MIFARE Classic. reads the contents of a value block into the internal Transfer Buffer.
@ AUTHENTICATE_2
MIFARE UltralightC. Authentication 2nd.
@ READ_SIG
NTAG 21x Read NXP ECC signature.
@ READ_CNT
NTAG 213/5/6. Read counter value.
@ WRITE_SIG
NTAG 210u Write custom signature.
@ TRANSFER
MIFARE Classic. writes the contents of the internal Transfer Buffer to a block.
@ WRITE_PERSO
MIFARE Plus. WritePerso.
bool is_iso14443_3(const Type t)
Is ISO 14443-3?
Definition nfca.hpp:164
Type get_type(const uint8_t ic_ref_or_product_code)
Gets the type from IC reference or product code.
Definition nfca.hpp:624
bool is_ntag4(const Type t)
Is type NTAG4xx?
Definition nfca.hpp:122
bool is_ntag2(const Type t)
Is type NTAG2xx?
Definition nfca.hpp:116
bool supports_NFC(const Type t)
Does the specified type function as NFC?
Definition nfca.hpp:170
bool operator==(const PICC &a, const PICC &b)
Equal?
Definition nfca.hpp:523
bool is_sak_completed(const uint8_t sak)
SAK completed? (Does not comply with ISO/IEC 14443-4)
Definition nfca.hpp:193
bool is_sak_completed_14443_4(const uint8_t sak)
SAK completed? (Complies with ISO/IEC 14443-4)
Definition nfca.hpp:188
bool is_mifare(const Type t)
Is type MIFARE?
Definition nfca.hpp:146
constexpr uint16_t SYSTEM_FILE_ID
System file for ST25TA.
Definition nfca.hpp:611
bool is_iso14443_4(const Type t)
Is ISO 14443-4?
Definition nfca.hpp:158
bool has_fast_read(const Type t)
Has FAST_READ command?
Definition nfca.hpp:176
bool is_st25ta(const Type t)
Is ST25TA series?
Definition nfca.hpp:152
bool is_mifare_classic_compatible(const Type t, const uint8_t sl)
Is type MIFARE classic compatible? (Plus SL1)
Definition nfca.hpp:134
bool operator!=(const PICC &a, const PICC &b)
Not equal?
Definition nfca.hpp:529
Type
Type of the PICC.
Definition nfca.hpp:31
@ MIFARE_Ultralight_EV1_1
MIFARE Ultralight EV1 MF0UL11.
@ MIFARE_Ultralight_EV1_2
MIFARE Ultralight EV1 MF0UL21.
@ MIFARE_Plus_4K
MIFARE Plus 4K.
@ NTAG_213
NTAG 213.
@ ST25TA_2K
ST25TA02K.
@ NTAG_212
NTAG 212.
@ NTAG_4XX
NTAG 4XX.
@ MIFARE_Ultralight_Nano
MIFARE Ultralight Nano.
@ NTAG_210u
NTAG 210μ
@ NTAG_215
NTAG 215.
@ MIFARE_DESFire_4K
MIFARE DESFire 4K.
@ MIFARE_Classic_Mini
Also known as MIFARE Standard mini.
@ MIFARE_DESFire_2K
MIFARE DESFire 2K.
@ MIFARE_Ultralight
MIFARE Ultralight.
@ MIFARE_DESFire_8K
MIFARE DESFire 8K.
@ ST25TA_16K
ST25TA16K.
@ ST25TA_64K
ST25TA64K.
@ NTAG_203
NTAG 203.
@ Unknown
Unknown type.
@ MIFARE_Classic_1K
Also known as MIFARE Standard 1K.
@ NTAG_216
NTAG 216.
@ MIFARE_UltralightC
MIFARE UltralightC.
@ MIFARE_Plus_SE
MIFARE Plus SE 1K.
@ MIFARE_Plus_2K
MIFARE Plus 2K.
@ MIFARE_DESFire_Light
MIFARE DESFire Light.
@ ISO_18092
PICC compliant with ISO/IEC 18092.
@ NTAG_210
NTAG 210.
@ MIFARE_Classic_2K
Also known as MIFARE Standard 2K.
@ MIFARE_Classic_4K
Also known as MIFARE Standard 4K.
@ ST25TA_512B
ST25TA512B.
@ ISO_14443_4
PICC compliant with ISO/IEC 14443-4.
bool is_mifare_ultralight(const Type t)
Is type MIFARE Ultralight series?
Definition nfca.hpp:110
bool has_sak_dependent_bit(const uint8_t sak)
SAK uncompleted?
Definition nfca.hpp:182
SubTypeDESFire
Sub type for MIFARE DESFire.
Definition nfca.hpp:93
bool is_mifare_plus(const Type t)
Is type MIFARE Plus?
Definition nfca.hpp:128
bool is_file_system_file(const Type t)
File base file system?
Definition nfca.hpp:241
SubTypePlus
Sub type for MIFARE Plus.
Definition nfca.hpp:80
bool is_mifare_classic(const Type t)
Is type MIFARE Classic?
Definition nfca.hpp:104
Answer to request.
Definition nfca.hpp:256
uint8_t TA
Interface DS/DR.
Definition nfca.hpp:262
uint8_t historical_len
Length of historical bytes.
Definition nfca.hpp:268
std::array< uint8_t, 32 > historical
Historical bytes(optional)
Definition nfca.hpp:267
uint8_t TL
Length byte.
Definition nfca.hpp:260
uint8_t T0
Format byte.
Definition nfca.hpp:261
uint8_t TC
Code protocol options.
Definition nfca.hpp:264
uint8_t TB
Interface FWI/SFGI.
Definition nfca.hpp:263
PICC for NFC-A.
Definition nfca.hpp:335
uint8_t sak
The SAK (Select acknowledge) returned from the PICC after successful selection.
Definition nfca.hpp:338
file_system_feature_t fileSystemFeature() const
File system features.
Definition nfca.hpp:507
bool isFileSystemFile() const
Supports NFC?
Definition nfca.hpp:515
uint16_t userAreaSize() const
Total user area size.
Definition nfca.hpp:458
bool supportsNFC() const
Supports NFC?
Definition nfca.hpp:487
uint16_t atqa
ATQA.
Definition nfca.hpp:341
bool isMifareClassic() const
Is MIFARE classic? (include Plus compatible SL)
Definition nfca.hpp:388
uint8_t size
UID size 4, 7 or 10.
Definition nfca.hpp:339
uint16_t lastUserBlock() const
Total size.
Definition nfca.hpp:473
bool isFileSystemMemory() const
Supports NFC?
Definition nfca.hpp:511
bool isMifareClassicCompatible() const
Is MIFARE?
Definition nfca.hpp:422
bool isMifare() const
Is MIFARE?
Definition nfca.hpp:383
bool isMifarePlusSE() const
Is MIFARE Plus SE?
Definition nfca.hpp:413
std::string typeAsString() const
Gets the type string.
Definition nfca.cpp:609
uint8_t security_level
Security level for Plus.
Definition nfca.hpp:352
bool valid() const
Valid?
Definition nfca.hpp:356
ATS ats
Definition nfca.hpp:343
bool isST25TA() const
Is ST25TA?
Definition nfca.hpp:442
uint16_t firstUserBlock() const
Gets the first user block/page address.
Definition nfca.hpp:469
void tail4(uint8_t buf[4]) const
Retrieve the last 4 bytes of UID.
Definition nfca.hpp:362
uint16_t unitSize() const
Read/Write unit size.
Definition nfca.hpp:463
SubTypePlus sub_type_plus
For Plus.
Definition nfca.hpp:347
bool emulate(const Type t, const uint8_t *uid, const uint8_t uid_len)
Emulation settings.
Definition nfca.cpp:641
bool isMifareUltralight() const
Is MIFARE Ultralight series?
Definition nfca.hpp:393
uint16_t blocks
Number of the blocks or pages.
Definition nfca.hpp:342
bool isNTAG2() const
Is NTAG?
Definition nfca.hpp:432
bool isMifarePlusS() const
Is MIFARE Plus S?
Definition nfca.hpp:408
bool requiresPlusSL3PlainRead() const
Requires plain mode for SL3 read? (Plus S and SE don't support encrypted read)
Definition nfca.hpp:418
std::string uidAsString() const
Gets the uid string.
Definition nfca.cpp:597
bool supportsNDEF() const
Supports NDEF?
Definition nfca.hpp:492
uint16_t totalSize() const
Total size.
Definition nfca.hpp:451
uint8_t uid[10]
uid (Valid up to the value of size)
Definition nfca.hpp:340
bool isMifarePlusX() const
Is MIFARE Plus X?
Definition nfca.hpp:403
bool isISO14443_4() const
Is ISO1443-4?
Definition nfca.hpp:437
SubTypeDESFire sub_type_desfire
For DESFire.
Definition nfca.hpp:348
uint8_t sub_type
uint8_t access
Definition nfca.hpp:346
bool isMifarePlus() const
Is MIFARE Plus?
Definition nfca.hpp:398
bool isMifareDESFire() const
Is MIFARE DESFire? (include Light)
Definition nfca.hpp:427
bool isUserBlock(const uint8_t block) const
Is user block?
Definition nfca.hpp:478
Type type
PICC type.
Definition nfca.hpp:337
bool canFastRead() const
Can use FAST_READ command?
Definition nfca.hpp:502
NFCForumTag nfcForumTagType() const
NFC ForumTag.
Definition nfca.hpp:497
ST25TA series system file.
Definition nfca.hpp:641