14static const uint8_t MIFARE_CLASSIC_BLOCK_SIZE = 16;
15static const uint8_t MIFARE_CLASSIC_LONG_TLV_SIZE = 4;
16static const uint8_t MIFARE_CLASSIC_SHORT_TLV_SIZE = 2;
17static const uint8_t MIFARE_CLASSIC_BLOCKS_PER_SECT_LOW = 4;
18static const uint8_t MIFARE_CLASSIC_BLOCKS_PER_SECT_HIGH = 16;
19static const uint8_t MIFARE_CLASSIC_16BLOCK_SECT_START = 32;
21static const uint8_t MIFARE_ULTRALIGHT_PAGE_SIZE = 4;
22static const uint8_t MIFARE_ULTRALIGHT_READ_SIZE = 4;
23static const uint8_t MIFARE_ULTRALIGHT_DATA_START_PAGE = 4;
24static const uint8_t MIFARE_ULTRALIGHT_MAX_PAGE = 63;
26static const uint8_t TAG_TYPE_MIFARE_CLASSIC = 0;
27static const uint8_t TAG_TYPE_1 = 1;
28static const uint8_t TAG_TYPE_2 = 2;
29static const uint8_t TAG_TYPE_3 = 3;
30static const uint8_t TAG_TYPE_4 = 4;
31static const uint8_t TAG_TYPE_UNKNOWN = 99;
34static const uint8_t MIFARE_CMD_AUTH_A = 0x60;
35static const uint8_t MIFARE_CMD_AUTH_B = 0x61;
36static const uint8_t MIFARE_CMD_HALT = 0x50;
37static const uint8_t MIFARE_CMD_READ = 0x30;
38static const uint8_t MIFARE_CMD_WRITE = 0xA0;
39static const uint8_t MIFARE_CMD_WRITE_ULTRALIGHT = 0xA2;
42static const uint8_t MIFARE_CMD_ACK = 0x0A;
43static const uint8_t MIFARE_CMD_NAK_INVALID_XFER_BUFF_VALID = 0x00;
44static const uint8_t MIFARE_CMD_NAK_CRC_ERROR_XFER_BUFF_VALID = 0x01;
45static const uint8_t MIFARE_CMD_NAK_INVALID_XFER_BUFF_INVALID = 0x04;
46static const uint8_t MIFARE_CMD_NAK_CRC_ERROR_XFER_BUFF_INVALID = 0x05;
48static const char *
const MIFARE_CLASSIC =
"Mifare Classic";
49static const char *
const NFC_FORUM_TYPE_2 =
"NFC Forum Type 2";
50static const char *
const ERROR =
"Error";
52static const uint8_t DEFAULT_KEY[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
53static const uint8_t NDEF_KEY[6] = {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7};
54static const uint8_t MAD_KEY[6] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5};
56std::string
format_uid(std::vector<uint8_t> &uid);
virtual void tag_on(NfcTag &tag)
virtual void tag_off(NfcTag &tag)
std::vector< NfcTagListener * > tag_listeners_
void register_listener(NfcTagListener *listener)
std::string format_uid(std::vector< uint8_t > &uid)
bool decode_mifare_classic_tlv(std::vector< uint8_t > &data, uint32_t &message_length, uint8_t &message_start_index)
uint32_t get_mifare_ultralight_buffer_size(uint32_t message_length)
uint8_t get_mifare_classic_ndef_start_index(std::vector< uint8_t > &data)
uint8_t guess_tag_type(uint8_t uid_length)
bool mifare_classic_is_trailer_block(uint8_t block_num)
uint32_t get_mifare_classic_buffer_size(uint32_t message_length)
bool mifare_classic_is_first_block(uint8_t block_num)
std::string format_bytes(std::vector< uint8_t > &bytes)
Providing packet encoding functions for exchanging data with a remote host.