123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- #ifndef NFC_TYPE_2_TAG_PARSER_H__
- #define NFC_TYPE_2_TAG_PARSER_H__
- #include <stdint.h>
- #include "nfc_tlv_block.h"
- #include "sdk_errors.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef struct
- {
- uint8_t manufacturer_id;
- uint16_t serial_number_part_1;
- uint8_t check_byte_0;
- uint32_t serial_number_part_2;
- uint8_t check_byte_1;
- uint8_t internal;
- } type_2_tag_serial_number_t;
- typedef struct
- {
- uint8_t major_version;
- uint8_t minor_version;
- uint16_t data_area_size;
- uint8_t read_access;
- uint8_t write_access;
- } type_2_tag_capability_container_t;
- typedef struct
- {
- type_2_tag_serial_number_t sn;
- uint16_t lock_bytes;
- type_2_tag_capability_container_t cc;
- uint16_t const max_tlv_blocks;
- tlv_block_t * p_tlv_block_array;
- uint16_t tlv_count;
- } type_2_tag_t;
- #define NFC_TYPE_2_TAG_DESC_DEF(NAME, MAX_BLOCKS) \
- static tlv_block_t NAME##_tlv_block_array[MAX_BLOCKS]; \
- static type_2_tag_t NAME##_type_2_tag = \
- { \
- .max_tlv_blocks = MAX_BLOCKS, \
- .p_tlv_block_array = NAME##_tlv_block_array, \
- .tlv_count = 0 \
- }
- #define NFC_TYPE_2_TAG_DESC(NAME) (NAME##_type_2_tag)
- #define T2T_NFC_FORUM_DEFINED_DATA 0xE1
- #define T2T_UID_BCC_CASCADE_BYTE 0x88
- #define T2T_SUPPORTED_MAJOR_VERSION 1
- #define T2T_SUPPORTED_MINOR_VERSION 2
- #define T2T_BLOCK_SIZE 4
- #define T2T_CC_BLOCK_OFFSET 12
- #define T2T_FIRST_DATA_BLOCK_OFFSET 16
- void type_2_tag_clear(type_2_tag_t * p_type_2_tag);
- ret_code_t type_2_tag_parse(type_2_tag_t * p_type_2_tag, uint8_t * p_raw_data);
- void type_2_tag_printout(type_2_tag_t * p_type_2_tag);
- #ifdef __cplusplus
- }
- #endif
- #endif
|