M5Unit-NFC 0.1.0 git rev:93745b5
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
105m5::nfc::NFCForumTag get_nfc_forum_tag_type(const Type t);
106
112inline bool is_mifare_classic(const Type t)
113{
114 return t >= Type::MIFARE_Classic_Mini && t <= Type::MIFARE_Classic_4K;
115}
116
122inline bool is_mifare_ultralight(const Type t)
123{
124 return t >= Type::MIFARE_Ultralight && t <= Type::MIFARE_UltralightC;
125}
126
132inline bool is_ntag2(const Type t)
133{
134 return t >= Type::NTAG_203 && t <= Type::NTAG_216;
135}
136
142inline bool is_ntag4(const Type t)
143{
144 return t == Type::NTAG_4XX;
145}
146
152inline bool is_mifare_plus(const Type t)
153{
154 return t >= Type::MIFARE_Plus_2K && t <= Type::MIFARE_Plus_SE;
155}
156
163inline bool is_mifare_classic_compatible(const Type t, const uint8_t sl)
164{
165 return is_mifare_plus(t) && (sl == 1);
166}
167
173inline bool is_mifare_desfire(const Type t)
174{
175 return t >= Type::MIFARE_DESFire_2K && t <= Type::MIFARE_DESFire_Light;
176}
177
183inline bool is_mifare(const Type t)
184{
186}
187
193inline bool is_st25ta(const Type t)
194{
195 return t >= Type::ST25TA_2K && t <= Type::ST25TA_64K;
196}
197
203inline bool is_iso14443_4(const Type t)
204{
205 return is_mifare_plus(t) || is_mifare_desfire(t) || is_st25ta(t) || (t == Type::ISO_14443_4);
206}
207
213inline bool is_iso14443_3(const Type t)
214{
215 return !is_iso14443_4(t);
216}
217
223inline bool supports_NFC(const Type t)
224{
225 return (t >= Type::MIFARE_Ultralight && t <= Type::MIFARE_UltralightC) || is_ntag2(t);
226}
227
233inline bool has_fast_read(const Type t)
234{
235 return t >= Type::NTAG_210 && t <= Type::NTAG_216;
236}
237
243inline bool has_sak_dependent_bit(const uint8_t sak)
244{
245 return (sak & 0x04);
246}
247
253inline bool is_sak_completed_14443_4(const uint8_t sak)
254{
255 return ((sak & 0x24) == 0x20);
256}
262inline bool is_sak_completed(const uint8_t sak)
263{
264 return ((sak & 0x24) == 0x00);
265}
266
273Type sak_to_type(const uint8_t sak);
279Type version3_to_type(const uint8_t info[8]);
286Type version4_to_type(uint8_t& sub, const uint8_t info[8]);
296Type historical_bytes_to_type(uint8_t& sub, const uint16_t atqa, const uint8_t sak, const uint8_t* bytes,
297 const uint8_t len);
298
304uint16_t get_number_of_blocks(const Type t);
310uint16_t get_number_of_user_blocks(const Type t);
316uint16_t get_user_area_size(const Type t);
323uint16_t get_unit_size(const Type t);
329uint16_t get_number_of_sectors(const Type t);
335uint16_t get_first_user_block(const Type t);
341uint16_t get_last_user_block(const Type t);
348bool is_user_block(const Type t, const uint16_t block);
349
355file_system_feature_t get_file_system_feature(const Type t);
361inline bool is_file_system_memory(const Type t)
362{
364}
374
381uint8_t calculate_bcc8(const uint8_t* data, const uint32_t len);
382
388const uint8_t* get_version3_response(const Type t);
389
394struct ATS {
395 union {
396 uint8_t header[5]{};
397 struct {
398 uint8_t TL;
399 uint8_t T0;
400 uint8_t TA;
401 uint8_t TB;
402 uint8_t TC;
403 };
404 };
405 std::array<uint8_t, 32> historical{};
406 uint8_t historical_len{};
407
408 inline bool validTA() const
409 {
410 return T0 & 0x10;
411 }
412 inline bool validTB() const
413 {
414 return T0 & 0x20;
415 }
416 inline bool validTC() const
417 {
418 return T0 & 0x40;
419 }
420 inline uint8_t fsci() const
421 {
422 return T0 & 0x0F;
423 }
424 inline Bitrate maximumBitrateDR() const
425 {
426 if (!validTA()) {
427 return Bitrate::Invalid;
428 }
429 const uint8_t v = TA & 0x07;
430 return (v <= 3) ? static_cast<Bitrate>(v) : Bitrate::Invalid;
431 }
432 inline Bitrate maximumBitrateDS() const
433 {
434 if (!validTA()) {
435 return Bitrate::Invalid;
436 }
437 const uint8_t v = (TA >> 4) & 0x07;
438 return (v <= 3) ? static_cast<Bitrate>(v) : Bitrate::Invalid;
439 }
440 inline bool supportsAsymmetricSpeed() const
441 {
442 return validTA() && (TA & 0x80);
443 }
444 inline uint8_t fwi() const
445 {
446 return validTB() ? (TB >> 4) : 0x00;
447 }
448 inline uint8_t sfgi() const
449 {
450 return validTB() ? (TB & 0x0F) : 0x00;
451 }
452 inline uint32_t sfgt_fc() const
453 {
454 const uint8_t v = sfgi();
455 return (v == 0 || v == 15) ? 0u : (256u * 16u * (1u << v));
456 }
457 inline uint32_t sfgt_ms(const float fc) const
458 {
459 const uint32_t sfgt = sfgt_fc();
460 if (!sfgt || fc <= 0.0f) {
461 return 0;
462 }
463 const float us = (static_cast<float>(sfgt) / fc) * 1e6f;
464 uint32_t ms = static_cast<uint32_t>(us / 1000.f);
465 return ms ? ms : 1;
466 }
467 inline bool supportsNAD() const
468 {
469 return validTC() && (TC & 0x01);
470 }
471 inline bool supportsCID() const
472 {
473 return validTC() && (TC & 0x02);
474 }
475};
476
481struct PICC {
482 uint8_t _pad{};
484 uint8_t sak{};
485 uint8_t size{};
486 uint8_t uid[10]{};
487 uint16_t atqa{};
488 uint16_t blocks{};
491 union {
492 uint8_t sub_type{};
495 };
497 union {
498 uint8_t security_level{};
499 };
500
502 inline bool valid() const
503 {
504 return (size == 4 || size == 7 || size == 10) && (type != Type::Unknown) &&
506 }
508 void tail4(uint8_t buf[4]) const
509 {
510 if (buf) {
511 memcpy(buf, uid + size - 4, 4);
512 }
513 }
514 std::string uidAsString() const;
515 std::string typeAsString() const;
516
524 bool emulate(const Type t, const uint8_t* uid, const uint8_t uid_len);
525
529 inline bool isMifare() const
530 {
531 return is_mifare(type);
532 }
534 inline bool isMifareClassic() const
535 {
537 }
539 inline bool isMifareUltralight() const
540 {
542 }
544 inline bool isMifarePlus() const
545 {
546 return is_mifare_plus(type);
547 }
549 inline bool isMifarePlusX() const
550 {
551 return is_mifare_plus(type) && sub_type_plus == SubTypePlus::X;
552 }
554 inline bool isMifarePlusS() const
555 {
556 return is_mifare_plus(type) && sub_type_plus == SubTypePlus::S;
557 }
559 inline bool isMifarePlusSE() const
560 {
561 return type == Type::MIFARE_Plus_SE;
562 }
564 inline bool requiresPlusSL3PlainRead() const
565 {
566 return isMifarePlusS() || isMifarePlusSE();
567 }
568 inline bool isMifareClassicCompatible() const
569 {
571 }
573 inline bool isMifareDESFire() const
574 {
575 return is_mifare_desfire(type);
576 }
578 inline bool isNTAG2() const
579 {
580 return is_ntag2(type);
581 }
583 inline bool isISO14443_4() const
584 {
585 return is_iso14443_4(type);
586 }
588 inline bool isST25TA() const
589 {
590 return is_st25ta(type);
591 }
593
597 inline uint16_t totalSize() const
598 {
599 return valid()
601 : 0;
602 }
604 inline uint16_t userAreaSize() const
605 {
606 return valid() ? get_user_area_size(type) : 0;
607 }
609 inline uint16_t unitSize() const
610 {
611 return valid() ? get_unit_size(type) : 0;
612 }
613
615 inline uint16_t firstUserBlock() const
616 {
617 return valid() ? get_first_user_block(type) : 0xFFFF;
618 }
619 inline uint16_t lastUserBlock() const
620 {
621 return valid() ? get_last_user_block(type) : 0xFFFF;
622 }
624 inline bool isUserBlock(const uint8_t block) const
625 {
626 return valid() ? is_user_block(type, block) : false;
627 }
629
633 inline bool supportsNFC() const
634 {
635 return valid() && supports_NFC(type);
636 }
638 inline bool supportsNDEF() const
639 {
640 return valid() && nfcForumTagType() != NFCForumTag::None;
641 }
644 {
646 }
648 inline bool canFastRead() const
649 {
650 return valid() && has_fast_read(type);
651 }
654 {
655 return valid() ? get_file_system_feature(type) : 0;
656 }
657 inline bool isFileSystemMemory() const
658 {
659 return valid() && is_file_system_memory(type);
660 }
661 inline bool isFileSystemFile() const
662 {
663 return valid() && is_file_system_file(type);
664 }
666};
667
669inline bool operator==(const PICC& a, const PICC& b)
670{
671 return (a.size == b.size) && (a.sak == b.sak) && (a.type == b.type) && (a.blocks == b.blocks) &&
672 std::memcmp(a.uid, b.uid, 10) == 0;
673}
675inline bool operator!=(const PICC& a, const PICC& b)
676{
677 return !(a == b);
678}
679
684enum class Command : uint8_t {
685 // ISO/IEC 14443-3
686 REQA = 0x26,
687 WUPA = 0x52,
688 HLTA = 0x50,
689 SELECT_CL1 = 0x93,
690 SELECT_CL2 = 0x95,
691 SELECT_CL3 = 0x97,
692 SELCT_CL1_OPT = 0x92,
693 SELCT_CL2_OPT = 0x94,
694 SELCT_CL3_OPT = 0x96,
695 READ = 0x30,
696 // ISO/IEC 14443-4
697 RATS = 0xE0,
698 DESELECT = 0xC2,
699 // MIFARE
700 AUTH_WITH_KEY_A = 0x60,
701 AUTH_WITH_KEY_B = 0x61,
702 AUTHENTICATE_1 = 0x1A,
703 AUTHENTICATE_2 = 0xAF,
704 WRITE_BLOCK = 0xA0,
705 DECREMENT = 0xC0,
706 INCREMENT = 0xC1,
707 RESTORE = 0xC2,
708 TRANSFER = 0xB0,
709 PERSONALIZE_UID_USAGE = 0x40,
710 SET_MOD_TYPE = 0x43,
711 WRITE_PERSO = 0xA8,
712 COMMIT_PERSO = 0xAA,
713 // MIFARE,NTAG
714 WRITE_PAGE = 0xA2,
715 // NTAG
716 GET_VERSION = 0x60,
717 FAST_READ = 0x3A,
718 READ_CNT = 0x39,
719 PWD_AUTH = 0x1B,
720 READ_SIG = 0x3C,
721 WRITE_SIG = 0xA9,
722 LOCK_SIG = 0xAC,
723};
724
729struct config_t {
730 uint8_t fsdi{5};
731 uint8_t cid{0};
732};
733
740inline uint8_t make_rats_param(const uint8_t fsdi, const uint8_t cid)
741{
742 return static_cast<uint8_t>(((fsdi & 0x0F) << 4) | (cid & 0x0F));
743}
744
747constexpr uint32_t TIMEOUT_REQ_WUP{4}; // 4
748constexpr uint32_t TIMEOUT_SELECT{8}; // 4
749constexpr uint32_t TIMEOUT_ANTICOLL{8}; // 8
750constexpr uint32_t TIMEOUT_HALT{2};
751constexpr uint32_t TIMEOUT_GET_VERSION{5}; // 5
752constexpr uint32_t TIMEOUT_3DES{10};
753constexpr uint32_t TIMEOUT_AUTH1{4}; // 2
754constexpr uint32_t TIMEOUT_AUTH2{16}; // 10
755constexpr uint32_t TIMEOUT_READ{12};
756constexpr uint32_t TIMEOUT_FAST_READ{2};
757constexpr uint32_t TIMEOUT_FAST_READ_4PAGE{4}; // 3.7
758constexpr uint32_t TIMEOUT_FAST_READ_12PAGE{4}; // 3.7
759constexpr uint32_t TIMEOUT_FAST_READ_32PAGE{12}; // 11.8
760constexpr uint32_t TIMEOUT_WRITE1{5};
761constexpr uint32_t TIMEOUT_WRITE2{10};
762constexpr uint32_t TIMEOUT_VALUE_BLOCK{5}; // Value block operation
763constexpr uint32_t TIMEOUT_RATS{5};
764constexpr uint32_t TIMEOUT_DESELECT{8};
766
769constexpr uint8_t ACK_NIBBLE{0x0A};
771
776namespace st25ta {
777constexpr uint16_t SYSTEM_FILE_ID{0xE101};
778
781constexpr uint8_t IC_REFERENCE_ST25TA512B{0xE5};
782constexpr uint8_t IC_REFERENCE_ST25TA02KB{0xE2};
783constexpr uint8_t IC_REFERENCE_ST25TA02KB_D{0xF2};
784constexpr uint8_t IC_REFERENCE_ST25TA02KB_P{0xA2};
785constexpr uint8_t PRODUCT_CODE_ST25TA16K{0xC5};
786constexpr uint8_t PRODUCT_CODE_ST25TA64K{0xC4};
788
790inline Type get_type(const uint8_t ic_ref_or_product_code)
791{
792 return (ic_ref_or_product_code == IC_REFERENCE_ST25TA512B)
793 ? Type::ST25TA_512B
794 : ((ic_ref_or_product_code == IC_REFERENCE_ST25TA02KB ||
795 ic_ref_or_product_code == IC_REFERENCE_ST25TA02KB_D ||
796 ic_ref_or_product_code == IC_REFERENCE_ST25TA02KB_P)
797 ? Type::ST25TA_2K
798 : ((ic_ref_or_product_code == PRODUCT_CODE_ST25TA16K) ? Type::ST25TA_16K
799 : (ic_ref_or_product_code == PRODUCT_CODE_ST25TA64K) ? Type::ST25TA_64K
800 : Type::Unknown));
801}
802
808#if 0
813 struct ST25TA02K {
814 uint16_t sflen;
815 uint8_t gpo_config;
816 uint8_t event_counter_config;
817 uint8_t counter[3];
818 uint8_t product_version;
819 uint8_t uid[7];
820 uint16_t memory_size;
821 uint8_t ic_reference_code;
822 } __attribute__((packed));
823
825 struct ST25TA16K {
826 uint16_t sflen;
827 uint8_t reserved[6];
828 uint8_t uid[7];
829 uint16_t memory_size;
830 uint8_t product_code;
831 } __attribute__((packed_));
832
834 struct ST25TA64K {
835 uint16_t sflen;
836 uint8_t reserved[6];
837 uint8_t uid[7];
838 uint16_t memory_size;
839 uint8_t product_code;
840 } __attribute__((packed));
841
842 union{
843 block[18]{};
844 ST25TA02K st25ta02k;
845 ST25TA16K st25ta02k;
846 ST25TA64K st25ta02k;
847 };
848#else
849 uint8_t block[18]{};
850#endif
855 inline Type type() const
856 {
857 return get_type(block[17]);
858 }
859} __attribute__((packed));
860
861} // namespace st25ta
862
863} // namespace a
864} // namespace nfc
865} // namespace m5
866
867#endif
MIFARE definitions.
NFC-A definitions.
NFC-B definitions.
Top level namespace of M5Stack.
NFC related definitions.
For ST25TA series.
NFC-V definitions.
@ Invalid
Unknown / not yet decoded.
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 feature 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:361
bool is_mifare_desfire(const Type t)
Is type MIFARE DESFire?
Definition nfca.hpp:173
Command
ISO-14443-3/4,MIFARE,NTAG commands.
Definition nfca.hpp:684
@ 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:213
Type get_type(const uint8_t ic_ref_or_product_code)
Gets the type from IC reference or product code.
Definition nfca.hpp:790
bool is_ntag4(const Type t)
Is type NTAG4xx?
Definition nfca.hpp:142
bool is_ntag2(const Type t)
Is type NTAG2xx?
Definition nfca.hpp:132
bool supports_NFC(const Type t)
Does the specified type function as NFC?
Definition nfca.hpp:223
bool operator==(const PICC &a, const PICC &b)
Equal?
Definition nfca.hpp:669
bool is_sak_completed(const uint8_t sak)
SAK completed? (Does not comply with ISO/IEC 14443-4)
Definition nfca.hpp:262
uint8_t make_rats_param(const uint8_t fsdi, const uint8_t cid)
Build the RATS PARAM byte (ISO/IEC 14443-4)
Definition nfca.hpp:740
bool is_sak_completed_14443_4(const uint8_t sak)
SAK completed? (Complies with ISO/IEC 14443-4)
Definition nfca.hpp:253
bool is_mifare(const Type t)
Is type MIFARE?
Definition nfca.hpp:183
constexpr uint16_t SYSTEM_FILE_ID
System file for ST25TA.
Definition nfca.hpp:777
bool is_iso14443_4(const Type t)
Is ISO 14443-4?
Definition nfca.hpp:203
bool has_fast_read(const Type t)
Has FAST_READ command?
Definition nfca.hpp:233
bool is_st25ta(const Type t)
Is ST25TA series?
Definition nfca.hpp:193
bool is_mifare_classic_compatible(const Type t, const uint8_t sl)
Is type MIFARE classic compatible? (Plus SL1)
Definition nfca.hpp:163
bool operator!=(const PICC &a, const PICC &b)
Not equal?
Definition nfca.hpp:675
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:122
bool has_sak_dependent_bit(const uint8_t sak)
SAK incomplete?
Definition nfca.hpp:243
SubTypeDESFire
Sub type for MIFARE DESFire.
Definition nfca.hpp:93
bool is_mifare_plus(const Type t)
Is type MIFARE Plus?
Definition nfca.hpp:152
bool is_file_system_file(const Type t)
File base file system?
Definition nfca.hpp:370
SubTypePlus
Sub type for MIFARE Plus.
Definition nfca.hpp:80
bool is_mifare_classic(const Type t)
Is type MIFARE Classic?
Definition nfca.hpp:112
Answer to request.
Definition nfca.hpp:394
uint8_t TA
Interface DS/DR.
Definition nfca.hpp:400
uint8_t historical_len
Length of historical bytes.
Definition nfca.hpp:406
std::array< uint8_t, 32 > historical
Historical bytes(optional)
Definition nfca.hpp:405
uint8_t TL
Length byte.
Definition nfca.hpp:398
uint8_t T0
Format byte.
Definition nfca.hpp:399
uint8_t TC
Code protocol options.
Definition nfca.hpp:402
uint8_t TB
Interface FWI/SFGI.
Definition nfca.hpp:401
PICC for NFC-A.
Definition nfca.hpp:481
uint8_t sak
The SAK (Select acknowledge) returned from the PICC after successful selection.
Definition nfca.hpp:484
file_system_feature_t fileSystemFeature() const
File system features.
Definition nfca.hpp:653
bool isFileSystemFile() const
Supports NFC?
Definition nfca.hpp:661
uint16_t userAreaSize() const
Total user area size.
Definition nfca.hpp:604
bool supportsNFC() const
Supports NFC?
Definition nfca.hpp:633
uint16_t atqa
ATQA.
Definition nfca.hpp:487
bool isMifareClassic() const
Is MIFARE classic? (include Plus compatible SL)
Definition nfca.hpp:534
uint8_t size
UID size 4, 7 or 10.
Definition nfca.hpp:485
uint16_t lastUserBlock() const
Total size.
Definition nfca.hpp:619
bool isFileSystemMemory() const
Supports NFC?
Definition nfca.hpp:657
bool isMifareClassicCompatible() const
Is MIFARE?
Definition nfca.hpp:568
bool isMifare() const
Is MIFARE?
Definition nfca.hpp:529
bool isMifarePlusSE() const
Is MIFARE Plus SE?
Definition nfca.hpp:559
std::string typeAsString() const
Gets the type string.
Definition nfca.cpp:609
uint8_t security_level
Security level for Plus.
Definition nfca.hpp:498
bool valid() const
Valid?
Definition nfca.hpp:502
ATS ats
Definition nfca.hpp:489
bool isST25TA() const
Is ST25TA?
Definition nfca.hpp:588
uint16_t firstUserBlock() const
Gets the first user block/page address.
Definition nfca.hpp:615
void tail4(uint8_t buf[4]) const
Retrieve the last 4 bytes of UID.
Definition nfca.hpp:508
uint16_t unitSize() const
Read/Write unit size.
Definition nfca.hpp:609
SubTypePlus sub_type_plus
For Plus.
Definition nfca.hpp:493
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:539
uint16_t blocks
Number of the blocks or pages.
Definition nfca.hpp:488
bool isNTAG2() const
Is NTAG?
Definition nfca.hpp:578
bool isMifarePlusS() const
Is MIFARE Plus S?
Definition nfca.hpp:554
bool requiresPlusSL3PlainRead() const
Requires plain mode for SL3 read? (Plus S and SE don't support encrypted read)
Definition nfca.hpp:564
std::string uidAsString() const
Gets the uid string.
Definition nfca.cpp:597
bool supportsNDEF() const
Supports NDEF?
Definition nfca.hpp:638
uint16_t totalSize() const
Total size.
Definition nfca.hpp:597
uint8_t uid[10]
uid (Valid up to the value of size)
Definition nfca.hpp:486
bool isMifarePlusX() const
Is MIFARE Plus X?
Definition nfca.hpp:549
bool isISO14443_4() const
Is ISO14443-4?
Definition nfca.hpp:583
SubTypeDESFire sub_type_desfire
For DESFire.
Definition nfca.hpp:494
uint8_t sub_type
uint8_t access
Definition nfca.hpp:492
bool isMifarePlus() const
Is MIFARE Plus?
Definition nfca.hpp:544
bool isMifareDESFire() const
Is MIFARE DESFire? (include Light)
Definition nfca.hpp:573
bool isUserBlock(const uint8_t block) const
Is user block?
Definition nfca.hpp:624
Type type
PICC type.
Definition nfca.hpp:483
bool canFastRead() const
Can use FAST_READ command?
Definition nfca.hpp:648
NFCForumTag nfcForumTagType() const
NFC ForumTag.
Definition nfca.hpp:643
NFC-A activation configuration (RATS parameters)
Definition nfca.hpp:729
uint8_t fsdi
PCD's max receive frame size index 0..8 (16..256 bytes). Default 5 keeps current behavior.
Definition nfca.hpp:730
uint8_t cid
Card IDentifier 0..14.
Definition nfca.hpp:731
ST25TA series system file.
Definition nfca.hpp:807
Type type() const
Gets the ST25TA type.
Definition nfca.hpp:855