nfc 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/CHANGELOG.rdoc +6 -0
- data/Manifest.txt +3 -0
- data/README.rdoc +2 -2
- data/Rakefile +2 -2
- data/ext/nfc/extconf.rb +5 -37
- data/ext/nfc/nfc.c +1 -0
- data/ext/nfc/nfc.h +2 -1
- data/ext/nfc/nfc_device.c +92 -19
- data/ext/nfc/nfc_felica.c +62 -0
- data/ext/nfc/nfc_felica.h +10 -0
- data/ext/nfc/nfc_iso14443a.c +24 -24
- data/lib/nfc.rb +2 -1
- data/lib/nfc/device.rb +2 -1
- data/lib/nfc/felica.rb +34 -0
- data/lib/nfc/iso14443a.rb +3 -3
- metadata +48 -46
data/.gemtest
ADDED
File without changes
|
data/CHANGELOG.rdoc
CHANGED
data/Manifest.txt
CHANGED
@@ -9,9 +9,12 @@ ext/nfc/nfc.c
|
|
9
9
|
ext/nfc/nfc.h
|
10
10
|
ext/nfc/nfc_device.c
|
11
11
|
ext/nfc/nfc_device.h
|
12
|
+
ext/nfc/nfc_felica.c
|
13
|
+
ext/nfc/nfc_felica.h
|
12
14
|
ext/nfc/nfc_iso14443a.c
|
13
15
|
ext/nfc/nfc_iso14443a.h
|
14
16
|
lib/nfc.rb
|
15
17
|
lib/nfc/device.rb
|
18
|
+
lib/nfc/felica.rb
|
16
19
|
lib/nfc/iso14443a.rb
|
17
20
|
test/test_nfc.rb
|
data/README.rdoc
CHANGED
@@ -52,13 +52,13 @@ The install the gem:
|
|
52
52
|
|
53
53
|
$ sudo gem install nfc
|
54
54
|
|
55
|
-
NOTE!!!! The nfc gem requires libnfc version 1.
|
55
|
+
NOTE!!!! The nfc gem requires libnfc version 1.5.0 or greater!
|
56
56
|
|
57
57
|
== LICENSE:
|
58
58
|
|
59
59
|
(The MIT License)
|
60
60
|
|
61
|
-
Copyright (c) 2009 Aaron Patterson
|
61
|
+
Copyright (c) 2009-2011 Aaron Patterson
|
62
62
|
|
63
63
|
Permission is hereby granted, free of charge, to any person obtaining
|
64
64
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -6,14 +6,14 @@ gem 'rake-compiler', '>= 0.4.1'
|
|
6
6
|
require "rake/extensiontask"
|
7
7
|
|
8
8
|
Hoe.plugin :debugging
|
9
|
+
Hoe.plugin :git
|
9
10
|
|
10
11
|
HOE = Hoe.spec('nfc') do
|
11
|
-
developer('Aaron Patterson', '
|
12
|
+
developer('Aaron Patterson', 'aaron@tenderlovemaking.com')
|
12
13
|
self.readme_file = 'README.rdoc'
|
13
14
|
self.history_file = 'CHANGELOG.rdoc'
|
14
15
|
self.extra_rdoc_files = FileList['*.rdoc']
|
15
16
|
self.spec_extras = { :extensions => ["ext/nfc/extconf.rb"] }
|
16
|
-
self.rubyforge_name = 'seattlerb'
|
17
17
|
end
|
18
18
|
|
19
19
|
RET = Rake::ExtensionTask.new("nfc", HOE.spec) do |ext|
|
data/ext/nfc/extconf.rb
CHANGED
@@ -6,48 +6,16 @@ require 'mkmf'
|
|
6
6
|
|
7
7
|
LIBDIR = Config::CONFIG['libdir']
|
8
8
|
INCLUDEDIR = Config::CONFIG['includedir']
|
9
|
+
HEADER_DIRS = [ '/usr/local/include', INCLUDEDIR, '/usr/include', ]
|
10
|
+
LIB_DIRS = [ '/usr/local/lib', LIBDIR, '/usr/lib', ]
|
9
11
|
|
10
|
-
|
12
|
+
nfc_dirs = dir_config('nfc', HEADER_DIRS, LIB_DIRS)
|
11
13
|
|
12
|
-
|
13
|
-
# First search /opt/local for macports
|
14
|
-
'/opt/local/include',
|
15
|
-
|
16
|
-
# Then search /usr/local for people that installed from source
|
17
|
-
'/usr/local/include',
|
18
|
-
|
19
|
-
# Check the ruby install locations
|
20
|
-
INCLUDEDIR,
|
21
|
-
|
22
|
-
# Finally fall back to /usr
|
23
|
-
'/usr/include',
|
24
|
-
]
|
25
|
-
|
26
|
-
LIB_DIRS = [
|
27
|
-
# First search /opt/local for macports
|
28
|
-
'/opt/local/lib',
|
29
|
-
|
30
|
-
# Then search /usr/local for people that installed from source
|
31
|
-
'/usr/local/lib',
|
32
|
-
|
33
|
-
# Check the ruby install locations
|
34
|
-
LIBDIR,
|
35
|
-
|
36
|
-
# Finally fall back to /usr
|
37
|
-
'/usr/lib',
|
38
|
-
]
|
39
|
-
|
40
|
-
nfc_dirs = dir_config('nfc', '/opt/local/include', '/opt/local/lib')
|
41
|
-
unless ["", ""] == nfc_dirs
|
42
|
-
HEADER_DIRS.unshift nfc_dirs.first
|
43
|
-
LIB_DIRS.unshift nfc_dirs[1]
|
44
|
-
end
|
45
|
-
|
46
|
-
unless find_header('libnfc/libnfc.h', *HEADER_DIRS)
|
14
|
+
unless find_header('nfc/nfc.h')
|
47
15
|
abort "libnfc is missing. please install libnfc: http://libnfc.org/"
|
48
16
|
end
|
49
17
|
|
50
|
-
unless find_library('nfc', 'nfc_connect'
|
18
|
+
unless find_library('nfc', 'nfc_connect')
|
51
19
|
abort "libnfc is missing. please install libnfc: http://libnfc.org/"
|
52
20
|
end
|
53
21
|
|
data/ext/nfc/nfc.c
CHANGED
data/ext/nfc/nfc.h
CHANGED
data/ext/nfc/nfc_device.c
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#include <nfc_device.h>
|
2
2
|
|
3
|
+
static byte_t abtFelica[5] = { 0x00, 0xff, 0xff, 0x00, 0x00 };
|
4
|
+
|
3
5
|
/*
|
4
6
|
* call-seq:
|
5
7
|
* connect
|
@@ -8,7 +10,7 @@
|
|
8
10
|
*/
|
9
11
|
static VALUE connect(VALUE klass)
|
10
12
|
{
|
11
|
-
|
13
|
+
nfc_device_t * dev = nfc_connect(NULL);
|
12
14
|
if(!dev)
|
13
15
|
rb_raise(rb_eRuntimeError, "could not find NFC device");
|
14
16
|
|
@@ -26,8 +28,8 @@ static VALUE connect(VALUE klass)
|
|
26
28
|
*/
|
27
29
|
static VALUE disconnect(VALUE self)
|
28
30
|
{
|
29
|
-
|
30
|
-
Data_Get_Struct(self,
|
31
|
+
nfc_device_t * dev;
|
32
|
+
Data_Get_Struct(self, nfc_device_t, dev);
|
31
33
|
nfc_disconnect(dev);
|
32
34
|
|
33
35
|
return self;
|
@@ -41,12 +43,12 @@ static VALUE disconnect(VALUE self)
|
|
41
43
|
*/
|
42
44
|
static VALUE configure(VALUE self, VALUE option, VALUE flag)
|
43
45
|
{
|
44
|
-
|
45
|
-
Data_Get_Struct(self,
|
46
|
+
nfc_device_t * dev;
|
47
|
+
Data_Get_Struct(self, nfc_device_t, dev);
|
46
48
|
|
47
49
|
nfc_configure(
|
48
50
|
dev,
|
49
|
-
(const
|
51
|
+
(const nfc_device_option_t)NUM2INT(option),
|
50
52
|
(const bool)NUM2INT(flag)
|
51
53
|
);
|
52
54
|
|
@@ -61,14 +63,29 @@ static VALUE configure(VALUE self, VALUE option, VALUE flag)
|
|
61
63
|
*/
|
62
64
|
static VALUE dev_select(VALUE self, VALUE tag)
|
63
65
|
{
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
nfc_device_t * dev;
|
67
|
+
nfc_modulation_t * mod;
|
68
|
+
nfc_target_t * ti;
|
69
|
+
|
70
|
+
Data_Get_Struct(self, nfc_device_t, dev);
|
71
|
+
Data_Get_Struct(tag, nfc_modulation_t, mod);
|
72
|
+
|
73
|
+
ti = (nfc_target_t *)calloc(1, sizeof(nfc_target_t));
|
74
|
+
|
75
|
+
if (nfc_initiator_select_passive_target(dev, *mod, NULL, 0, ti) ) {
|
76
|
+
switch(mod->nmt) {
|
77
|
+
case NMT_ISO14443A:
|
78
|
+
return Data_Wrap_Struct(cNfcISO14443A, 0, free, ti);
|
79
|
+
break;
|
80
|
+
case NMT_FELICA:
|
81
|
+
return Data_Wrap_Struct(cNfcFelica, 0, free, ti);
|
82
|
+
break;
|
83
|
+
default:
|
84
|
+
rb_raise(rb_eRuntimeError, "untested type: %d", mod->nmt);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
return Qfalse;
|
72
89
|
}
|
73
90
|
|
74
91
|
/*
|
@@ -79,8 +96,8 @@ static VALUE dev_select(VALUE self, VALUE tag)
|
|
79
96
|
*/
|
80
97
|
static VALUE name(VALUE self)
|
81
98
|
{
|
82
|
-
|
83
|
-
Data_Get_Struct(self,
|
99
|
+
nfc_device_t * dev;
|
100
|
+
Data_Get_Struct(self, nfc_device_t, dev);
|
84
101
|
|
85
102
|
return rb_str_new2(dev->acName);
|
86
103
|
}
|
@@ -93,16 +110,55 @@ static VALUE name(VALUE self)
|
|
93
110
|
*/
|
94
111
|
static VALUE dev_deselect(VALUE self)
|
95
112
|
{
|
96
|
-
|
97
|
-
Data_Get_Struct(self,
|
113
|
+
nfc_device_t * dev;
|
114
|
+
Data_Get_Struct(self, nfc_device_t, dev);
|
98
115
|
|
99
|
-
|
116
|
+
nfc_initiator_deselect_target(dev);
|
100
117
|
|
101
118
|
return self;
|
102
119
|
}
|
103
120
|
|
121
|
+
static VALUE mod_initialize(VALUE self, VALUE type, VALUE baud)
|
122
|
+
{
|
123
|
+
nfc_modulation_t * mod;
|
124
|
+
|
125
|
+
Data_Get_Struct(self, nfc_modulation_t, mod);
|
126
|
+
mod->nmt = NUM2INT(type);
|
127
|
+
mod->nbr = NUM2INT(baud);
|
128
|
+
|
129
|
+
return self;
|
130
|
+
}
|
131
|
+
|
132
|
+
static VALUE mod_alloc(VALUE klass)
|
133
|
+
{
|
134
|
+
nfc_modulation_t * modulation;
|
135
|
+
|
136
|
+
modulation = xcalloc(1, sizeof(nfc_modulation_t));
|
137
|
+
|
138
|
+
return Data_Wrap_Struct(klass, NULL, xfree, modulation);
|
139
|
+
}
|
140
|
+
|
141
|
+
static VALUE mod_nmt(VALUE self)
|
142
|
+
{
|
143
|
+
nfc_modulation_t * mod;
|
144
|
+
|
145
|
+
Data_Get_Struct(self, nfc_modulation_t, mod);
|
146
|
+
|
147
|
+
return INT2NUM(mod->nmt);
|
148
|
+
}
|
149
|
+
|
150
|
+
static VALUE mod_nbr(VALUE self)
|
151
|
+
{
|
152
|
+
nfc_modulation_t * mod;
|
153
|
+
|
154
|
+
Data_Get_Struct(self, nfc_modulation_t, mod);
|
155
|
+
|
156
|
+
return INT2NUM(mod->nbr);
|
157
|
+
}
|
158
|
+
|
104
159
|
void init_device()
|
105
160
|
{
|
161
|
+
VALUE cNfcModulation;
|
106
162
|
VALUE cNfcDevice = rb_define_class_under(cNfc, "Device", rb_cObject);
|
107
163
|
|
108
164
|
rb_define_singleton_method(cNfcDevice, "connect", connect, 0);
|
@@ -111,4 +167,21 @@ void init_device()
|
|
111
167
|
rb_define_method(cNfcDevice, "select", dev_select, 1);
|
112
168
|
rb_define_method(cNfcDevice, "deselect", dev_deselect, 0);
|
113
169
|
rb_define_method(cNfcDevice, "name", name, 0);
|
170
|
+
|
171
|
+
cNfcModulation = rb_define_class_under(cNfcDevice, "Modulation", rb_cObject);
|
172
|
+
|
173
|
+
/* modulation types. */
|
174
|
+
rb_define_const(cNfcModulation, "NMT_ISO14443A", INT2NUM(NMT_ISO14443A));
|
175
|
+
rb_define_const(cNfcModulation, "NMT_FELICA", INT2NUM(NMT_FELICA));
|
176
|
+
|
177
|
+
/* baud rates */
|
178
|
+
rb_define_const(cNfcModulation, "NBR_UNDEFINED", INT2NUM(NBR_UNDEFINED));
|
179
|
+
rb_define_const(cNfcModulation, "NBR_106", INT2NUM(NBR_106));
|
180
|
+
rb_define_const(cNfcModulation, "NBR_212", INT2NUM(NBR_212));
|
181
|
+
|
182
|
+
rb_define_alloc_func(cNfcModulation, mod_alloc);
|
183
|
+
|
184
|
+
rb_define_method(cNfcModulation, "initialize", mod_initialize, 2);
|
185
|
+
rb_define_method(cNfcModulation, "nmt", mod_nmt, 0);
|
186
|
+
rb_define_method(cNfcModulation, "nbr", mod_nbr, 0);
|
114
187
|
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#include <nfc_felica.h>
|
2
|
+
|
3
|
+
VALUE cNfcFelica;
|
4
|
+
|
5
|
+
/*
|
6
|
+
* size_t szLen;
|
7
|
+
* byte_t btResCode;
|
8
|
+
* byte_t abtId[8];
|
9
|
+
* byte_t abtPad[8];
|
10
|
+
* byte_t abtSysCode[2];
|
11
|
+
*/
|
12
|
+
|
13
|
+
static VALUE szLen(VALUE self)
|
14
|
+
{
|
15
|
+
nfc_felica_info_t * tag;
|
16
|
+
Data_Get_Struct(self, nfc_felica_info_t, tag);
|
17
|
+
|
18
|
+
return INT2NUM(tag->szLen);
|
19
|
+
}
|
20
|
+
|
21
|
+
static VALUE btResCode(VALUE self)
|
22
|
+
{
|
23
|
+
nfc_felica_info_t * tag;
|
24
|
+
Data_Get_Struct(self, nfc_felica_info_t, tag);
|
25
|
+
|
26
|
+
return INT2NUM(tag->btResCode);
|
27
|
+
}
|
28
|
+
|
29
|
+
static VALUE abtId(VALUE self)
|
30
|
+
{
|
31
|
+
nfc_felica_info_t * tag;
|
32
|
+
Data_Get_Struct(self, nfc_felica_info_t, tag);
|
33
|
+
|
34
|
+
return rb_str_new(tag->abtId, 8 );
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE abtPad(VALUE self)
|
38
|
+
{
|
39
|
+
nfc_felica_info_t * tag;
|
40
|
+
Data_Get_Struct(self, nfc_felica_info_t, tag);
|
41
|
+
|
42
|
+
return rb_str_new(tag->abtPad, 8 );
|
43
|
+
}
|
44
|
+
|
45
|
+
static VALUE abtSysCode(VALUE self)
|
46
|
+
{
|
47
|
+
nfc_felica_info_t * tag;
|
48
|
+
Data_Get_Struct(self, nfc_felica_info_t, tag);
|
49
|
+
|
50
|
+
return rb_str_new(tag->abtSysCode, 2 );
|
51
|
+
}
|
52
|
+
|
53
|
+
void init_felica()
|
54
|
+
{
|
55
|
+
cNfcFelica = rb_define_class_under(cNfc, "Felica", rb_cObject);
|
56
|
+
|
57
|
+
rb_define_method(cNfcFelica, "szLen", szLen, 0);
|
58
|
+
rb_define_method(cNfcFelica, "btResCode", btResCode, 0);
|
59
|
+
rb_define_method(cNfcFelica, "abtId", abtId, 0);
|
60
|
+
rb_define_private_method(cNfcFelica, "abtPad", abtPad, 0);
|
61
|
+
rb_define_private_method(cNfcFelica, "abtSysCode", abtSysCode, 0);
|
62
|
+
}
|
data/ext/nfc/nfc_iso14443a.c
CHANGED
@@ -4,30 +4,30 @@ VALUE cNfcISO14443A;
|
|
4
4
|
|
5
5
|
/*
|
6
6
|
* call-seq:
|
7
|
-
*
|
7
|
+
* szUidLen
|
8
8
|
*
|
9
|
-
* Get the
|
9
|
+
* Get the szUidLen
|
10
10
|
*/
|
11
|
-
static VALUE
|
11
|
+
static VALUE szUidLen(VALUE self)
|
12
12
|
{
|
13
|
-
|
14
|
-
Data_Get_Struct(self,
|
13
|
+
nfc_iso14443a_info_t * tag;
|
14
|
+
Data_Get_Struct(self, nfc_iso14443a_info_t, tag);
|
15
15
|
|
16
|
-
return INT2NUM(tag->
|
16
|
+
return INT2NUM(tag->szUidLen);
|
17
17
|
}
|
18
18
|
|
19
19
|
/*
|
20
20
|
* call-seq:
|
21
|
-
*
|
21
|
+
* szAtsLen
|
22
22
|
*
|
23
|
-
* Get the
|
23
|
+
* Get the szAtsLen
|
24
24
|
*/
|
25
|
-
static VALUE
|
25
|
+
static VALUE szAtsLen(VALUE self)
|
26
26
|
{
|
27
|
-
|
28
|
-
Data_Get_Struct(self,
|
27
|
+
nfc_iso14443a_info_t * tag;
|
28
|
+
Data_Get_Struct(self, nfc_iso14443a_info_t, tag);
|
29
29
|
|
30
|
-
return INT2NUM(tag->
|
30
|
+
return INT2NUM(tag->szAtsLen);
|
31
31
|
}
|
32
32
|
|
33
33
|
/*
|
@@ -38,10 +38,10 @@ static VALUE uiAtsLen(VALUE self)
|
|
38
38
|
*/
|
39
39
|
static VALUE abtUid(VALUE self)
|
40
40
|
{
|
41
|
-
|
42
|
-
Data_Get_Struct(self,
|
41
|
+
nfc_iso14443a_info_t * tag;
|
42
|
+
Data_Get_Struct(self, nfc_iso14443a_info_t, tag);
|
43
43
|
|
44
|
-
return rb_str_new(tag->abtUid, tag->
|
44
|
+
return rb_str_new(tag->abtUid, tag->szUidLen);
|
45
45
|
}
|
46
46
|
|
47
47
|
/*
|
@@ -52,10 +52,10 @@ static VALUE abtUid(VALUE self)
|
|
52
52
|
*/
|
53
53
|
static VALUE abtAts(VALUE self)
|
54
54
|
{
|
55
|
-
|
56
|
-
Data_Get_Struct(self,
|
55
|
+
nfc_iso14443a_info_t * tag;
|
56
|
+
Data_Get_Struct(self, nfc_iso14443a_info_t, tag);
|
57
57
|
|
58
|
-
return rb_str_new(tag->abtAts, tag->
|
58
|
+
return rb_str_new(tag->abtAts, tag->szAtsLen);
|
59
59
|
}
|
60
60
|
|
61
61
|
/*
|
@@ -66,8 +66,8 @@ static VALUE abtAts(VALUE self)
|
|
66
66
|
*/
|
67
67
|
static VALUE abtAtqa(VALUE self)
|
68
68
|
{
|
69
|
-
|
70
|
-
Data_Get_Struct(self,
|
69
|
+
nfc_iso14443a_info_t * tag;
|
70
|
+
Data_Get_Struct(self, nfc_iso14443a_info_t, tag);
|
71
71
|
|
72
72
|
return rb_str_new(tag->abtAtqa, 2);
|
73
73
|
}
|
@@ -80,8 +80,8 @@ static VALUE abtAtqa(VALUE self)
|
|
80
80
|
*/
|
81
81
|
static VALUE btSak(VALUE self)
|
82
82
|
{
|
83
|
-
|
84
|
-
Data_Get_Struct(self,
|
83
|
+
nfc_iso14443a_info_t * tag;
|
84
|
+
Data_Get_Struct(self, nfc_iso14443a_info_t, tag);
|
85
85
|
|
86
86
|
return INT2NUM(tag->btSak);
|
87
87
|
}
|
@@ -90,8 +90,8 @@ void init_iso14443a()
|
|
90
90
|
{
|
91
91
|
cNfcISO14443A = rb_define_class_under(cNfc, "ISO14443A", rb_cObject);
|
92
92
|
|
93
|
-
rb_define_method(cNfcISO14443A, "
|
94
|
-
rb_define_method(cNfcISO14443A, "
|
93
|
+
rb_define_method(cNfcISO14443A, "szUidLen", szUidLen, 0);
|
94
|
+
rb_define_method(cNfcISO14443A, "szAtsLen", szAtsLen, 0);
|
95
95
|
rb_define_method(cNfcISO14443A, "btSak", btSak, 0);
|
96
96
|
|
97
97
|
rb_define_private_method(cNfcISO14443A, "abtUid", abtUid, 0);
|
data/lib/nfc.rb
CHANGED
@@ -3,13 +3,14 @@ require 'thread'
|
|
3
3
|
require 'nfc/nfc'
|
4
4
|
require 'nfc/device'
|
5
5
|
require 'nfc/iso14443a'
|
6
|
+
require 'nfc/felica'
|
6
7
|
|
7
8
|
###
|
8
9
|
# NFC is a class for dealing with Near Field Communication systems. This
|
9
10
|
# library will read RFID tags from an RFID reader. You should start by reading
|
10
11
|
# NFC#find
|
11
12
|
class NFC
|
12
|
-
VERSION = '2.0
|
13
|
+
VERSION = '2.1.0'
|
13
14
|
|
14
15
|
include Singleton
|
15
16
|
|
data/lib/nfc/device.rb
CHANGED
data/lib/nfc/felica.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
class NFC
|
2
|
+
class Felica
|
3
|
+
|
4
|
+
def uid
|
5
|
+
abtId.unpack 'C*'
|
6
|
+
end
|
7
|
+
|
8
|
+
def pad
|
9
|
+
abtPad.unpack 'C*'
|
10
|
+
end
|
11
|
+
|
12
|
+
def sys_code
|
13
|
+
abtSysCode.unpack 'C*'
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s join_string = ''
|
17
|
+
sprintf((['%02x'] * 8 ).join(join_string), * uid).upcase
|
18
|
+
end
|
19
|
+
|
20
|
+
def inspect
|
21
|
+
# 78 printf("The following (NFC) Felica tag was found:\n\n");
|
22
|
+
# 79 printf("%18s","ID (NFCID2): "); print_hex(ti.tif.abtId,8);
|
23
|
+
# 80 printf("%18s","Parameter (PAD): "); print_hex(ti.tif.abtPad,8);
|
24
|
+
pad = sprintf( (['%02x'] * 8 ).join(' '), *self.pad)
|
25
|
+
string_ary = [
|
26
|
+
"(NFC) Felica Tag",
|
27
|
+
"ID (NFCID2): #{to_s ' '}",
|
28
|
+
"Parameter(PAD): #{pad}"
|
29
|
+
]
|
30
|
+
string_ary.join "\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/nfc/iso14443a.rb
CHANGED
@@ -21,7 +21,7 @@ class NFC
|
|
21
21
|
###
|
22
22
|
# Get the UID as a hex string
|
23
23
|
def to_s join_string = ''
|
24
|
-
sprintf((['%02x'] *
|
24
|
+
sprintf((['%02x'] * szUidLen).join(join_string), * uid).upcase
|
25
25
|
end
|
26
26
|
|
27
27
|
###
|
@@ -33,8 +33,8 @@ class NFC
|
|
33
33
|
" UID (NFCID1): #{to_s ' '}",
|
34
34
|
" SAK (SEL_RES): #{sprintf("%02x", btSak)}"
|
35
35
|
]
|
36
|
-
if
|
37
|
-
ats = sprintf((['%02x'] *
|
36
|
+
if szAtsLen > 0
|
37
|
+
ats = sprintf((['%02x'] * szAtsLen).join(' '), *self.ats)
|
38
38
|
string_ary << " ATS (ATR): #{ats}"
|
39
39
|
end
|
40
40
|
string_ary.join "\n"
|
metadata
CHANGED
@@ -1,42 +1,44 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nfc
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
|
-
authors:
|
7
|
+
authors:
|
7
8
|
- Aaron Patterson
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-05-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: hoe
|
16
|
+
requirement: &2153398480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.9.4
|
17
22
|
type: :development
|
18
|
-
|
19
|
-
version_requirements:
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
version: 2.3.3
|
24
|
-
version:
|
25
|
-
description: |-
|
26
|
-
NFC is a ruby wrapper for the Near Field Communication library. The Near
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2153398480
|
25
|
+
description: ! 'NFC is a ruby wrapper for the Near Field Communication library. The
|
26
|
+
Near
|
27
|
+
|
27
28
|
Field Communication library works with many USB RFID readers, so this gem
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
|
30
|
+
lets you read RFID tags.'
|
31
|
+
email:
|
32
|
+
- aaron@tenderlovemaking.com
|
33
|
+
executables:
|
32
34
|
- nfc
|
33
|
-
extensions:
|
35
|
+
extensions:
|
34
36
|
- ext/nfc/extconf.rb
|
35
|
-
extra_rdoc_files:
|
37
|
+
extra_rdoc_files:
|
36
38
|
- Manifest.txt
|
37
39
|
- CHANGELOG.rdoc
|
38
40
|
- README.rdoc
|
39
|
-
files:
|
41
|
+
files:
|
40
42
|
- .autotest
|
41
43
|
- CHANGELOG.rdoc
|
42
44
|
- Manifest.txt
|
@@ -48,41 +50,41 @@ files:
|
|
48
50
|
- ext/nfc/nfc.h
|
49
51
|
- ext/nfc/nfc_device.c
|
50
52
|
- ext/nfc/nfc_device.h
|
53
|
+
- ext/nfc/nfc_felica.c
|
54
|
+
- ext/nfc/nfc_felica.h
|
51
55
|
- ext/nfc/nfc_iso14443a.c
|
52
56
|
- ext/nfc/nfc_iso14443a.h
|
53
57
|
- lib/nfc.rb
|
54
58
|
- lib/nfc/device.rb
|
59
|
+
- lib/nfc/felica.rb
|
55
60
|
- lib/nfc/iso14443a.rb
|
56
61
|
- test/test_nfc.rb
|
57
|
-
|
62
|
+
- .gemtest
|
58
63
|
homepage: http://seattlerb.rubyforge.org
|
59
64
|
licenses: []
|
60
|
-
|
61
65
|
post_install_message:
|
62
|
-
rdoc_options:
|
66
|
+
rdoc_options:
|
63
67
|
- --main
|
64
68
|
- README.rdoc
|
65
|
-
require_paths:
|
69
|
+
require_paths:
|
66
70
|
- lib
|
67
|
-
|
68
|
-
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version:
|
73
|
-
|
74
|
-
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version:
|
79
|
-
version:
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
80
83
|
requirements: []
|
81
|
-
|
82
|
-
|
83
|
-
rubygems_version: 1.3.5
|
84
|
+
rubyforge_project: nfc
|
85
|
+
rubygems_version: 1.8.2
|
84
86
|
signing_key:
|
85
87
|
specification_version: 3
|
86
88
|
summary: NFC is a ruby wrapper for the Near Field Communication library
|
87
|
-
test_files:
|
89
|
+
test_files:
|
88
90
|
- test/test_nfc.rb
|