|
M5Unit-NFC 0.0.3 git rev:59f5362
|
Common interface layer for each chip of the NFC-F reader. More...
#include <nfc_layer_f.hpp>
Public Member Functions | |
| NFCLayerF (m5::unit::UnitST25R3916 &u) | |
| NFCLayerF (m5::unit::CapST25R3916 &u) | |
| virtual uint16_t | maximum_fifo_depth () const override |
| Maximum FIFO depth. | |
| bool | isActive (const m5::nfc::f::PICC &picc) const |
| Is the specified PICC currently active? | |
| const m5::nfc::f::PICC & | activatedPICC () const |
| Retrieve the currently activated PICC. | |
Detection and activation | |
| bool | polling (m5::nfc::f::PICC &picc, const uint16_t system_code, const m5::nfc::f::RequestCode request_code, const m5::nfc::f::TimeSlot time_slot) |
| Polling. | |
| bool | detect (m5::nfc::f::PICC &picc, const uint32_t timeout_ms=100U) |
| Detect single PICC. | |
| bool | detect (std::vector< m5::nfc::f::PICC > &piccs, m5::nfc::f::TimeSlot time_slot=m5::nfc::f::TimeSlot::Slot16, const uint32_t timeout_ms=500U) |
| Detect PICCs. | |
| bool | detect (std::vector< m5::nfc::f::PICC > &piccs, const uint16_t private_code, m5::nfc::f::TimeSlot time_slot=m5::nfc::f::TimeSlot::Slot16, const uint32_t timeout_ms=500U) |
| Detect PICCs matching the specified system code. | |
| bool | detect (std::vector< m5::nfc::f::PICC > &piccs, const uint16_t *private_code, const uint8_t pc_size, m5::nfc::f::TimeSlot time_slot=m5::nfc::f::TimeSlot::Slot16, const uint32_t timeout_ms=500U) |
| Detect PICCs matching the specified system code. | |
| bool | activate (const m5::nfc::f::PICC &picc) |
| Activate a specific PICC. | |
| bool | reactivate (const m5::nfc::f::PICC &picc) |
| Activate a specific PICC. | |
For activated PICC | |
| bool | deactivate () |
| Deactivate PICC. | |
| bool | requestService (uint16_t &key_version, const uint16_t node_code) |
| Request service. | |
| bool | requestService (uint16_t key_version[], const uint16_t *node_code, const uint8_t node_num) |
| Request service. | |
| bool | requestResponse (m5::nfc::f::standard::Mode &mode) |
| Request response. | |
| bool | requestSystemCode (uint16_t code_list[255], uint8_t &code_num) |
| Request system code. | |
| bool | dump () |
| Dump all blocks. | |
| bool | dump (const m5::nfc::f::block_t block) |
| Dump 1 block. | |
Read/Write without encryption | |
| |
| bool | read16 (uint8_t rx[16], const m5::nfc::f::block_t block, const uint16_t service_code=m5::nfc::f::service_random_read) |
| Read the 1 block with service code. | |
| bool | read16 (uint8_t rx[16], const m5::nfc::f::block_t *block, const uint8_t block_num, const uint16_t service_code=m5::nfc::f::service_random_read) |
| Read the 1 block with service codes. | |
| bool | read (uint8_t *rx, uint16_t &rx_len, const m5::nfc::f::block_t sblock) |
| Read any bytes from user area. | |
| bool | read (uint8_t *rx, uint16_t &rx_len, const m5::nfc::f::block_t *block_list, const uint8_t block_num, const uint16_t *service_code, const uint8_t service_num) |
| Read the specified block list and service codes. | |
| bool | write16 (const m5::nfc::f::block_t block, const uint8_t tx[16], const uint16_t tx_len) |
| Write the 1 block. | |
| bool | write (const m5::nfc::f::block_t sblock, const uint8_t *tx, const uint16_t tx_len) |
| Write any bytes to user area. | |
| bool | clearSPAD () |
| Clear SPAD_0 - 13. | |
Read/Write with MAC | |
| |
| bool | internalAuthenticate (const uint8_t ck[16], const uint16_t ckv, const uint8_t rc[16]) |
| Internal authentication. | |
| bool | externalAuthenticate (const uint8_t ck[16], const uint16_t ckv) |
| External authentication. | |
| void | clearAuthenticate () |
| Internal authentication. | |
| bool | readWithMAC16 (uint8_t rx[16], const m5::nfc::f::block_t block) |
| Read the 1 block. | |
| bool | writeWithMAC16 (const m5::nfc::f::block_t block, const uint8_t tx[16], const uint16_t tx_len) |
| Write the 1 block. | |
NDEF | |
| |
| bool | ndefIsValidFormat (bool &valid) |
| Is the PICC data in NDEF format? | |
| bool | ndefRead (m5::nfc::ndef::TLV &msg) |
| Read NDEF Message TLV. | |
| bool | ndefWrite (const m5::nfc::ndef::TLV &msg) |
| Write NDEF message TLV. | |
| bool | writeSupportNDEF (const bool enabled) |
| Write changes for NDEF Support. | |
Public Member Functions inherited from m5::nfc::NFCLayerInterface | |
| virtual m5::nfc::NFCForumTag | supportsNFCTag () const |
| activePICC's NDEF type | |
| virtual file_system_feature_t | supportsFilesystem () const |
| activePICC's File system | |
| virtual m5::nfc::isodep::IsoDEP * | isoDEP () |
| ISO-DEP interface (nullptr if not supported) | |
| virtual bool | transceive (uint8_t *rx, uint16_t &rx_len, const uint8_t *tx, const uint16_t tx_len, const uint32_t timeout_ms) |
| Transceive (RF command) | |
| 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. | |
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. | |
| virtual uint8_t | maximum_read_blocks () const override |
| Maximum read blocks for NFC-F. | |
| virtual uint8_t | maximum_write_blocks () const override |
| Maximum write blocks for NFC-F. | |
| bool | request_response_impl (const m5::nfc::f::PICC &picc, m5::nfc::f::standard::Mode &mode) |
| bool | read_without_encryption_impl (uint8_t *rx, uint16_t &rx_len, const m5::nfc::f::block_t *block_list, const uint8_t block_num, const uint16_t *service_code, const uint8_t service_num, const m5::nfc::f::PICC &picc) |
| bool | write_without_encryption_impl (const m5::nfc::f::PICC &picc, const m5::nfc::f::block_t *block_list, const uint8_t block_num, const uint16_t *service_code, const uint8_t service_num, const uint8_t *tx, const uint16_t tx_len) |
| bool | dump_felica_lite () |
| bool | dump_felica_lite_s () |
| bool | dump_block (m5::nfc::f::block_t block) |
| bool | internal_authenticate_lite_s (const uint8_t ck[16], const uint16_t ckv, const uint8_t rc[16], const bool include_wcnt=false) |
| bool | external_authenticate_lite_s (const uint8_t ck[16], const uint16_t ckv) |
Protected Attributes | |
| m5::nfc::f::PICC | _activePICC {} |
Common interface layer for each chip of the NFC-F reader.
| bool m5::nfc::NFCLayerF::activate | ( | const m5::nfc::f::PICC & | picc | ) |
Activate a specific PICC.
| picc | PICC |
|
inline |
Retrieve the currently activated PICC.
|
inline |
Internal authentication.
| ck | Card key |
| ckv | Card key version |
| rc | Random challenge |
| bool m5::nfc::NFCLayerF::clearSPAD | ( | ) |
Clear SPAD_0 - 13.
| bool m5::nfc::NFCLayerF::deactivate | ( | ) |
Deactivate PICC.
| bool m5::nfc::NFCLayerF::detect | ( | m5::nfc::f::PICC & | picc, |
| const uint32_t | timeout_ms = 100U ) |
Detect single PICC.
| [out] | picc | Detected PICC |
| timeout_ms | Polling time budget in milliseconds |
| bool m5::nfc::NFCLayerF::detect | ( | std::vector< m5::nfc::f::PICC > & | piccs, |
| const uint16_t * | private_code, | ||
| const uint8_t | pc_size, | ||
| m5::nfc::f::TimeSlot | time_slot = m5::nfc::f::TimeSlot::Slot16, | ||
| const uint32_t | timeout_ms = 500U ) |
Detect PICCs matching the specified system code.
| [out] | piccs | Detected PICCs |
| private_code | Private system code array | |
| pc_size | private_code size | |
| time_slot | Maximum number of slots that can be responded | |
| timeout_ms | Polling time budget in milliseconds |
|
inline |
Detect PICCs matching the specified system code.
| [out] | piccs | Detected PICCs |
| private_code | Private system code | |
| time_slot | Maximum number of slots that can be responded | |
| timeout_ms | Polling time budget in milliseconds |
|
inline |
Detect PICCs.
| [out] | piccs | Detected PICCs |
| time_slot | Maximum number of slots that can be responded | |
| timeout_ms | Polling time budget in milliseconds |
| bool m5::nfc::NFCLayerF::dump | ( | ) |
Dump all blocks.
| bool m5::nfc::NFCLayerF::dump | ( | const m5::nfc::f::block_t | block | ) |
Dump 1 block.
| block | block list element |
| bool m5::nfc::NFCLayerF::externalAuthenticate | ( | const uint8_t | ck[16], |
| const uint16_t | ckv ) |
External authentication.
| wcnt | WCNT value |
|
inlineoverrideprotectedvirtual |
First user block.
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerF::internalAuthenticate | ( | const uint8_t | ck[16], |
| const uint16_t | ckv, | ||
| const uint8_t | rc[16] ) |
Internal authentication.
| ck | Card key |
| ckv | Card key version |
| rc | Random challenge |
|
inline |
Is the specified PICC currently active?
| picc | PICC to check |
|
inlineoverrideprotectedvirtual |
Last user block.
Implements m5::nfc::NFCLayerInterface.
|
overridevirtual |
Maximum FIFO depth.
Implements m5::nfc::NFCLayerInterface.
|
inlineoverrideprotectedvirtual |
Maximum read blocks for NFC-F.
Reimplemented from m5::nfc::NFCLayerInterface.
|
inlineoverrideprotectedvirtual |
Maximum write blocks for NFC-F.
Reimplemented from m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerF::ndefIsValidFormat | ( | bool & | valid | ) |
Is the PICC data in NDEF format?
| [out] | valid | True if NDEF format |
| bool m5::nfc::NFCLayerF::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::NFCLayerF::ndefWrite | ( | const m5::nfc::ndef::TLV & | msg | ) |
Write NDEF message TLV.
| msg | Message TLV |
| bool m5::nfc::NFCLayerF::polling | ( | m5::nfc::f::PICC & | picc, |
| const uint16_t | system_code, | ||
| const m5::nfc::f::RequestCode | request_code, | ||
| const m5::nfc::f::TimeSlot | time_slot ) |
Polling.
| [out] | PICC | detected PICC |
| system_code | System code | |
| request_code | Request code | |
| time_slot | Maximum number of slots that can be responded |
|
inline |
Activate a specific PICC.
| picc | PICC |
|
inline |
Read the specified block list and service codes.
| [out] | rx | Buffer (At least 16 * block_num) |
| [in/out] | rx_len in:buffer size, out:actual read size | |
| block | Target block array | |
| block_num | Number of block | |
| service_code | Service code array | |
| service_num | Number of service code |
| bool m5::nfc::NFCLayerF::read | ( | uint8_t * | rx, |
| uint16_t & | rx_len, | ||
| const m5::nfc::f::block_t | sblock ) |
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
| [out] | rx | Buffer |
| [in/out] | rx_len in:buffer size, out:actual read size | |
| sblock | Block to start reading |
|
overrideprotectedvirtual |
Read NDEF (block)
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerF::read16 | ( | uint8_t | rx[16], |
| const m5::nfc::f::block_t * | block, | ||
| const uint8_t | block_num, | ||
| const uint16_t | service_code = m5::nfc::f::service_random_read ) |
Read the 1 block with service codes.
| [out] | rx | Output buffer |
| block | Target block array | |
| block_num | Number of block | |
| service_code | Service code |
| service_code | Service code |
|
inline |
Read the 1 block with service code.
| [out] | rx | Output buffer |
| block | Target block | |
| service_code | Service code |
| bool m5::nfc::NFCLayerF::readWithMAC16 | ( | uint8_t | rx[16], |
| const m5::nfc::f::block_t | block ) |
Read the 1 block.
| [out] | rx | Output buffer |
| block | Target block |
|
inline |
Request response.
| [out] | mode | Mode if detected |
| bool m5::nfc::NFCLayerF::requestService | ( | uint16_t & | key_version, |
| const uint16_t | node_code ) |
Request service.
| [out] | key_version | Key version |
| node_code | Node code |
| bool m5::nfc::NFCLayerF::requestService | ( | uint16_t | key_version[], |
| const uint16_t * | node_code, | ||
| const uint8_t | node_num ) |
Request service.
| [out] | key_version | Key version array (at least node_num) |
| node_code | Node code array | |
| node_num | Number of node_code |
| bool m5::nfc::NFCLayerF::requestSystemCode | ( | uint16_t | code_list[255], |
| uint8_t & | code_num ) |
Request system code.
| [out] | code_list | Code list array (at least 255) |
| [out] | code_num | Number of code_list |
|
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::NFCLayerF::write | ( | const m5::nfc::f::block_t | sblock, |
| const uint8_t * | tx, | ||
| const uint16_t | tx_len ) |
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
| sblock | Block to start writing |
| tx | Buffer |
| tx_len | Buffer size |
|
overrideprotectedvirtual |
Write NDEF (block)
Implements m5::nfc::NFCLayerInterface.
| bool m5::nfc::NFCLayerF::write16 | ( | const m5::nfc::f::block_t | block, |
| const uint8_t | tx[16], | ||
| const uint16_t | tx_len ) |
Write the 1 block.
| block | Target block |
| tx | Buffer |
| tx_len | Buffer size |
| bool m5::nfc::NFCLayerF::writeSupportNDEF | ( | const bool | enabled | ) |
Write changes for NDEF Support.
| enabled | Support NDEF if true, NOT support NDEF if false |
| bool m5::nfc::NFCLayerF::writeWithMAC16 | ( | const m5::nfc::f::block_t | block, |
| const uint8_t | tx[16], | ||
| const uint16_t | tx_len ) |
Write the 1 block.
| block | Target block |
| tx | Buffer |
| tx_len | Buffer size |