From cdbfe257ec65ce51229060422045541c220ed09e Mon Sep 17 00:00:00 2001 From: Ravi kumar Veeramally Date: Tue, 31 Jan 2012 11:25:18 +0200 Subject: [PATCH] tag: Caching type4 tag max NDEF size and APDU commandd max size Cacheing max ndef size and APDU command max size in tag data. This data is required while sending write command for Type4 tag. --- include/tag.h | 4 ++++ src/tag.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/tag.h b/include/tag.h index a8e4b77..7044528 100644 --- a/include/tag.h +++ b/include/tag.h @@ -84,5 +84,9 @@ void near_tag_driver_unregister(struct near_tag_driver *driver); void near_tag_set_memory_layout(struct near_tag *tag, enum near_tag_memory_layout); enum near_tag_memory_layout near_tag_get_memory_layout(struct near_tag *tag); +void near_tag_set_max_ndef_size(struct near_tag *tag, uint16_t size); +uint16_t near_tag_get_max_ndef_size(struct near_tag *tag); +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); #endif diff --git a/src/tag.c b/src/tag.c index 6ce1cf7..ada7b2f 100644 --- a/src/tag.c +++ b/src/tag.c @@ -49,6 +49,11 @@ struct near_tag { uint32_t n_records; GList *records; + + struct { + uint16_t max_ndef_size; + uint16_t c_apdu_max_size; + } t4; }; static GList *driver_list = NULL; @@ -198,6 +203,38 @@ void near_tag_set_memory_layout(struct near_tag *tag, tag->layout = layout; } +void near_tag_set_max_ndef_size(struct near_tag *tag, uint16_t size) +{ + if (tag == NULL) + return; + + tag->t4.max_ndef_size = size; +} + +uint16_t near_tag_get_max_ndef_size(struct near_tag *tag) +{ + if (tag == NULL) + return 0; + + return tag->t4.max_ndef_size; +} + +void near_tag_set_c_apdu_max_size(struct near_tag *tag, uint16_t size) +{ + if (tag == NULL) + return; + + tag->t4.c_apdu_max_size = size; +} + +uint16_t near_tag_get_c_apdu_max_size(struct near_tag *tag) +{ + if (tag == NULL) + return 0; + + return tag->t4.c_apdu_max_size; +} + int near_tag_driver_register(struct near_tag_driver *driver) { DBG(""); -- 2.7.4