From bf9f1fd058c5ca324b2df5223c582ef1ece7a698 Mon Sep 17 00:00:00 2001 From: cbdev Date: Sat, 24 Jun 2023 21:52:34 +0200 Subject: Tag data management skeleton --- nfcommander.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'nfcommander.h') diff --git a/nfcommander.h b/nfcommander.h index b4622a1..00f0fb8 100644 --- a/nfcommander.h +++ b/nfcommander.h @@ -17,6 +17,7 @@ typedef enum { #define FLAG_TAG_DATA_VALID 1 #define FLAG_TAG_UNPROGRAMMED 2 #define FLAG_TAG_LOCKED 4 +#define FLAG_TAG_READONLY 8 #define TAG_STATUS_FLAGS ((FLAG_TAG_DATA_VALID | FLAG_TAG_UNPROGRAMMED | FLAG_TAG_LOCKED)) typedef struct { @@ -24,9 +25,14 @@ typedef struct { nfc_tag_t type; uint8_t uid_length; uint8_t uid[10]; - //storage + //storage info size_t bytes_available; size_t granularity; + //data + size_t static_length; + uint8_t* static_data; + size_t dynamic_length; + uint8_t* dynamic_data; } nfc_tag_info_t; typedef int (*reader_plugin_init)(void); @@ -45,8 +51,13 @@ 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. + * + * If this API returns TAG_READ_REQUESTED, a full read is requested and the + * nfc_tag_info_t should be submitted again with the data fully read. + * + * If this API returns TAG_WRITE_REQUESTED, the nfc_tag_into_t has been filled + * with valid data pointers and sizes to be writen to the tag */ #define TAG_READ_REQUESTED 1 -int reader_tag_present(uint8_t flags, nfc_tag_info_t tag); +#define TAG_WRITE_REQUESTED 2 +int reader_tag_present(uint8_t flags, nfc_tag_info_t* tag); -- cgit v1.2.3