ext/nfc/nfc_iso14443a.c in nfc-2.1.0 vs ext/nfc/nfc_iso14443a.c in nfc-3.0.0

- old
+ new

@@ -1,6 +1,6 @@ -#include <nfc_iso14443a.h> +#include <nfc.h> VALUE cNfcISO14443A; /* * call-seq: @@ -8,88 +8,88 @@ * * Get the szUidLen */ static VALUE szUidLen(VALUE self) { - nfc_iso14443a_info_t * tag; - Data_Get_Struct(self, nfc_iso14443a_info_t, tag); + nfc_target * tag; + Data_Get_Struct(self, nfc_target, tag); - return INT2NUM(tag->szUidLen); + return INT2NUM(tag->nti.nai.szUidLen); } /* * call-seq: * szAtsLen * * Get the szAtsLen */ static VALUE szAtsLen(VALUE self) { - nfc_iso14443a_info_t * tag; - Data_Get_Struct(self, nfc_iso14443a_info_t, tag); + nfc_target * tag; + Data_Get_Struct(self, nfc_target, tag); - return INT2NUM(tag->szAtsLen); + return INT2NUM(tag->nti.nai.szAtsLen); } /* * call-seq: * abtUid * * Get the abtUid */ static VALUE abtUid(VALUE self) { - nfc_iso14443a_info_t * tag; - Data_Get_Struct(self, nfc_iso14443a_info_t, tag); + nfc_target * tag; + Data_Get_Struct(self, nfc_target, tag); - return rb_str_new(tag->abtUid, tag->szUidLen); + return rb_str_new((const char *)tag->nti.nai.abtUid, tag->nti.nai.szUidLen); } /* * call-seq: * abtAts * * Get the abtAts */ static VALUE abtAts(VALUE self) { - nfc_iso14443a_info_t * tag; - Data_Get_Struct(self, nfc_iso14443a_info_t, tag); + nfc_target * tag; + Data_Get_Struct(self, nfc_target, tag); - return rb_str_new(tag->abtAts, tag->szAtsLen); + return rb_str_new((const char *)tag->nti.nai.abtAts, tag->nti.nai.szAtsLen); } /* * call-seq: * abtAtqa * * Get the abtAtqa */ static VALUE abtAtqa(VALUE self) { - nfc_iso14443a_info_t * tag; - Data_Get_Struct(self, nfc_iso14443a_info_t, tag); + nfc_target * tag; + Data_Get_Struct(self, nfc_target, tag); - return rb_str_new(tag->abtAtqa, 2); + return rb_str_new((const char *)tag->nti.nai.abtAtqa, 2); } /* * call-seq: * btSak * * Get the btSak */ static VALUE btSak(VALUE self) { - nfc_iso14443a_info_t * tag; - Data_Get_Struct(self, nfc_iso14443a_info_t, tag); + nfc_target * tag; + Data_Get_Struct(self, nfc_target, tag); - return INT2NUM(tag->btSak); + return INT2NUM(tag->nti.nai.btSak); } void init_iso14443a() { - cNfcISO14443A = rb_define_class_under(cNfc, "ISO14443A", rb_cObject); + cNfcISO14443A = rb_define_class_under(mNfc, "ISO14443A", rb_cObject); rb_define_method(cNfcISO14443A, "szUidLen", szUidLen, 0); rb_define_method(cNfcISO14443A, "szAtsLen", szAtsLen, 0); rb_define_method(cNfcISO14443A, "btSak", btSak, 0);