Permalink
Browse files

adding uid and stuff

  • Loading branch information...
1 parent ac1cff7 commit e9e9b821bcb8a8e9eee2f0f9ab42ea876aab436a @tenderlove committed Aug 8, 2009
Showing with 40 additions and 0 deletions.
  1. +28 −0 ext/nfc/nfc_iso14443a.c
  2. +1 −0 lib/nfc.rb
  3. +11 −0 lib/nfc/iso14443a.rb
@@ -10,9 +10,37 @@ static VALUE uiUidLen(VALUE self)
return INT2NUM(tag->uiUidLen);
}
+static VALUE uiAtsLen(VALUE self)
+{
+ tag_info_iso14443a * tag;
+ Data_Get_Struct(self, tag_info_iso14443a, tag);
+
+ return INT2NUM(tag->uiAtsLen);
+}
+
+static VALUE abtUid(VALUE self)
+{
+ tag_info_iso14443a * tag;
+ Data_Get_Struct(self, tag_info_iso14443a, tag);
+
+ return rb_str_new(tag->abtUid, tag->uiUidLen);
+}
+
+static VALUE abtAts(VALUE self)
+{
+ tag_info_iso14443a * tag;
+ Data_Get_Struct(self, tag_info_iso14443a, tag);
+
+ return rb_str_new(tag->abtAts, tag->uiAtsLen);
+}
+
void init_iso14443a()
{
cNfcISO14443A = rb_define_class_under(cNfc, "ISO14443A", rb_cObject);
rb_define_method(cNfcISO14443A, "uiUidLen", uiUidLen, 0);
+ rb_define_method(cNfcISO14443A, "uiAtsLen", uiAtsLen, 0);
+
+ rb_define_private_method(cNfcISO14443A, "abtUid", abtUid, 0);
+ rb_define_private_method(cNfcISO14443A, "abtAts", abtAts, 0);
}
View
@@ -2,6 +2,7 @@
require 'thread'
require 'nfc/nfc'
require 'nfc/device'
+require 'nfc/iso14443a'
class NFC
VERSION = '1.0.0'
View
@@ -0,0 +1,11 @@
+class NFC
+ class ISO14443A
+ def uid
+ abtUid.unpack('C*')
+ end
+
+ def ats
+ abtAts.unpack('C*')
+ end
+ end
+end

0 comments on commit e9e9b82

Please sign in to comment.