#include #include #include #ifndef NFCOMMANDER_VERSION #define NFCOMMANDER_VERSION "v0.1-dev" #endif typedef enum { tag_unset, tag_mifare1, tag_ntag, tag_desfire, tag_ultralight, tag_ultralightc } nfc_tag_t; #define FLAG_TAG_DATA_VALID 1 #define FLAG_TAG_UNPROGRAMMED 2 #define FLAG_TAG_LOCKED 4 #define TAG_STATUS_FLAGS ((FLAG_TAG_DATA_VALID | FLAG_TAG_UNPROGRAMMED | FLAG_TAG_LOCKED)) typedef struct { //core identifying properties nfc_tag_t type; uint8_t uid_length; uint8_t uid[10]; } nfc_tag_info_t; typedef int (*reader_plugin_init)(void); typedef int (*reader_plugin_handle)(int fd); typedef int (*reader_plugin_scan)(void); typedef enum { system_control, system_reader, system_command } notification_target_t; int core_manage_fd(int fd, int manage, notification_target_t system); /* * This API is to be called by reader backends to indicate presence of a tag. * This can be done as soon as the UID of the tag has been read (ie. before * reading EEPROM contents) to check whether the card has already been read. * If this API returns 1, a full read is requested and the nfc_tag_info_t should * be submitted again with the data fully read. */ #define TAG_READ_REQUESTED 1 int reader_tag_present(uint8_t flags, nfc_tag_info_t tag);