summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark A. Greer <mgreer@animalcreek.com>2014-03-20 17:32:05 -0700
committerSamuel Ortiz <sameo@linux.intel.com>2014-04-07 01:21:28 +0200
commit687a086001c36b6368fdf906794f702c24383bb8 (patch)
tree6002640bea678c42e2f479010b056976aecc35a2
parentbe642f15f7d9d48393d020c09ad0b9cddab2225a (diff)
downloadneard-687a086001c36b6368fdf906794f702c24383bb8.tar.gz
neard-687a086001c36b6368fdf906794f702c24383bb8.tar.bz2
neard-687a086001c36b6368fdf906794f702c24383bb8.zip
tag: Type 4: Extend tag structure to store Type 4 file ID
Extend the Type 4 tag-specific section of the tag structure to hold the File ID from the 'NDEF File Control TLV' portion of the Capability Container file. Also provide accessor functions to get & set the its value.
-rw-r--r--include/tag.h2
-rw-r--r--src/tag.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/include/tag.h b/include/tag.h
index c734d7a..5332027 100644
--- a/include/tag.h
+++ b/include/tag.h
@@ -110,6 +110,8 @@ void near_tag_set_c_apdu_max_size(struct near_tag *tag, uint16_t size);
uint16_t near_tag_get_c_apdu_max_size(struct near_tag *tag);
void near_tag_set_r_apdu_max_size(struct near_tag *tag, uint16_t size);
uint16_t near_tag_get_r_apdu_max_size(struct near_tag *tag);
+void near_tag_set_file_id(struct near_tag *tag, uint16_t file_id);
+uint16_t near_tag_get_file_id(struct near_tag *tag);
void near_tag_set_idm(struct near_tag *tag, uint8_t *idm, uint8_t len);
uint8_t *near_tag_get_idm(struct near_tag *tag, uint8_t *len);
void near_tag_set_attr_block(struct near_tag *tag, uint8_t *attr, uint8_t len);
diff --git a/src/tag.c b/src/tag.c
index e1594dc..cb71e56 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -73,6 +73,7 @@ struct near_tag {
uint16_t max_ndef_size;
uint16_t c_apdu_max_size;
uint16_t r_apdu_max_size;
+ uint16_t file_id;
} t4;
struct {
@@ -978,6 +979,22 @@ uint16_t near_tag_get_r_apdu_max_size(struct near_tag *tag)
return tag->t4.r_apdu_max_size;
}
+void near_tag_set_file_id(struct near_tag *tag, uint16_t file_id)
+{
+ if (!tag)
+ return;
+
+ tag->t4.file_id = file_id;
+}
+
+uint16_t near_tag_get_file_id(struct near_tag *tag)
+{
+ if (!tag)
+ return 0;
+
+ return tag->t4.file_id;
+}
+
void near_tag_set_idm(struct near_tag *tag, uint8_t *idm, uint8_t len)
{
if (!tag || len > TYPE3_IDM_LEN)