|
M5Unit-NFC 0.0.3 git rev:59f5362
|
Common interface layer for each chip of the NFC-A reader. More...
#include <nfc_layer_a.hpp>
Public Member Functions | |
| NFCLayerA (m5::unit::UnitMFRC522 &u) | |
| NFCLayerA (m5::unit::UnitWS1850S &u) | |
| NFCLayerA (m5::unit::UnitST25R3916 &u) | |
| NFCLayerA (m5::unit::CapST25R3916 &u) | |
| bool | isActive (const m5::nfc::a::PICC &picc) const |
| Is the specified PICC currently active? | |
| const m5::nfc::a::PICC & | activatedPICC () const |
| Retrieve the currently activated PICC. | |
override | |
| virtual bool | transceive (uint8_t *rx, uint16_t &rx_len, const uint8_t *tx, const uint16_t tx_len, const uint32_t timeout_ms) override |
| Transceive (RF command) | |
| virtual m5::nfc::NFCForumTag | supportsNFCTag () const override |
| activePICC's NDEF type | |
| virtual file_system_feature_t | supportsFilesystem () const override |
| activePICC's File system | |
| virtual m5::nfc::isodep::IsoDEP * | isoDEP () override |
| ISO-DEP interface (nullptr if not supported) | |
| virtual uint16_t | maximum_fifo_depth () const override |
| Maximum FIFO depth. | |
Detection and activation | |
| bool | request (uint16_t &atqa) |
| Send REQA to discover a PICC in IDLE. | |
| bool | wakeup (uint16_t &atqa) |
| Send WUPA to wake a PICC from IDLE or HALT. | |
| bool | detect (m5::nfc::a::PICC &picc, const uint32_t timeout_ms=100U) |
| Detect single idle PICC. | |
| bool | detect (std::vector< m5::nfc::a::PICC > &piccs, const uint32_t timeout_ms=1000U) |
| Detect idle PICCs. | |
| bool | select (m5::nfc::a::PICC &picc) |
| Select a PICC (anti-collision + SELECT cascade to ACTIVE) | |
| bool | activate (const m5::nfc::a::PICC &picc, const bool force_rats=false) |
| Activate a specific PICC (anti-collision against the given PICC) | |
| bool | reactivate (const m5::nfc::a::PICC &picc, const bool force_rats=false) |
| Wake and activate a specific PICC by PICC. | |
| bool | reactivate () |
| Reactivate the previously selected PICC. | |
For activated PICC | |
| bool | deactivate () |
| Send HLTA to the currently selected PICC (deactivate) | |
| bool | identify (m5::nfc::a::PICC &picc) |
| Identify the specified PICC type. | |
| bool | read4 (uint8_t rx[4], const uint8_t addr) |
| Read the 1 page. | |
| bool | read16 (uint8_t rx[16], const uint8_t addr) |
| Read the 1 block / 4 page (16 bytes) | |
| bool | read (uint8_t *rx, uint16_t &rx_len, const uint8_t saddr, const m5::nfc::a::mifare::classic::Key &key=m5::nfc::a::mifare::classic::DEFAULT_KEY) |
| Read any bytes from user area. | |
| bool | read (uint8_t *rx, uint16_t &rx_len, const uint8_t saddr, const m5::nfc::a::mifare::plus::AESKey &key) |
| Read any bytes from user area (MIFARE Plus SL3) | |
| bool | write4 (const uint8_t addr, const uint8_t *tx, const uint16_t tx_len, const bool safety=true) |
| Write the 1 page (4 bytes) | |
| bool | write16 (const uint8_t addr, const uint8_t *tx, const uint16_t tx_len, const bool safety=true) |
| Write the 1 block / 4 page (16 bytes) | |
| bool | write (const uint8_t saddr, const uint8_t *tx, const uint16_t tx_len, const m5::nfc::a::mifare::classic::Key &key=m5::nfc::a::mifare::classic::DEFAULT_KEY) |
| Write any bytes to user area. | |
| bool | write (const uint8_t addr, const uint8_t *tx, const uint16_t tx_len, const m5::nfc::a::mifare::plus::AESKey &key) |
| Write any bytes to user area (MIFARE Plus SL3) | |
| bool | dump (const m5::nfc::a::mifare::classic::Key &mkey=m5::nfc::a::mifare::classic::DEFAULT_KEY) |
| Dump all blocks/files. | |
| bool | dump (const uint8_t block) |
| Dump 1 block. | |
For MIFARE classic | |
| |
| bool | mifareClassicAuthenticateA (const uint8_t block, const m5::nfc::a::mifare::classic::Key &key=m5::nfc::a::mifare::classic::DEFAULT_KEY) |
| Authentication by KeyA for MIFARE classic. | |
| bool | mifareClassicAuthenticateB (const uint8_t block, const m5::nfc::a::mifare::classic::Key &key=m5::nfc::a::mifare::classic::DEFAULT_KEY) |
| Authentication by KeyB for MIFARE classic. | |
| bool | mifareClassicReadAccessCondition (uint8_t &c123, const uint8_t block) |
| Read the specific block access conditions. | |
| bool | mifareClassicWriteAccessCondition (const uint8_t block, const uint8_t c123, const m5::nfc::a::mifare::classic::Key &akey, const m5::nfc::a::mifare::classic::Key &bkey) |
| Write the specific block access conditions. | |
| bool | mifareClassicIsValueBlock (bool &is_value_block, const uint8_t block) |
| Is specific block the value block? | |
| bool | mifareClassicReadValueBlock (int32_t &value, const uint8_t block) |
| Read the specific block as the value block. | |
| bool | mifareClassicWriteValueBlock (const uint8_t block, const int32_t value) |
| Write the specific block as the value block. | |
| bool | mifareClassicDecrementValueBlock (const uint8_t block, const uint32_t delta, const bool transfer=true) |
| Decrement value of the value block. | |
| bool | mifareClassicIncrementValueBlock (const uint8_t block, const uint32_t delta, const bool transfer=true) |
| Increment value of the value block. | |
| bool | mifareClassicTransferValueBlock (const uint8_t block) |
| Transfer inner buffer value to block. | |
| bool | mifareClassicRestoreValueBlock (const uint8_t block) |
| Restore block value to inner buffer. | |
For MIFARE ultralight | |
| |
| bool | mifareUltralightChangeFormatToNDEF () |
| Write change to NFC Type-2 (NDEF) format for MIFARE Ultralight/C. | |
For MIFARE ultralightC | |
| |
| bool | mifareUltralightCAuthenticate (const uint8_t key[16]) |
| Authentication for MIFARE UltralightC. | |
For MIFARE Plus | |
| |
| bool | mifarePlusUpgradeSecurityLevel1 (const m5::nfc::a::mifare::plus::AESKey &card_config_key=m5::nfc::a::mifare::plus::DEFAULT_KEY, const m5::nfc::a::mifare::plus::AESKey &card_master_key=m5::nfc::a::mifare::plus::DEFAULT_KEY, const m5::nfc::a::mifare::plus::AESKey &l2_switch_key=m5::nfc::a::mifare::plus::DEFAULT_KEY, const m5::nfc::a::mifare::plus::AESKey &l3_switch_key=m5::nfc::a::mifare::plus::DEFAULT_KEY, const m5::nfc::a::mifare::plus::AESKey &aes_sector_key=m5::nfc::a::mifare::plus::DEFAULT_FF_KEY, const m5::nfc::a::mifare::classic::Key &key_a=m5::nfc::a::mifare::classic::DEFAULT_KEY, const m5::nfc::a::mifare::classic::Key &key_b=m5::nfc::a::mifare::classic::DEFAULT_KEY) |
| Upgrade security level to SL1 (Classic compatibility mode) | |
| bool | mifarePlusUpgradeSecurityLevel2 (const m5::nfc::a::mifare::plus::AESKey &sl2_switch_key=m5::nfc::a::mifare::plus::DEFAULT_KEY) |
| Upgrade security level to SL2 (AES over CRYPTO1) | |
| bool | mifarePlusUpgradeSecurityLevel3 (const m5::nfc::a::mifare::plus::AESKey &l3_switch_key=m5::nfc::a::mifare::plus::DEFAULT_KEY) |
| Upgrade security level to SL3 (AES) | |
For NDEF | |
| |
| bool | ndefIsValidFormat (bool &valid) |
| Is the PICC data in NDEF format? | |
| bool | ndefPrepareDesfireLight () |
| Prepare NDEF files on MIFARE DESFire Light. | |
| bool | ndefPrepareDesfire (const uint32_t max_ndef_size) |
| Prepare NDEF files on MIFARE DESFire (EV1/EV2/EV3) | |
| bool | ndefRead (m5::nfc::ndef::TLV &msg) |
| Read NDEF Message TLV. | |
| bool | ndefRead (std::vector< m5::nfc::ndef::TLV > &tlvs, const m5::nfc::ndef::TagBits tagBits=m5::nfc::ndef::tagBitsAll) |
| Read any NDEF TLV. | |
| bool | ndefWrite (const m5::nfc::ndef::TLV &msg) |
| Write NDEF message. | |
| bool | ndefWrite (const std::vector< m5::nfc::ndef::TLV > &tlvs) |
| Write any NDEF Messages TLV. | |
Public Member Functions inherited from m5::nfc::NFCLayerInterface | |
| virtual bool | transmit (const uint8_t *tx, const uint16_t tx_len, const uint32_t timeout_ms) |
| Transmit only. | |
| virtual bool | receive (uint8_t *rx, uint16_t &rx_len, const uint32_t timeout_ms) |
| Receive only. | |
| virtual uint8_t | maximum_read_blocks () const |
| Maximum read blocks for NFC-F. | |
| virtual uint8_t | maximum_write_blocks () const |
| Maximum write blocks for NFC-F. | |
Protected Member Functions | |
| virtual bool | read (uint8_t *rx, uint16_t &rx_len, const uint16_t saddr) override |
| Read NDEF (block) | |
| virtual bool | write (const uint16_t saddr, const uint8_t *tx, const uint16_t tx_len) override |
| Write NDEF (block) | |
| virtual uint16_t | first_user_block () const override |
| First user block. | |
| virtual uint16_t | last_user_block () const override |
| Last user block. | |
| virtual uint16_t | user_area_size () const |
| User area size (bytes) | |
| virtual uint16_t | unit_size_read () const override |
| Unit size for read. | |
| virtual uint16_t | unit_size_write () const override |
| Unit size for write. | |
| bool | identify_picc (m5::nfc::a::PICC &picc) |
| m5::nfc::a::Type | identify_picc_st25ta () |
| uint8_t | identify_plus_sl03 () |
| bool | read_using_fast (uint8_t *rx, uint16_t &rx_len, const uint8_t saddr) |
| bool | read_using_read16 (uint8_t *rx, uint16_t &rx_len, const uint8_t saddr, const m5::nfc::a::mifare::classic::Key &key) |
| bool | write_using_write4 (const uint8_t addr, const uint8_t *tx, const uint16_t tx_len) |
| bool | write_using_write16 (const uint8_t addr, const uint8_t *tx, const uint16_t tx_len, const m5::nfc::a::mifare::classic::Key &key) |
| bool | nfca_request_ats (m5::nfc::a::ATS &ats, const uint8_t fsdi=5, const uint8_t cid=0) |
| bool | nfca_deselect () |
| bool | mifare_get_version_L3 (uint8_t ver[8]) |
| bool | mifare_get_version_L4_raw (uint8_t *ver, uint16_t &ver_len) |
| bool | mifare_get_version_L4_wrapped (uint8_t *ver, uint16_t &ver_len) |
| bool | mifare_plus_authenticateAES (const uint16_t key_no, const m5::nfc::a::mifare::plus::AESKey &key) |
| bool | mifare_plus_authenticateAES_L3 (const uint16_t key_no, const m5::nfc::a::mifare::plus::AESKey &key) |
| bool | mifare_plus_read_plain_nomac (const uint16_t block, const uint8_t count, std::vector< uint8_t > &out) |
| bool | mifare_plus_read_plain_mac (const uint16_t block, const uint8_t count, std::vector< uint8_t > &out) |
| bool | mifare_plus_read_mac_l4 (const uint16_t block, const uint8_t count, std::vector< uint8_t > &out, const bool plain) |
| bool | mifare_plus_write_mac_l4 (const uint16_t block, const uint8_t *data, const uint16_t data_len, const bool plain) |
| bool | mifare_classic_value_block (const m5::nfc::a::Command cmd, const uint8_t block, const uint32_t arg=0) |
| bool | mifare_ultralightC_authenticate1 (uint8_t ek[8]) |
| bool | mifare_ultralightC_authenticate2 (uint8_t rx_ek[8], const uint8_t tx_ek[16]) |
| bool | ntag_read_page (uint8_t *rx, uint16_t &rx_len, const uint8_t spage, const uint8_t epage) |
| bool | ntag_write_page (const uint8_t page, const uint8_t tx[4]) |
| bool | dump_sector_structure (const m5::nfc::a::PICC &picc, const m5::nfc::a::mifare::classic::Key &key) |
| bool | dump_sector (const uint8_t sector) |
| bool | dump_sector_mifare_plus_sl3 (const uint8_t sector) |
| bool | dump_page_structure (const uint16_t maxPage) |
| bool | dump_page (const uint8_t page, const uint16_t maxPage) |
| bool | dump_mifare_plus_sl3 (const m5::nfc::a::mifare::plus::AESKey &key) |
| bool | dump_desfire () |
| bool | dump_desfire_light () |
| bool | dump_st25ta () |
Static Protected Member Functions | |
| static bool | push_back_picc (std::vector< m5::nfc::a::PICC > &v, const m5::nfc::a::PICC &picc) |
Protected Attributes | |
| m5::nfc::a::PICC | _activePICC {} |
| m5::nfc::ndef::NDEFLayer | _ndef |
| m5::nfc::isodep::IsoDEP | _isoDEP |
Common interface layer for each chip of the NFC-A reader.
| bool m5::nfc::NFCLayerA::activate | ( | const m5::nfc::a::PICC & | picc, |
| const bool | force_rats = false ) |
Activate a specific PICC (anti-collision against the given PICC)
| picc | PICC |
| force_rats | Force Request_rats (For Plus SL1/2) |
|
inline |
Retrieve the currently activated PICC.
| bool m5::nfc::NFCLayerA::deactivate | ( | ) |
Send HLTA to the currently selected PICC (deactivate)
| bool m5::nfc::NFCLayerA::detect | ( | m5::nfc::a::PICC & | picc, |
| const uint32_t | timeout_ms = 100U ) |
Detect single idle PICC.
| [out] | picc | Detected PICC |
| timeout_ms | Polling time budget in milliseconds |
| bool m5::nfc::NFCLayerA::detect | ( | std::vector< m5::nfc::a::PICC > & | piccs, |
| const uint32_t | timeout_ms = 1000U ) |
Detect idle PICCs.
| [out] | piccs | Detected PICC PICCs (one per activated PICC candidate) |
| timeout_ms | Polling time budget in milliseconds |
| bool m5::nfc::NFCLayerA::dump | ( | const m5::nfc::a::mifare::classic::Key & | mkey = m5::nfc::a::mifare::classic::DEFAULT_KEY | ) |
Dump all blocks/files.
| key | MIFARE classic key for Classic |
| bool m5::nfc::NFCLayerA::dump | ( | const uint8_t | block | ) |
Dump 1 block.
| addr | Block address |
|
inlineoverrideprotectedvirtual |
First user block.
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerA::identify | ( | m5::nfc::a::PICC & | picc | ) |
Identify the specified PICC type.
Classification Based on AN10883
| [in/out] | picc PICC |
|
inline |
Is the specified PICC currently active?
| picc | PICC to check |
|
inlineoverridevirtual |
ISO-DEP interface (nullptr if not supported)
Reimplemented from m5::nfc::NFCLayerInterface.
|
inlineoverrideprotectedvirtual |
Last user block.
Implements m5::nfc::NFCLayerInterface.
|
overridevirtual |
Maximum FIFO depth.
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerA::mifareClassicAuthenticateA | ( | const uint8_t | block, |
| const m5::nfc::a::mifare::classic::Key & | key = m5::nfc::a::mifare::classic::DEFAULT_KEY ) |
Authentication by KeyA for MIFARE classic.
| block | Authentication block |
| key | MIFARE classic key |
| bool m5::nfc::NFCLayerA::mifareClassicAuthenticateB | ( | const uint8_t | block, |
| const m5::nfc::a::mifare::classic::Key & | key = m5::nfc::a::mifare::classic::DEFAULT_KEY ) |
Authentication by KeyB for MIFARE classic.
| block | Authentication block |
| key | MIFARE classic key |
| bool m5::nfc::NFCLayerA::mifareClassicDecrementValueBlock | ( | const uint8_t | block, |
| const uint32_t | delta, | ||
| const bool | transfer = true ) |
Decrement value of the value block.
| block | Block |
| delta | Delta |
| transfer | Transfer immediately if true |
| bool m5::nfc::NFCLayerA::mifareClassicIncrementValueBlock | ( | const uint8_t | block, |
| const uint32_t | delta, | ||
| const bool | transfer = true ) |
Increment value of the value block.
| block | Block |
| delta | Delta |
| transfer | Transfer immediately if true |
| bool m5::nfc::NFCLayerA::mifareClassicIsValueBlock | ( | bool & | is_value_block, |
| const uint8_t | block ) |
Is specific block the value block?
| [out] | is_value_block | true if block is the value block |
| block | Block | |
| key | MIFARE classic key |
| bool m5::nfc::NFCLayerA::mifareClassicReadAccessCondition | ( | uint8_t & | c123, |
| const uint8_t | block ) |
Read the specific block access conditions.
| [out] | c123 | Access bits Bit2:C1 Bit1:C2 Bit0:C3 |
| block | Block |
Access conditions for the sector trailer
| C1 | C2 | C3 | KeyA read | KeyA write | Access bits read | Access bits write | KeyB read | KeyB write |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | never | keyA | keyA | never | keyA | keyA |
| 0 | 1 | 0 | never | never | keyA | never | keyA | never |
| 1 | 0 | 0 | never | keyB | keyA/B | never | never | keyB |
| 1 | 1 | 0 | never | never | keyA/B | never | never | never |
| 0 | 0 | 1 | never | keyA | keyA | keyA | keyA | keyA |
| 0 | 1 | 1 | never | keyB | keyA/B | keyB | never | keyB |
| 1 | 0 | 1 | never | never | keyA/B | keyB | never | never |
| 1 | 1 | 1 | never | never | keyA/B | never | never | never |
Access conditions for data blocks
| C1 | C2 | C3 | read | write | increment | decrement,transfer, restore | Application |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | keyA/B | keyA/B | keyA/B | keyA/B | transport configuration |
| 0 | 1 | 0 | keyA/B | never | neve | never | read/write block |
| 1 | 0 | 0 | keyA/B | keyB | never | never | read/write block |
| 1 | 1 | 0 | keyA/B | keyB | keyB | keyA/B | value block |
| 0 | 0 | 1 | keyA/B | never | never | keyA/B | value block |
| 0 | 1 | 1 | keyB | keyB | never | never | read/write block |
| 1 | 0 | 1 | keyB | never | never | never | read/write block |
| 1 | 1 | 1 | never | never | never | never | read/write block |
| bool m5::nfc::NFCLayerA::mifareClassicReadValueBlock | ( | int32_t & | value, |
| const uint8_t | block ) |
Read the specific block as the value block.
| [out] | value | Value |
| block | Block |
| bool m5::nfc::NFCLayerA::mifareClassicRestoreValueBlock | ( | const uint8_t | block | ) |
Restore block value to inner buffer.
| block | Block |
| bool m5::nfc::NFCLayerA::mifareClassicTransferValueBlock | ( | const uint8_t | block | ) |
Transfer inner buffer value to block.
| block | Block |
| bool m5::nfc::NFCLayerA::mifareClassicWriteAccessCondition | ( | const uint8_t | block, |
| const uint8_t | c123, | ||
| const m5::nfc::a::mifare::classic::Key & | akey, | ||
| const m5::nfc::a::mifare::classic::Key & | bkey ) |
Write the specific block access conditions.
| block | Block |
| c123 | Access bits Bit2:C1 Bit1:C2 Bit0:C3 |
| akey | KeyA |
| bkey | KeyB |
| bool m5::nfc::NFCLayerA::mifareClassicWriteValueBlock | ( | const uint8_t | block, |
| const int32_t | value ) |
Write the specific block as the value block.
| block | Block |
| value | Value |
| bool m5::nfc::NFCLayerA::mifarePlusUpgradeSecurityLevel1 | ( | const m5::nfc::a::mifare::plus::AESKey & | card_config_key = m5::nfc::a::mifare::plus::DEFAULT_KEY, |
| const m5::nfc::a::mifare::plus::AESKey & | card_master_key = m5::nfc::a::mifare::plus::DEFAULT_KEY, | ||
| const m5::nfc::a::mifare::plus::AESKey & | l2_switch_key = m5::nfc::a::mifare::plus::DEFAULT_KEY, | ||
| const m5::nfc::a::mifare::plus::AESKey & | l3_switch_key = m5::nfc::a::mifare::plus::DEFAULT_KEY, | ||
| const m5::nfc::a::mifare::plus::AESKey & | aes_sector_key = m5::nfc::a::mifare::plus::DEFAULT_FF_KEY, | ||
| const m5::nfc::a::mifare::classic::Key & | key_a = m5::nfc::a::mifare::classic::DEFAULT_KEY, | ||
| const m5::nfc::a::mifare::classic::Key & | key_b = m5::nfc::a::mifare::classic::DEFAULT_KEY ) |
Upgrade security level to SL1 (Classic compatibility mode)
| card_config_key | Card Configuration Key (AES) |
| card_master_key | Card Master Key (AES) |
| l2_switch_key | Level 2 Switch Key (AES, for MIFARE Plus X/EV2 SL2 only) |
| l3_switch_key | Level 3 Switch Key (AES, for SL3) |
| aes_sector_key | AES sector key (for SL2/SL3, written to 0x4000+) |
| key_a | Crypto1 Key A (applies to all sectors) |
| key_b | Crypto1 Key B (applies to all sectors) |
| bool m5::nfc::NFCLayerA::mifarePlusUpgradeSecurityLevel2 | ( | const m5::nfc::a::mifare::plus::AESKey & | sl2_switch_key = m5::nfc::a::mifare::plus::DEFAULT_KEY | ) |
Upgrade security level to SL2 (AES over CRYPTO1)
| sl2_switch_key | SL2 Switch Key (AES) |
| bool m5::nfc::NFCLayerA::mifarePlusUpgradeSecurityLevel3 | ( | const m5::nfc::a::mifare::plus::AESKey & | l3_switch_key = m5::nfc::a::mifare::plus::DEFAULT_KEY | ) |
Upgrade security level to SL3 (AES)
| l3_switch_key | Level 3 Switch Key (AES) |
| bool m5::nfc::NFCLayerA::mifareUltralightChangeFormatToNDEF | ( | ) |
Write change to NFC Type-2 (NDEF) format for MIFARE Ultralight/C.
| bool m5::nfc::NFCLayerA::ndefIsValidFormat | ( | bool & | valid | ) |
Is the PICC data in NDEF format?
| [out] | valid | True if NDEF format |
| bool m5::nfc::NFCLayerA::ndefPrepareDesfire | ( | const uint32_t | max_ndef_size | ) |
Prepare NDEF files on MIFARE DESFire (EV1/EV2/EV3)
| max_ndef_size | Max size for NDEF file |
| bool m5::nfc::NFCLayerA::ndefPrepareDesfireLight | ( | ) |
Prepare NDEF files on MIFARE DESFire Light.
| bool m5::nfc::NFCLayerA::ndefRead | ( | m5::nfc::ndef::TLV & | msg | ) |
Read NDEF Message TLV.
| [out] | msg | Message If it does not exist, a Null TLV is returned |
| bool m5::nfc::NFCLayerA::ndefRead | ( | std::vector< m5::nfc::ndef::TLV > & | tlvs, |
| const m5::nfc::ndef::TagBits | tagBits = m5::nfc::ndef::tagBitsAll ) |
Read any NDEF TLV.
| [out] | tlvs | Message vector |
| tagBits | Bit indicating the group of NDEF tags to be read |
| bool m5::nfc::NFCLayerA::ndefWrite | ( | const m5::nfc::ndef::TLV & | msg | ) |
Write NDEF message.
| msg | Message (NDEF Message) |
| bool m5::nfc::NFCLayerA::ndefWrite | ( | const std::vector< m5::nfc::ndef::TLV > & | tlvs | ) |
Write any NDEF Messages TLV.
| tlvs | Message vector |
|
inline |
Reactivate the previously selected PICC.
This function attempts to recover communication with the currently stored _activePICC when the PICC has entered the HALT state, for example due to a protocol error, timeout, or loss of RF field synchronization. Internally performs a WUPA (Wake-Up) followed by anti-collision and SELECT sequence using the last known PICC
| bool m5::nfc::NFCLayerA::reactivate | ( | const m5::nfc::a::PICC & | picc, |
| const bool | force_rats = false ) |
Wake and activate a specific PICC by PICC.
| picc | Target PICC |
| force_rats | Force Request_rats (For Plus SL1/2) |
|
overrideprotectedvirtual |
Read NDEF (block)
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerA::read | ( | uint8_t * | rx, |
| uint16_t & | rx_len, | ||
| const uint8_t | saddr, | ||
| const m5::nfc::a::mifare::classic::Key & | key = m5::nfc::a::mifare::classic::DEFAULT_KEY ) |
Read any bytes from user area.
Continue reading only the user area from the first block of the user area until rx_len is satisfied
| rx | Buffer |
| [in/out] | rx_len in:buffer size, out:actual read size |
| saddr | Reading start block/page address |
| bool m5::nfc::NFCLayerA::read | ( | uint8_t * | rx, |
| uint16_t & | rx_len, | ||
| const uint8_t | saddr, | ||
| const m5::nfc::a::mifare::plus::AESKey & | key ) |
Read any bytes from user area (MIFARE Plus SL3)
| rx | Buffer |
| [in/out] | rx_len in:buffer size, out:actual read size |
| saddr | Reading start block address |
| key | AES sector key (for MIFARE Plus SL3) |
| bool m5::nfc::NFCLayerA::read16 | ( | uint8_t | rx[16], |
| const uint8_t | addr ) |
Read the 1 block / 4 page (16 bytes)
| rx | Buffer (at least 16 bytes) |
| addr | Block/Page address |
| bool m5::nfc::NFCLayerA::read4 | ( | uint8_t | rx[4], |
| const uint8_t | addr ) |
Read the 1 page.
| rx | Buffer (at least 4 bytes) |
| addr | Block/Page address |
| bool m5::nfc::NFCLayerA::request | ( | uint16_t & | atqa | ) |
Send REQA to discover a PICC in IDLE.
| [out] | atqa | ATQA received from PICC |
| bool m5::nfc::NFCLayerA::select | ( | m5::nfc::a::PICC & | picc | ) |
Select a PICC (anti-collision + SELECT cascade to ACTIVE)
| [out] | picc | The fully activated PICC (single- or multi-cascade) |
|
overridevirtual |
activePICC's File system
Reimplemented from m5::nfc::NFCLayerInterface.
|
overridevirtual |
activePICC's NDEF type
Reimplemented from m5::nfc::NFCLayerInterface.
|
overridevirtual |
Transceive (RF command)
Reimplemented from m5::nfc::NFCLayerInterface.
|
inlineoverrideprotectedvirtual |
Unit size for read.
Implements m5::nfc::NFCLayerInterface.
|
inlineoverrideprotectedvirtual |
Unit size for write.
Implements m5::nfc::NFCLayerInterface.
|
inlineprotectedvirtual |
User area size (bytes)
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerA::wakeup | ( | uint16_t & | atqa | ) |
Send WUPA to wake a PICC from IDLE or HALT.
| [out] | atqa | ATQA received from PICC |
|
overrideprotectedvirtual |
Write NDEF (block)
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerA::write | ( | const uint8_t | addr, |
| const uint8_t * | tx, | ||
| const uint16_t | tx_len, | ||
| const m5::nfc::a::mifare::plus::AESKey & | key ) |
Write any bytes to user area (MIFARE Plus SL3)
| addr | Writing start block address |
| tx | Buffer |
| tx_len | Buffer size |
| key | AES sector key (for MIFARE Plus SL3) |
| bool m5::nfc::NFCLayerA::write | ( | const uint8_t | saddr, |
| const uint8_t * | tx, | ||
| const uint16_t | tx_len, | ||
| const m5::nfc::a::mifare::classic::Key & | key = m5::nfc::a::mifare::classic::DEFAULT_KEY ) |
Write any bytes to user area.
Continue writing only the user area from the first block of the user area until tx_len is satisfied
| saddr | Writing start block/page address |
| tx | Buffer |
| tx_len | buffer size |
| bool m5::nfc::NFCLayerA::write16 | ( | const uint8_t | addr, |
| const uint8_t * | tx, | ||
| const uint16_t | tx_len, | ||
| const bool | safety = true ) |
Write the 1 block / 4 page (16 bytes)
| addr | Block/Page address |
| tx | Buffef |
| tx_len | Buffer size |
| safety | Fail to write to out of the user memory area if true (safety measure) |
| bool m5::nfc::NFCLayerA::write4 | ( | const uint8_t | addr, |
| const uint8_t * | tx, | ||
| const uint16_t | tx_len, | ||
| const bool | safety = true ) |
Write the 1 page (4 bytes)
| addr | Block/Page address |
| tx | Buffer |
| tx_len | Buffer size |
| safety | Fail to write to out of the user memory area if true (safety measure) |