M5Unit-NFC 0.1.0 git rev:93745b5
Loading...
Searching...
No Matches
nfca.cpp File Reference

NFC-A definitions. More...

#include "nfca.hpp"
#include <M5Utility.hpp>

Namespaces

namespace  m5
 Top level namespace of M5Stack.
 

Functions

uint16_t m5::nfc::a::get_number_of_blocks (const Type t)
 Gets the number of blocks.
 
uint16_t m5::nfc::a::get_number_of_user_blocks (const Type t)
 Gets the number of user blocks.
 
uint16_t m5::nfc::a::get_user_area_size (const Type t)
 Gets the user area bytes.
 
uint16_t m5::nfc::a::get_unit_size (const Type t)
 Get the unit size of 1 block / 1 page.
 
uint16_t m5::nfc::a::get_number_of_sectors (const Type t)
 Gets the number of sectors.
 
uint16_t m5::nfc::a::get_first_user_block (const Type t)
 Gets the first user area block.
 
uint16_t m5::nfc::a::get_last_user_block (const Type t)
 Gets the last user area block.
 
bool m5::nfc::a::is_user_block (const Type t, const uint16_t block)
 Is block user area?
 
file_system_feature_t m5::nfc::a::get_file_system_feature (const Type t)
 Get file system feature bits.
 
Type m5::nfc::a::sak_to_type (const uint8_t sak)
 Inferring the type from SAK.
 
Type m5::nfc::a::version3_to_type (const uint8_t info[8])
 Inferring the type from GetVersion L3.
 
Type m5::nfc::a::version4_to_type (uint8_t &sub, const uint8_t info[8])
 Inferring the type from GetVersion L4.
 
Type m5::nfc::a::historical_bytes_to_type (uint8_t &sub, const uint16_t atqa, const uint8_t sak, const uint8_t *bytes, const uint8_t len)
 Historical bytes to type.
 
const uint8_t * m5::nfc::a::get_version3_response (const Type t)
 Gets the GET_VERSION(L3) response for emulation.
 
uint8_t m5::nfc::a::calculate_bcc8 (const uint8_t *data, const uint32_t len)
 Calculate bcc8.
 
m5::nfc::NFCForumTag m5::nfc::a::get_nfc_forum_tag_type (const Type t)
 Get NFC Forum Tag Type from PICC type.
 

Detailed Description

NFC-A definitions.

Function Documentation

◆ calculate_bcc8()

uint8_t m5::nfc::a::calculate_bcc8 ( const uint8_t * data,
const uint32_t len )

Calculate bcc8.

Parameters
dataInput data
lenInput data length
Returns
BCC8 value

◆ get_file_system_feature()

file_system_feature_t m5::nfc::a::get_file_system_feature ( const Type t)

Get file system feature bits.

Parameters
tPICC type
Returns
File system feature bits

◆ get_first_user_block()

uint16_t m5::nfc::a::get_first_user_block ( const Type t)

Gets the first user area block.

Parameters
tPICC type
Returns
First user block/page number

◆ get_last_user_block()

uint16_t m5::nfc::a::get_last_user_block ( const Type t)

Gets the last user area block.

Parameters
tPICC type
Returns
Last user block/page number

◆ get_nfc_forum_tag_type()

m5::nfc::NFCForumTag m5::nfc::a::get_nfc_forum_tag_type ( const Type t)

Get NFC Forum Tag Type from PICC type.

Parameters
tPICC type
Returns
NFC Forum Tag Type

◆ get_number_of_blocks()

uint16_t m5::nfc::a::get_number_of_blocks ( const Type t)

Gets the number of blocks.

Parameters
tPICC type
Returns
Number of blocks/pages

◆ get_number_of_sectors()

uint16_t m5::nfc::a::get_number_of_sectors ( const Type t)

Gets the number of sectors.

Parameters
tPICC type
Returns
Number of sectors

◆ get_number_of_user_blocks()

uint16_t m5::nfc::a::get_number_of_user_blocks ( const Type t)

Gets the number of user blocks.

Parameters
tPICC type
Returns
Number of user blocks/pages

◆ get_unit_size()

uint16_t m5::nfc::a::get_unit_size ( const Type t)

Get the unit size of 1 block / 1 page.

Parameters
tPICC type
Return values
!=0 Unit size
==0 Does not have a unit size

◆ get_user_area_size()

uint16_t m5::nfc::a::get_user_area_size ( const Type t)

Gets the user area bytes.

Parameters
tPICC type
Returns
User area size in bytes

◆ get_version3_response()

const uint8_t * m5::nfc::a::get_version3_response ( const Type t)

Gets the GET_VERSION(L3) response for emulation.

Parameters
tPICC type
Returns
Pointer to the GET_VERSION response bytes, or nullptr if unavailable

◆ historical_bytes_to_type()

Type m5::nfc::a::historical_bytes_to_type ( uint8_t & sub,
const uint16_t atqa,
const uint8_t sak,
const uint8_t * bytes,
const uint8_t len )

Historical bytes to type.

Parameters
[out]subInferred subtype value
atqaATQA value
sakSAK byte
bytesHistorical bytes
lenHistorical byte length
Returns
Type inferred from historical bytes

◆ is_user_block()

bool m5::nfc::a::is_user_block ( const Type t,
const uint16_t block )

Is block user area?

Parameters
tPICC type
blockBlock/page number
Returns
True if the block/page is in the user area

◆ sak_to_type()

Type m5::nfc::a::sak_to_type ( const uint8_t sak)

Inferring the type from SAK.

Parameters
sakSAK byte
Returns
Type
Warning
This is a preliminary diagnosis, a more accurate diagnosis is required

◆ version3_to_type()

Type m5::nfc::a::version3_to_type ( const uint8_t info[8])

Inferring the type from GetVersion L3.

Parameters
infoGET_VERSION response bytes
Returns
Type inferred from the level 3 version information

◆ version4_to_type()

Type m5::nfc::a::version4_to_type ( uint8_t & sub,
const uint8_t info[8] )

Inferring the type from GetVersion L4.

Parameters
[out]subInferred subtype value
infoGET_VERSION response bytes
Returns
Type inferred from the level 4 version information