nfc 3.1.1 → 3.1.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7d7ab7f490306f5f340886ecdd764548e3b0ec1e
4
- data.tar.gz: 5acf1a8527f3113081ceb4e936c86e371c7f8536
2
+ SHA256:
3
+ metadata.gz: 880daef4e1b9f8531dfdc0918b68ba72ed46e88003f71b25cc17ea3309437b31
4
+ data.tar.gz: a0293da46032dc21626205360daaee2b06b7aa4f0ac02c8fc5a3e5dde6bfa6cd
5
5
  SHA512:
6
- metadata.gz: 49442bb326f2791695fa0cbe2d8eb5b7c8490d3c432da2d88263a81a247f967bab6f80c81513a4097f6e5f345c69f84b5f644d9e2fadd3855a2dea7ddf1ed1c1
7
- data.tar.gz: 1b0ac6fc0ec8640739a369337e1975fbc9402cc67c201897b307b7966cbcf71934a54b20b1bad87abc9d44791ec7239cdb9ba1ed7575b6441b8c1f704609d654
6
+ metadata.gz: 770e545c3fde0e95c5b7bf74a0a77e18d7738c3c5967456af903a101adb9f08aca4418693c078329b04efd45e39f95c25d92c771a3279d4aba2eefc2f42fd535
7
+ data.tar.gz: 3d507a24639bf3c544e96090f2fe61f87433c5915e9cd42751b5343405d64f7c0dfa3b5d7b30433b459c0de82b139691d4b7c9896c0e667a11a65d00b67be212
@@ -1,61 +1,63 @@
1
1
  #include <nfc.h>
2
2
 
3
3
  static VALUE allocate(VALUE klass) {
4
- nfc_context * context;
5
- nfc_init(&context);
6
- return Data_Wrap_Struct(klass, NULL, nfc_exit, context);
4
+ nfc_context * context;
5
+ nfc_init(&context);
6
+ return Data_Wrap_Struct(klass, NULL, nfc_exit, context);
7
7
  }
8
8
 
9
9
  static VALUE open_dev(VALUE self, VALUE name)
10
10
  {
11
- nfc_context * ctx;
12
- nfc_device * dev;
13
- VALUE device;
11
+ nfc_context * ctx;
12
+ nfc_device * dev;
13
+ VALUE device;
14
14
 
15
- Data_Get_Struct(self, nfc_context, ctx);
15
+ Data_Get_Struct(self, nfc_context, ctx);
16
16
 
17
- if (NIL_P(name)) {
18
- dev = nfc_open(ctx, NULL);
19
- } else {
20
- dev = nfc_open(ctx, StringValuePtr(name));
21
- }
17
+ if (NIL_P(name)) {
18
+ dev = nfc_open(ctx, NULL);
19
+ } else {
20
+ dev = nfc_open(ctx, StringValuePtr(name));
21
+ }
22
22
 
23
- if (NULL == dev)
24
- rb_raise(rb_eRuntimeError, "Unable to open the device");
23
+ if (NULL == dev)
24
+ rb_raise(rb_eRuntimeError, "Unable to open the device");
25
25
 
26
- if(nfc_initiator_init(dev) < 0)
27
- rb_raise(rb_eRuntimeError, "Could not initialize device");
26
+ if(nfc_initiator_init(dev) < 0)
27
+ rb_raise(rb_eRuntimeError, "Could not initialize device");
28
28
 
29
- device = Data_Wrap_Struct(cNfcDevice, 0, nfc_close, dev);
30
- rb_iv_set(device, "@context", self);
31
- return device;
29
+ device = Data_Wrap_Struct(cNfcDevice, 0, nfc_close, dev);
30
+ rb_iv_set(device, "@context", self);
31
+ return device;
32
32
  }
33
33
 
34
34
  static VALUE devices(VALUE self, VALUE len)
35
35
  {
36
- nfc_context *ctx;
37
- nfc_connstring * strs;
38
- size_t found, i;
39
- VALUE devs;
40
-
41
- Data_Get_Struct(self, nfc_context, ctx);
42
-
43
- strs = malloc(sizeof(nfc_connstring) * len);
44
-
45
- found = nfc_list_devices(ctx, strs, 10);
46
- devs = rb_ary_new2(found);
47
- for (i = 0; i < found; i++) {
48
- rb_ary_push(devs, rb_str_new2(strs[i]));
49
- }
50
- free(strs);
51
- return devs;
36
+ nfc_context *ctx;
37
+ nfc_connstring * strs;
38
+ size_t found, i;
39
+ VALUE devs;
40
+
41
+ Data_Get_Struct(self, nfc_context, ctx);
42
+
43
+ strs = malloc(sizeof(nfc_connstring) * len);
44
+
45
+ found = nfc_list_devices(ctx, strs, 10);
46
+ devs = rb_ary_new2(found);
47
+ for (i = 0; i < found; i++) {
48
+ rb_ary_push(devs, rb_str_new2(strs[i]));
49
+ }
50
+ free(strs);
51
+ return devs;
52
52
  }
53
53
 
54
54
  void init_context()
55
55
  {
56
- VALUE cContext = rb_define_class_under(mNfc, "Context", rb_cObject);
57
- rb_define_alloc_func(cContext, allocate);
56
+ VALUE cContext = rb_define_class_under(mNfc, "Context", rb_cObject);
57
+ rb_define_alloc_func(cContext, allocate);
58
58
 
59
- rb_define_method(cContext, "devices", devices, 1);
60
- rb_define_method(cContext, "open", open_dev, 1);
59
+ rb_define_method(cContext, "devices", devices, 1);
60
+ rb_define_method(cContext, "open", open_dev, 1);
61
61
  }
62
+
63
+ /* vim: set noet sws=4 sw=4: */
@@ -4,12 +4,14 @@ VALUE mNfc;
4
4
 
5
5
  void Init_nfc()
6
6
  {
7
- mNfc = rb_define_module("NFC");
8
-
9
- init_context();
10
- init_device();
11
- init_iso14443a();
12
- /*
13
- init_felica();
14
- */
7
+ mNfc = rb_define_module("NFC");
8
+
9
+ init_context();
10
+ init_device();
11
+ init_iso14443a();
12
+ /*
13
+ init_felica();
14
+ */
15
15
  }
16
+
17
+ /* vim: set noet sws=4 sw=4: */
@@ -1,7 +1,28 @@
1
1
  #include <nfc.h>
2
+ #include <ruby/thread.h>
2
3
 
3
4
  VALUE cNfcDevice;
4
5
 
6
+ struct nogvl_ctx {
7
+ nfc_device *dev;
8
+ nfc_modulation *mod;
9
+ nfc_target *ti;
10
+ };
11
+
12
+ void * nogvl_select_passive_target(void * ctx)
13
+ {
14
+ nfc_device * dev;
15
+ nfc_modulation * mod;
16
+ nfc_target * ti;
17
+
18
+ struct nogvl_ctx * myctx = (struct nogvl_ctx *)ctx;
19
+ dev = myctx->dev;
20
+ mod = myctx->mod;
21
+ ti = myctx->ti;
22
+
23
+ return nfc_initiator_select_passive_target(dev, *mod, NULL, 0, ti);
24
+ }
25
+
5
26
  /*
6
27
  * call-seq:
7
28
  * select_passive_target(tag)
@@ -10,32 +31,37 @@ VALUE cNfcDevice;
10
31
  */
11
32
  static VALUE select_passive_target(VALUE self, VALUE tag)
12
33
  {
13
- nfc_device * dev;
14
- nfc_modulation * mod;
15
- nfc_target * ti;
16
-
17
- Data_Get_Struct(self, nfc_device, dev);
18
- Data_Get_Struct(tag, nfc_modulation, mod);
19
-
20
- ti = (nfc_target *)xmalloc(sizeof(nfc_target));
21
-
22
- if (nfc_initiator_select_passive_target(dev, *mod, NULL, 0, ti) ) {
23
- switch(mod->nmt) {
24
- case NMT_ISO14443A:
25
- return Data_Wrap_Struct(cNfcISO14443A, 0, xfree, ti);
26
- break;
27
- case NMT_FELICA:
28
- /* return Data_Wrap_Struct(cNfcFelica, 0, free, ti); */
29
- return Qnil;
30
- break;
31
- default:
32
- rb_raise(rb_eRuntimeError, "untested type: %d", mod->nmt);
33
- }
34
- }else {
34
+ nfc_device * dev;
35
+ nfc_modulation * mod;
36
+ nfc_target * ti;
37
+ struct nogvl_ctx ctx;
38
+
39
+ Data_Get_Struct(self, nfc_device, dev);
40
+ Data_Get_Struct(tag, nfc_modulation, mod);
41
+
42
+ ti = (nfc_target *)xmalloc(sizeof(nfc_target));
43
+
44
+ ctx.dev = dev;
45
+ ctx.mod = mod;
46
+ ctx.ti = ti;
47
+
48
+ if (rb_thread_call_without_gvl(nogvl_select_passive_target, &ctx, RUBY_UBF_IO, 0) ) {
49
+ switch(mod->nmt) {
50
+ case NMT_ISO14443A:
51
+ return Data_Wrap_Struct(cNfcISO14443A, 0, xfree, ti);
52
+ break;
53
+ case NMT_FELICA:
54
+ /* return Data_Wrap_Struct(cNfcFelica, 0, free, ti); */
55
+ return Qnil;
56
+ break;
57
+ default:
58
+ rb_raise(rb_eRuntimeError, "untested type: %d", mod->nmt);
59
+ }
60
+ } else {
35
61
  xfree(ti);
36
- }
62
+ }
37
63
 
38
- return Qfalse;
64
+ return Qfalse;
39
65
  }
40
66
 
41
67
  /*
@@ -46,37 +72,37 @@ static VALUE select_passive_target(VALUE self, VALUE tag)
46
72
  */
47
73
  static VALUE poll_target(VALUE self, VALUE tag, VALUE poll_nr, VALUE ms)
48
74
  {
49
- nfc_device * dev;
50
- nfc_modulation * mod;
51
- nfc_target * ti;
52
- int code;
53
- int ms_c, poll_nr_c;
54
- Data_Get_Struct(self, nfc_device, dev);
55
- Data_Get_Struct(tag, nfc_modulation, mod);
56
-
57
- ms_c = FIX2INT(ms);
58
- poll_nr_c = FIX2INT(poll_nr);
59
-
60
- ti = (nfc_target *)xmalloc(sizeof(nfc_target));
61
-
62
- code = nfc_initiator_poll_target(dev, mod, 1, poll_nr_c, ms_c, ti);
63
-
64
- if (code > 0) {
65
- switch(mod->nmt) {
66
- case NMT_ISO14443A:
67
- return Data_Wrap_Struct(cNfcISO14443A, 0, xfree, ti);
68
- break;
69
- case NMT_FELICA:
70
- return Data_Wrap_Struct(cNfcFelica, 0, xfree, ti);
71
- break;
72
- default:
73
- rb_raise(rb_eRuntimeError, "untested type: %d", mod->nmt);
74
- }
75
- }else {
75
+ nfc_device * dev;
76
+ nfc_modulation * mod;
77
+ nfc_target * ti;
78
+ int code;
79
+ int ms_c, poll_nr_c;
80
+ Data_Get_Struct(self, nfc_device, dev);
81
+ Data_Get_Struct(tag, nfc_modulation, mod);
82
+
83
+ ms_c = FIX2INT(ms);
84
+ poll_nr_c = FIX2INT(poll_nr);
85
+
86
+ ti = (nfc_target *)xmalloc(sizeof(nfc_target));
87
+
88
+ code = nfc_initiator_poll_target(dev, mod, 1, poll_nr_c, ms_c, ti);
89
+
90
+ if (code > 0) {
91
+ switch(mod->nmt) {
92
+ case NMT_ISO14443A:
93
+ return Data_Wrap_Struct(cNfcISO14443A, 0, xfree, ti);
94
+ break;
95
+ case NMT_FELICA:
96
+ return Data_Wrap_Struct(cNfcFelica, 0, xfree, ti);
97
+ break;
98
+ default:
99
+ rb_raise(rb_eRuntimeError, "untested type: %d", mod->nmt);
100
+ }
101
+ }else {
76
102
  xfree(ti);
77
- }
103
+ }
78
104
 
79
- return INT2NUM(code);
105
+ return INT2NUM(code);
80
106
  }
81
107
 
82
108
  /*
@@ -87,10 +113,10 @@ static VALUE poll_target(VALUE self, VALUE tag, VALUE poll_nr, VALUE ms)
87
113
  */
88
114
  static VALUE name(VALUE self)
89
115
  {
90
- nfc_device * dev;
91
- Data_Get_Struct(self, nfc_device, dev);
116
+ nfc_device * dev;
117
+ Data_Get_Struct(self, nfc_device, dev);
92
118
 
93
- return rb_str_new2(nfc_device_get_name(dev));
119
+ return rb_str_new2(nfc_device_get_name(dev));
94
120
  }
95
121
 
96
122
  /*
@@ -101,90 +127,92 @@ static VALUE name(VALUE self)
101
127
  */
102
128
  static VALUE dev_deselect(VALUE self)
103
129
  {
104
- nfc_device * dev;
105
- Data_Get_Struct(self, nfc_device, dev);
130
+ nfc_device * dev;
131
+ Data_Get_Struct(self, nfc_device, dev);
106
132
 
107
- nfc_initiator_deselect_target(dev);
133
+ nfc_initiator_deselect_target(dev);
108
134
 
109
- return self;
135
+ return self;
110
136
  }
111
137
 
112
138
  static VALUE mod_initialize(VALUE self, VALUE type, VALUE baud)
113
139
  {
114
- nfc_modulation * mod;
140
+ nfc_modulation * mod;
115
141
 
116
- Data_Get_Struct(self, nfc_modulation, mod);
117
- mod->nmt = NUM2INT(type);
118
- mod->nbr = NUM2INT(baud);
142
+ Data_Get_Struct(self, nfc_modulation, mod);
143
+ mod->nmt = NUM2INT(type);
144
+ mod->nbr = NUM2INT(baud);
119
145
 
120
- return self;
146
+ return self;
121
147
  }
122
148
 
123
149
  static VALUE mod_alloc(VALUE klass)
124
150
  {
125
- nfc_modulation * modulation;
151
+ nfc_modulation * modulation;
126
152
 
127
- modulation = xcalloc(1, sizeof(nfc_modulation));
153
+ modulation = xcalloc(1, sizeof(nfc_modulation));
128
154
 
129
- return Data_Wrap_Struct(klass, NULL, xfree, modulation);
155
+ return Data_Wrap_Struct(klass, NULL, xfree, modulation);
130
156
  }
131
157
 
132
158
  static VALUE mod_nmt(VALUE self)
133
159
  {
134
- nfc_modulation * mod;
160
+ nfc_modulation * mod;
135
161
 
136
- Data_Get_Struct(self, nfc_modulation, mod);
162
+ Data_Get_Struct(self, nfc_modulation, mod);
137
163
 
138
- return INT2NUM(mod->nmt);
164
+ return INT2NUM(mod->nmt);
139
165
  }
140
166
 
141
167
  static VALUE mod_nbr(VALUE self)
142
168
  {
143
- nfc_modulation * mod;
169
+ nfc_modulation * mod;
144
170
 
145
- Data_Get_Struct(self, nfc_modulation, mod);
171
+ Data_Get_Struct(self, nfc_modulation, mod);
146
172
 
147
- return INT2NUM(mod->nbr);
173
+ return INT2NUM(mod->nbr);
148
174
  }
149
175
 
150
176
  static VALUE initiator_init(VALUE self)
151
177
  {
152
- nfc_device * dev;
153
- int err;
178
+ nfc_device * dev;
179
+ int err;
154
180
 
155
- Data_Get_Struct(self, nfc_device, dev);
181
+ Data_Get_Struct(self, nfc_device, dev);
156
182
 
157
- err = nfc_initiator_init(dev);
158
- if (0 == err)
159
- return Qtrue;
183
+ err = nfc_initiator_init(dev);
184
+ if (0 == err)
185
+ return Qtrue;
160
186
 
161
- return INT2NUM(err);
187
+ return INT2NUM(err);
162
188
  }
163
189
 
164
190
  void init_device()
165
191
  {
166
- VALUE cNfcModulation;
167
- cNfcDevice = rb_define_class_under(mNfc, "Device", rb_cObject);
168
- rb_define_method(cNfcDevice, "initiator_init", initiator_init, 0);
169
- rb_define_method(cNfcDevice, "select_passive_target", select_passive_target, 1);
170
- rb_define_method(cNfcDevice, "poll_target", poll_target, 3);
171
- rb_define_method(cNfcDevice, "name", name, 0);
172
- rb_define_method(cNfcDevice, "deselect", dev_deselect, 0);
173
-
174
- cNfcModulation = rb_define_class_under(cNfcDevice, "Modulation", rb_cObject);
175
-
176
- /* modulation types. */
177
- rb_define_const(cNfcModulation, "NMT_ISO14443A", INT2NUM(NMT_ISO14443A));
178
- rb_define_const(cNfcModulation, "NMT_FELICA", INT2NUM(NMT_FELICA));
179
-
180
- /* baud rates */
181
- rb_define_const(cNfcModulation, "NBR_UNDEFINED", INT2NUM(NBR_UNDEFINED));
182
- rb_define_const(cNfcModulation, "NBR_106", INT2NUM(NBR_106));
183
- rb_define_const(cNfcModulation, "NBR_212", INT2NUM(NBR_212));
184
-
185
- rb_define_alloc_func(cNfcModulation, mod_alloc);
186
-
187
- rb_define_method(cNfcModulation, "initialize", mod_initialize, 2);
188
- rb_define_method(cNfcModulation, "nmt", mod_nmt, 0);
189
- rb_define_method(cNfcModulation, "nbr", mod_nbr, 0);
192
+ VALUE cNfcModulation;
193
+ cNfcDevice = rb_define_class_under(mNfc, "Device", rb_cObject);
194
+ rb_define_method(cNfcDevice, "initiator_init", initiator_init, 0);
195
+ rb_define_method(cNfcDevice, "select_passive_target", select_passive_target, 1);
196
+ rb_define_method(cNfcDevice, "poll_target", poll_target, 3);
197
+ rb_define_method(cNfcDevice, "name", name, 0);
198
+ rb_define_method(cNfcDevice, "deselect", dev_deselect, 0);
199
+
200
+ cNfcModulation = rb_define_class_under(cNfcDevice, "Modulation", rb_cObject);
201
+
202
+ /* modulation types. */
203
+ rb_define_const(cNfcModulation, "NMT_ISO14443A", INT2NUM(NMT_ISO14443A));
204
+ rb_define_const(cNfcModulation, "NMT_FELICA", INT2NUM(NMT_FELICA));
205
+
206
+ /* baud rates */
207
+ rb_define_const(cNfcModulation, "NBR_UNDEFINED", INT2NUM(NBR_UNDEFINED));
208
+ rb_define_const(cNfcModulation, "NBR_106", INT2NUM(NBR_106));
209
+ rb_define_const(cNfcModulation, "NBR_212", INT2NUM(NBR_212));
210
+
211
+ rb_define_alloc_func(cNfcModulation, mod_alloc);
212
+
213
+ rb_define_method(cNfcModulation, "initialize", mod_initialize, 2);
214
+ rb_define_method(cNfcModulation, "nmt", mod_nmt, 0);
215
+ rb_define_method(cNfcModulation, "nbr", mod_nbr, 0);
190
216
  }
217
+
218
+ /* vim: set noet sws=4 sw=4: */
@@ -10,10 +10,10 @@ VALUE cNfcISO14443A;
10
10
  */
11
11
  static VALUE szUidLen(VALUE self)
12
12
  {
13
- nfc_target * tag;
14
- Data_Get_Struct(self, nfc_target, tag);
13
+ nfc_target * tag;
14
+ Data_Get_Struct(self, nfc_target, tag);
15
15
 
16
- return INT2NUM(tag->nti.nai.szUidLen);
16
+ return INT2NUM(tag->nti.nai.szUidLen);
17
17
  }
18
18
 
19
19
  /*
@@ -24,10 +24,10 @@ static VALUE szUidLen(VALUE self)
24
24
  */
25
25
  static VALUE szAtsLen(VALUE self)
26
26
  {
27
- nfc_target * tag;
28
- Data_Get_Struct(self, nfc_target, tag);
27
+ nfc_target * tag;
28
+ Data_Get_Struct(self, nfc_target, tag);
29
29
 
30
- return INT2NUM(tag->nti.nai.szAtsLen);
30
+ return INT2NUM(tag->nti.nai.szAtsLen);
31
31
  }
32
32
 
33
33
  /*
@@ -38,10 +38,10 @@ static VALUE szAtsLen(VALUE self)
38
38
  */
39
39
  static VALUE abtUid(VALUE self)
40
40
  {
41
- nfc_target * tag;
42
- Data_Get_Struct(self, nfc_target, tag);
41
+ nfc_target * tag;
42
+ Data_Get_Struct(self, nfc_target, tag);
43
43
 
44
- return rb_str_new((const char *)tag->nti.nai.abtUid, tag->nti.nai.szUidLen);
44
+ return rb_str_new((const char *)tag->nti.nai.abtUid, tag->nti.nai.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
- nfc_target * tag;
56
- Data_Get_Struct(self, nfc_target, tag);
55
+ nfc_target * tag;
56
+ Data_Get_Struct(self, nfc_target, tag);
57
57
 
58
- return rb_str_new((const char *)tag->nti.nai.abtAts, tag->nti.nai.szAtsLen);
58
+ return rb_str_new((const char *)tag->nti.nai.abtAts, tag->nti.nai.szAtsLen);
59
59
  }
60
60
 
61
61
  /*
@@ -66,10 +66,10 @@ static VALUE abtAts(VALUE self)
66
66
  */
67
67
  static VALUE abtAtqa(VALUE self)
68
68
  {
69
- nfc_target * tag;
70
- Data_Get_Struct(self, nfc_target, tag);
69
+ nfc_target * tag;
70
+ Data_Get_Struct(self, nfc_target, tag);
71
71
 
72
- return rb_str_new((const char *)tag->nti.nai.abtAtqa, 2);
72
+ return rb_str_new((const char *)tag->nti.nai.abtAtqa, 2);
73
73
  }
74
74
 
75
75
  /*
@@ -80,21 +80,23 @@ static VALUE abtAtqa(VALUE self)
80
80
  */
81
81
  static VALUE btSak(VALUE self)
82
82
  {
83
- nfc_target * tag;
84
- Data_Get_Struct(self, nfc_target, tag);
83
+ nfc_target * tag;
84
+ Data_Get_Struct(self, nfc_target, tag);
85
85
 
86
- return INT2NUM(tag->nti.nai.btSak);
86
+ return INT2NUM(tag->nti.nai.btSak);
87
87
  }
88
88
 
89
89
  void init_iso14443a()
90
90
  {
91
- cNfcISO14443A = rb_define_class_under(mNfc, "ISO14443A", rb_cObject);
91
+ cNfcISO14443A = rb_define_class_under(mNfc, "ISO14443A", rb_cObject);
92
92
 
93
- rb_define_method(cNfcISO14443A, "szUidLen", szUidLen, 0);
94
- rb_define_method(cNfcISO14443A, "szAtsLen", szAtsLen, 0);
95
- rb_define_method(cNfcISO14443A, "btSak", btSak, 0);
93
+ rb_define_method(cNfcISO14443A, "szUidLen", szUidLen, 0);
94
+ rb_define_method(cNfcISO14443A, "szAtsLen", szAtsLen, 0);
95
+ rb_define_method(cNfcISO14443A, "btSak", btSak, 0);
96
96
 
97
- rb_define_private_method(cNfcISO14443A, "abtUid", abtUid, 0);
98
- rb_define_private_method(cNfcISO14443A, "abtAts", abtAts, 0);
99
- rb_define_private_method(cNfcISO14443A, "abtAtqa", abtAtqa, 0);
97
+ rb_define_private_method(cNfcISO14443A, "abtUid", abtUid, 0);
98
+ rb_define_private_method(cNfcISO14443A, "abtAts", abtAts, 0);
99
+ rb_define_private_method(cNfcISO14443A, "abtAtqa", abtAtqa, 0);
100
100
  }
101
+
102
+ /* vim: set noet sws=4 sw=4: */
data/lib/nfc.rb CHANGED
@@ -8,5 +8,5 @@ require 'nfc/felica'
8
8
  # NFC is a class for dealing with Near Field Communication systems. This
9
9
  # library will read RFID tags from an RFID reader.
10
10
  module NFC
11
- VERSION = '3.1.1'
11
+ VERSION = '3.1.2'
12
12
  end
@@ -6,14 +6,15 @@ module NFC
6
6
  DCO_INFINITE_LIST_PASSIVE = 0x20
7
7
 
8
8
  IM_ISO14443A_106 = Modulation.new Modulation::NMT_ISO14443A,
9
- Modulation::NBR_106
9
+ Modulation::NBR_106
10
10
 
11
11
  # Find a tag, blocks until there is a tag available
12
12
  def select
13
13
  select_passive_target NFC::Device::IM_ISO14443A_106
14
14
  end
15
+
15
16
  def poll poll_nr = 1, ms = 1
16
- poll_target NFC::Device::IM_ISO14443A_106, poll_nr,ms
17
+ poll_target NFC::Device::IM_ISO14443A_106, poll_nr,ms
17
18
  end
18
19
  end
19
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfc
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-21 00:00:00.000000000 Z
11
+ date: 2018-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -16,42 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.2'
19
+ version: '5.11'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.2'
26
+ version: '5.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '6'
34
37
  type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '4.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '6'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: hoe
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
51
  - - "~>"
46
52
  - !ruby/object:Gem::Version
47
- version: '3.8'
53
+ version: '3.17'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
- version: '3.8'
60
+ version: '3.17'
55
61
  description: |-
56
62
  NFC is a ruby wrapper for the Near Field Communication library. The Near
57
63
  Field Communication library works with many USB RFID readers, so this gem
@@ -68,7 +74,6 @@ extra_rdoc_files:
68
74
  - README.rdoc
69
75
  files:
70
76
  - ".autotest"
71
- - ".gemtest"
72
77
  - CHANGELOG.rdoc
73
78
  - Manifest.txt
74
79
  - README.rdoc
@@ -108,11 +113,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
113
  - !ruby/object:Gem::Version
109
114
  version: '0'
110
115
  requirements: []
111
- rubyforge_project: nfc
112
- rubygems_version: 2.2.2
116
+ rubyforge_project:
117
+ rubygems_version: 2.7.6
113
118
  signing_key:
114
119
  specification_version: 4
115
120
  summary: NFC is a ruby wrapper for the Near Field Communication library
116
- test_files:
117
- - test/test_context.rb
118
- - test/test_device.rb
121
+ test_files: []
data/.gemtest DELETED
File without changes