nfclib 0.0.128 → 0.0.136
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/nfclib.c +61 -167
- data/ext/nfclib.h +1 -6
- data/ext/rathalos.c +89 -0
- data/lib/nfc.rb +37 -12
- data/nfclib.gemspec +3 -2
- metadata +24 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dd7616b9d33ec7f2cbccda0a98f61f88bb4c2be
|
4
|
+
data.tar.gz: 9580f9caa21caaedb64fcdb4422f8be9b1b20e19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3f87ff89ad122a248a161379e10703e78d323215980681e6e755d54e30b5cadae9b4ecdf8b91df7e04de072cbf162e3fe9940a3512070b0e8de80db5c357831
|
7
|
+
data.tar.gz: 6b0c01c300fdaf803a46e1d49a48f6830785fd5b08cdf71bfd44d96c611627ad3dc60d5f8e7b8d015fdbef3cf9391faf7e76542b7dfd53ef9a044b0df1d4d94a
|
data/ext/nfclib.c
CHANGED
@@ -8,6 +8,9 @@
|
|
8
8
|
#include <ctype.h>
|
9
9
|
#include "nfclib.h"
|
10
10
|
|
11
|
+
#define DEBUG 0
|
12
|
+
#define COMMAND 0
|
13
|
+
#define DATA 1
|
11
14
|
void (**nfc_what_happens_if)(nfc_reader* x) = NULL;
|
12
15
|
int what_happens_len;
|
13
16
|
int what_happens_max_len;
|
@@ -57,7 +60,7 @@ void* nfc_reader_on_tag(nfc_reader* x,void (*y)(nfc_reader*)){
|
|
57
60
|
/* # }}}*/
|
58
61
|
|
59
62
|
/* nfc_reader_init # {{{ */
|
60
|
-
nfc_reader* nfc_reader_init(const char* name
|
63
|
+
nfc_reader* nfc_reader_init(const char* name) {
|
61
64
|
nfc_reader* xptr;
|
62
65
|
nfc_reader x;
|
63
66
|
int len = strlen(name);
|
@@ -91,10 +94,6 @@ nfc_reader* nfc_reader_init(const char* name, int mem_len) {
|
|
91
94
|
x.what_happens_len = 0;
|
92
95
|
x.what_happens_max_len = 0;
|
93
96
|
x.nfc_what_happens_if=NULL;
|
94
|
-
x.tag_mem_max_len = mem_len;
|
95
|
-
x.tag_mem_len = 0;
|
96
|
-
x.tag_mem_block_len = 4 ;
|
97
|
-
x.tag_mem = (unsigned char*) malloc(sizeof(unsigned char)*(mem_len*((x.tag_mem_block_len)+1))) ;
|
98
97
|
xptr = malloc(sizeof(nfc_reader)*1);
|
99
98
|
*xptr = x;
|
100
99
|
return xptr;
|
@@ -106,104 +105,88 @@ void* nfc_reader_do(void* y){
|
|
106
105
|
nfc_reader* x= y;
|
107
106
|
int write_pos = 0;
|
108
107
|
int i;
|
108
|
+
int command_modus = COMMAND;
|
109
109
|
int j=0;
|
110
110
|
int limit = -1;
|
111
111
|
int len = x->command_len;
|
112
112
|
int read_bytes;
|
113
113
|
int b_read =0;
|
114
|
-
int tries = 0;
|
115
|
-
int max_tries = 2;
|
116
114
|
unsigned char bcc = 0;
|
117
|
-
unsigned char ucmd [50];
|
118
115
|
fd_set set;
|
119
116
|
int written_bytes;
|
120
117
|
struct timeval timeout;
|
121
118
|
timeout.tv_sec=1;
|
122
119
|
timeout.tv_usec=0;
|
123
|
-
|
124
|
-
if(isalpha((x->command)[i])){
|
125
|
-
ucmd[j++] = (x->command)[i];
|
126
|
-
}
|
127
|
-
if(isdigit((x->command)[i])){
|
128
|
-
int temp = (x->command)[i++] - '0';
|
129
|
-
while(i<len && isdigit((x->command)[i])){
|
130
|
-
temp *= 10;
|
131
|
-
temp += (x->command)[i++] - '0';
|
132
|
-
}
|
133
|
-
if(temp>255)
|
134
|
-
byebye("Adresse zu groß");
|
135
|
-
ucmd[j++] = temp;
|
136
|
-
if(i==len)
|
137
|
-
break;
|
138
|
-
}
|
139
|
-
}
|
120
|
+
uint8_t* cmd_ptr = x->command;
|
140
121
|
/*CLEAR */
|
141
122
|
written_bytes = write(x->fh,"\0",1);
|
142
|
-
ucmd[j] = '\0';
|
143
123
|
x->write_puffer[write_pos++] = 2;
|
144
124
|
x->write_puffer[write_pos++] = 255;
|
145
|
-
x->write_puffer[write_pos++] =
|
146
|
-
for(i=0;i<
|
147
|
-
|
148
|
-
|
125
|
+
x->write_puffer[write_pos++] = len;
|
126
|
+
for(i=0;i<len;i++){
|
127
|
+
if(isspace(cmd_ptr[i])){
|
128
|
+
command_modus=DATA;
|
129
|
+
(x->write_puffer)[2]--;
|
130
|
+
continue;
|
131
|
+
}
|
132
|
+
if(command_modus==COMMAND)
|
133
|
+
x->write_puffer[write_pos++] = cmd_ptr[i];
|
134
|
+
else{
|
135
|
+
char temp[3];
|
136
|
+
temp[0]=cmd_ptr[i++];
|
137
|
+
temp[1]=cmd_ptr[i];
|
138
|
+
temp[2]='\0';
|
139
|
+
(x->write_puffer)[2]--;
|
140
|
+
long digi = strtol(temp,NULL,16);
|
141
|
+
x->write_puffer[write_pos++] = digi;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
for(i=1;i<((x->write_puffer)[2])+3;i++)
|
149
145
|
bcc ^= x->write_puffer[i];
|
150
146
|
x->write_puffer[write_pos++] = bcc;
|
151
147
|
x->write_puffer[write_pos++] = 3;
|
152
|
-
|
148
|
+
#if DEBUG
|
149
|
+
for(i=0;i<write_pos;i++)
|
153
150
|
fprintf(stderr,"written: %d\n",(x->write_puffer)[i]);
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
for(i=0;i<read_bytes;i++,j++)
|
171
|
-
(x->reddit)[j] = (x->read_puffer)[i];
|
172
|
-
|
173
|
-
if(j>2 && limit==-1) limit=(x->reddit)[2]+5;
|
174
|
-
b_read+=read_bytes;
|
175
|
-
}
|
176
|
-
if(b_read==limit) {
|
177
|
-
x->reddit_len = b_read;
|
178
|
-
tries=max_tries;
|
179
|
-
break;
|
180
|
-
}
|
181
|
-
if(limit!=-1 && b_read>limit){
|
182
|
-
/*
|
183
|
-
fprintf(stdout,"Error. Read too many bytes\n");
|
184
|
-
*/
|
185
|
-
x->reddit_len = 0;
|
186
|
-
break;
|
187
|
-
}
|
188
|
-
}
|
189
|
-
else{
|
190
|
-
/*
|
191
|
-
int ii= 0;
|
192
|
-
fprintf(stderr,"Read Bytes: %d\n",b_read);
|
193
|
-
fprintf(stderr,"Expected: %d\n",limit);
|
151
|
+
#endif
|
152
|
+
written_bytes = write(x->fh,x->write_puffer,write_pos);
|
153
|
+
if(written_bytes != write_pos){
|
154
|
+
fprintf(stderr,"Error while writing\n");
|
155
|
+
return y;
|
156
|
+
}
|
157
|
+
j=0;
|
158
|
+
while(1){
|
159
|
+
/* INITIALIZE FD READ SET */
|
160
|
+
FD_ZERO (&set);
|
161
|
+
FD_SET (x->fh,&set);
|
162
|
+
|
163
|
+
if(select(FD_SETSIZE,&set,NULL,NULL,&timeout)>0){
|
164
|
+
if((read_bytes=read(x->fh,x->read_puffer,37))>0){
|
165
|
+
for(i=0;i<read_bytes;i++,j++)
|
166
|
+
(x->reddit)[j] = (x->read_puffer)[i];
|
194
167
|
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
168
|
+
if(j>2 && limit==-1) limit=(x->reddit)[2]+5;
|
169
|
+
b_read+=read_bytes;
|
170
|
+
}
|
171
|
+
if(b_read==limit) {
|
172
|
+
x->reddit_len = b_read;
|
173
|
+
break;
|
174
|
+
}
|
175
|
+
if(limit!=-1 && b_read>limit){
|
176
|
+
/*
|
177
|
+
fprintf(stdout,"Error. Read too many bytes\n");
|
178
|
+
*/
|
199
179
|
x->reddit_len = 0;
|
200
180
|
break;
|
201
181
|
}
|
202
182
|
}
|
203
|
-
|
204
|
-
|
205
|
-
|
183
|
+
else{
|
184
|
+
x->reddit_len = 0;
|
185
|
+
break;
|
186
|
+
}
|
206
187
|
}
|
188
|
+
if(nfc_what_happens_if!=NULL)
|
189
|
+
nfc_what_happens_if[(0)](x);
|
207
190
|
return y; /*Bessere Returns; */
|
208
191
|
}
|
209
192
|
/* # }}}*/
|
@@ -288,93 +271,6 @@ void* nfc_reader_read(void *y){
|
|
288
271
|
}
|
289
272
|
}
|
290
273
|
/* # }}}*/
|
291
|
-
/* # {{{ nfc_reader_read_mem */
|
292
|
-
void nfc_reader_read_mem(nfc_reader* x){
|
293
|
-
|
294
|
-
int i,count;
|
295
|
-
unsigned char* tag_mems= x->tag_mem;
|
296
|
-
char str[10];
|
297
|
-
x->tag_mem[0] ='\0';
|
298
|
-
nfc_set_cmd(x,"s");
|
299
|
-
nfc_reader_do(x);
|
300
|
-
nfc_reader_do(x);
|
301
|
-
for(i=4;i<8;i++){
|
302
|
-
/* for(i=4;i<(x->tag_mem_max_len);i++){ */
|
303
|
-
x->reddit_len = 0;
|
304
|
-
while((x->reddit_len)==0){
|
305
|
-
sprintf(str,"r%d",i);
|
306
|
-
nfc_set_cmd(x,str);
|
307
|
-
nfc_reader_do(x);
|
308
|
-
/*
|
309
|
-
fprintf(stdout,"READ_MEM: %d\n",x->reddit_len);
|
310
|
-
*/
|
311
|
-
if((x->reddit_len)==(5+(x->tag_mem_block_len))){
|
312
|
-
int j;
|
313
|
-
int hex;
|
314
|
-
char test[9];
|
315
|
-
char temp[3];
|
316
|
-
char* ptemp = &(temp[0]);
|
317
|
-
char* p_test= &(test[0]);
|
318
|
-
if((x->reddit)[6] == 0) break;
|
319
|
-
for(j=3;j<((x->reddit_len)-2);j++){
|
320
|
-
/* fprintf(stdout,"%02x ",(x->reddit)[j]);
|
321
|
-
*/
|
322
|
-
sprintf(ptemp,"%02x",(x->reddit)[j]);
|
323
|
-
if(j==3){
|
324
|
-
strcpy(p_test,ptemp);
|
325
|
-
if(i==4) strcpy((x->tag_mem),ptemp);
|
326
|
-
else strcat(tag_mems,ptemp);
|
327
|
-
tag_mems+=4;
|
328
|
-
*tag_mems='\0';
|
329
|
-
tag_mems++;
|
330
|
-
}
|
331
|
-
else{
|
332
|
-
strcat(p_test,ptemp);
|
333
|
-
strcat(tag_mems,ptemp);
|
334
|
-
tag_mems+=4;
|
335
|
-
*tag_mems='\0';
|
336
|
-
tag_mems++;
|
337
|
-
}
|
338
|
-
}
|
339
|
-
/*
|
340
|
-
hex = (int)strtol(p_test,NULL,16);
|
341
|
-
fprintf(stdout,"%s\n",p_test);
|
342
|
-
fprintf(stdout,"%d\n",hex);
|
343
|
-
fprintf(stdout,"\n");
|
344
|
-
*/
|
345
|
-
}
|
346
|
-
/*
|
347
|
-
if((x->nfc_what_happens_if)!=NULL){
|
348
|
-
for(count=0;count<(x->what_happens_len);count++)
|
349
|
-
(x->nfc_what_happens_if)[(count)](x);
|
350
|
-
}
|
351
|
-
*/
|
352
|
-
if((x->reddit_len)==0 || (x->reddit_len)==6){
|
353
|
-
nfc_set_cmd(x,"s");
|
354
|
-
nfc_reader_do(x);
|
355
|
-
x->reddit_len = 0;
|
356
|
-
}
|
357
|
-
}
|
358
|
-
if((x->reddit)[6] == 0) break;
|
359
|
-
|
360
|
-
}
|
361
|
-
|
362
|
-
for(i=0;i<(x->tag_mem_max_len);i+=((x->tag_mem_block_len)+1)){
|
363
|
-
if((x->tag_mem)[i]=='\0') break;
|
364
|
-
/*
|
365
|
-
else {
|
366
|
-
fprintf(stdout,"String: %s",(x->tag_mem));
|
367
|
-
fprintf(stdout,"HUCH: %c \n",(x->tag_mem)[5]);
|
368
|
-
fprintf(stdout,"HUCH: %c \n",(x->tag_mem)[10]);
|
369
|
-
fprintf(stdout,"\n");
|
370
|
-
}
|
371
|
-
*/
|
372
|
-
}
|
373
|
-
sleep(1);
|
374
|
-
nfc_set_cmd(x,"dp");
|
375
|
-
nfc_reader_do(x);
|
376
|
-
}
|
377
|
-
/* # }}} */
|
378
274
|
|
379
275
|
/* nfc_reader_1_read # {{{ */
|
380
276
|
void* nfc_reader_1_read(void *y){
|
@@ -442,8 +338,6 @@ int nfc_reader_destroy(nfc_reader* x){
|
|
442
338
|
free(x->nfc_port);
|
443
339
|
if((x->nfc_what_happens_if) != NULL)
|
444
340
|
free((x->nfc_what_happens_if));
|
445
|
-
if((x->tag_mem)!=NULL)
|
446
|
-
free(x->tag_mem);
|
447
341
|
free(x);
|
448
342
|
}
|
449
343
|
return 0;
|
data/ext/nfclib.h
CHANGED
@@ -14,10 +14,6 @@ typedef struct nfc_struct{
|
|
14
14
|
uint8_t write_puffer[100];
|
15
15
|
uint8_t* reddit;
|
16
16
|
int reddit_len;
|
17
|
-
unsigned char* tag_mem;
|
18
|
-
int tag_mem_max_len;
|
19
|
-
int tag_mem_len;
|
20
|
-
int tag_mem_block_len;
|
21
17
|
uint8_t command[100];
|
22
18
|
int command_len;
|
23
19
|
int what_happens_len;
|
@@ -28,7 +24,7 @@ typedef struct nfc_struct{
|
|
28
24
|
|
29
25
|
void* nfc_reader_on_tag(nfc_reader* x,void (*y)(nfc_reader*));
|
30
26
|
|
31
|
-
nfc_reader* nfc_reader_init(const char* name
|
27
|
+
nfc_reader* nfc_reader_init(const char* name);
|
32
28
|
int nfc_reader_stop_poll(nfc_reader*);
|
33
29
|
int nfc_reader_poll( nfc_reader*);
|
34
30
|
int nfc_reader_destroy(nfc_reader* x);
|
@@ -39,5 +35,4 @@ void set_cmd(nfc_reader *x,char * y);
|
|
39
35
|
int ustrlen(unsigned char* str);
|
40
36
|
int nfc_set_cmd(nfc_reader* x,char* str);
|
41
37
|
void* nfc_reader_1_read(void *y);
|
42
|
-
void nfc_reader_read_mem(nfc_reader* x);
|
43
38
|
#endif /* NFCLIB_H */
|
data/ext/rathalos.c
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
#include "nfclib.h"
|
2
|
+
#include <stdio.h>
|
3
|
+
#include <string.h>
|
4
|
+
#include <unistd.h>
|
5
|
+
|
6
|
+
void my_nfc_func1(nfc_reader* x) {
|
7
|
+
int i;
|
8
|
+
fprintf(stdout,"Hex...\n");
|
9
|
+
for(i=0;i<x->reddit_len;i++)
|
10
|
+
fprintf(stdout,"%x\t",(x->reddit)[i]);
|
11
|
+
fprintf(stdout,"\n");
|
12
|
+
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
void my_nfc_func2(nfc_reader* x) {
|
16
|
+
int i;
|
17
|
+
fprintf(stdout,"Character...\n");
|
18
|
+
for(i=0;i<x->reddit_len;i++)
|
19
|
+
fprintf(stdout,"%c\t",(x->reddit)[i]);
|
20
|
+
fprintf(stdout,"\n");
|
21
|
+
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
void my_nfc_func3(nfc_reader* x) {
|
25
|
+
int i;
|
26
|
+
fprintf(stdout,"Dezimal Zahlen...\n");
|
27
|
+
for(i=0;i<x->reddit_len;i++)
|
28
|
+
fprintf(stdout,"%d\t",(x->reddit)[i]);
|
29
|
+
fprintf(stdout,"\n");
|
30
|
+
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
void my_nfc_func4(nfc_reader* x) {
|
34
|
+
fprintf(stdout,"ALLE_DURCH\n");
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
|
38
|
+
void* cancel_thread(void* y){
|
39
|
+
nfc_reader *x = y;
|
40
|
+
int ret;
|
41
|
+
sleep(30);
|
42
|
+
ret= nfc_reader_stop_poll(x);
|
43
|
+
if(!ret)
|
44
|
+
fprintf(stdout,"Killed Poll.\n");
|
45
|
+
else
|
46
|
+
fprintf(stdout,"Couldn't kill Poll\n");
|
47
|
+
return NULL;
|
48
|
+
}
|
49
|
+
|
50
|
+
int main(int argc,char *argv[]) {
|
51
|
+
|
52
|
+
nfc_reader* x;
|
53
|
+
int rc,i,j;
|
54
|
+
if(argc < 2)
|
55
|
+
byebye("Please set a command as first parameter (-n if you dont want to send a command)\nList of useful commands:\nv....gets Version\nvs Data.... Sets Version (255 255 for Firmware Version)\nb.... Gets Serialnumber\nre Adress.... Read EEPROM (Look at manual for specific addresses and values)\nwe Adress.... Write EEPROM\ndp.... Lower Polling Mode\ndd.... Lower Detection Mode\nx.... Reset\n-n...Do nothing\n");
|
56
|
+
|
57
|
+
x = nfc_reader_init("/dev/ttyUSB0");
|
58
|
+
|
59
|
+
nfc_set_cmd(x,argv[1]);
|
60
|
+
if(strcmp(argv[1],"-n"))
|
61
|
+
nfc_reader_do(x);
|
62
|
+
fprintf(stdout,"Und was kam zurueck: \n");
|
63
|
+
for(i=0;i<x->reddit_len;i++)
|
64
|
+
fprintf(stdout,"%x\t",(x->reddit)[i]);
|
65
|
+
fprintf(stdout,"\n");
|
66
|
+
for(i=0;i<x->reddit_len;i++)
|
67
|
+
fprintf(stdout,"%c\t",(x->reddit)[i]);
|
68
|
+
fprintf(stdout,"\n");
|
69
|
+
for(i=0;i<x->reddit_len;i++)
|
70
|
+
fprintf(stdout,"%d\t",(x->reddit)[i]);
|
71
|
+
fprintf(stdout,"\n");
|
72
|
+
|
73
|
+
nfc_reader_on_tag(x,&my_nfc_func1);
|
74
|
+
nfc_reader_on_tag(x,&my_nfc_func2);
|
75
|
+
nfc_reader_on_tag(x,&my_nfc_func3);
|
76
|
+
nfc_reader_on_tag(x,&my_nfc_func4);
|
77
|
+
/*
|
78
|
+
|
79
|
+
|
80
|
+
rc = pthread_create(&thread2,NULL,&cancel_thread,x);
|
81
|
+
if(rc!=0)
|
82
|
+
byebye("Could not create thread\n");
|
83
|
+
|
84
|
+
nfc_reader_poll(x);
|
85
|
+
pthread_join(thread2,NULL);
|
86
|
+
*/
|
87
|
+
nfc_reader_destroy(x);
|
88
|
+
return 0;
|
89
|
+
}
|
data/lib/nfc.rb
CHANGED
@@ -6,7 +6,7 @@ module NFC
|
|
6
6
|
ffi_lib ::File.dirname(__FILE__) + '/nfclib.so'
|
7
7
|
callback :on_tag_callback, [:pointer], :void
|
8
8
|
attach_function :nfc_reader_on_tag, [:pointer,:on_tag_callback], :pointer
|
9
|
-
attach_function :nfc_reader_init, [:string
|
9
|
+
attach_function :nfc_reader_init, [:string], :pointer
|
10
10
|
attach_function :nfc_reader_poll, [:pointer], :int
|
11
11
|
attach_function :nfc_reader_stop_poll, [:pointer], :int
|
12
12
|
attach_function :nfc_reader_destroy, [:pointer], :int
|
@@ -43,28 +43,48 @@ module NFC
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def hex
|
46
|
-
|
46
|
+
# @res.map{|e| e.to_s(16) }
|
47
|
+
@res.map{|e| "%02x" % e }.join
|
47
48
|
end
|
48
49
|
def dec
|
49
50
|
@res
|
50
51
|
end
|
52
|
+
def zero #{{{
|
53
|
+
checker = true
|
54
|
+
@res.each do |x|
|
55
|
+
if x!=0
|
56
|
+
checker = false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
checker
|
60
|
+
end #}}}
|
61
|
+
|
62
|
+
def high #{{{
|
63
|
+
checker = true
|
64
|
+
@res.each do |x|
|
65
|
+
if x!=255
|
66
|
+
checker = false
|
67
|
+
end
|
68
|
+
end
|
69
|
+
checker
|
70
|
+
end #}}}
|
71
|
+
|
72
|
+
@res
|
51
73
|
end #}}}
|
52
74
|
|
53
75
|
class Reader
|
54
76
|
attr_reader :reader
|
55
|
-
|
56
|
-
def initialize(tty = "/dev/ttyUSB0"
|
57
|
-
@reader = NFC.nfc_reader_init(tty
|
77
|
+
attr_reader :serialnr
|
78
|
+
def initialize(tty = "/dev/ttyUSB0") #{{{
|
79
|
+
@reader = NFC.nfc_reader_init(tty)
|
58
80
|
@thread = nil
|
59
81
|
@serialnr = nil
|
60
82
|
command('x')
|
61
83
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
p @serialnr
|
67
|
-
p '-' * 24
|
84
|
+
# begin
|
85
|
+
# @serialnr = command('b')
|
86
|
+
# end while @serialnr == nil
|
87
|
+
# @serialnr = @serialnr.unpack("C*").map{|e| "%02x" % e}.join
|
68
88
|
Signal::trap("INT") do
|
69
89
|
puts 'stopping...'
|
70
90
|
stop_poll
|
@@ -76,7 +96,12 @@ module NFC
|
|
76
96
|
obj = Struct.new(@reader)
|
77
97
|
NFC.nfc_set_cmd(@reader,cmd)
|
78
98
|
NFC.nfc_reader_do(@reader)
|
79
|
-
obj[:reddit].read_string(obj[:reddit_len])[3..-3]
|
99
|
+
if (obj[:reddit].read_string(obj[:reddit_len])[3..-3]== nil)
|
100
|
+
temp = nil
|
101
|
+
else
|
102
|
+
temp=Result.new(obj[:reddit].read_string(obj[:reddit_len])[3..-3])
|
103
|
+
end
|
104
|
+
temp
|
80
105
|
end #}}}
|
81
106
|
|
82
107
|
def command_print(cmd) #{{{
|
data/nfclib.gemspec
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'nfclib'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.136'
|
4
4
|
s.date = '2014-08-05'
|
5
5
|
s.summary ="NFC-Reader Library."
|
6
6
|
s.description ="Executes command and gets results in c, everthing else ruby-yo"
|
7
7
|
s.authors = ["Florian Stertz"]
|
8
8
|
s.email = ['florian.stertz@gmail.com']
|
9
|
-
s.files = Dir['ext/extconf.rb'] + Dir['lib/nfc.rb'] + ['nfclib.gemspec','README.md'] + Dir['ext/nfclib.c'] + Dir['ext/nfclib.h']
|
9
|
+
s.files = Dir['ext/extconf.rb'] + Dir['lib/nfc.rb'] + ['nfclib.gemspec','README.md'] + Dir['ext/nfclib.c'] + Dir['ext/nfclib.h'] + Dir['ext/rathalos.c']
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
11
|
s.require_paths = ['lib']
|
12
12
|
s.extensions = Dir['ext/extconf.rb']
|
13
13
|
s.homepage = 'https://github.com/Triarier/lagiacrus'
|
14
|
+
s.add_runtime_dependency 'ffi', '>=1.9.10', '~>1.9'
|
14
15
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nfclib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.136
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Stertz
|
@@ -9,7 +9,27 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2014-08-05 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ffi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.9.10
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.9'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.9.10
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.9'
|
13
33
|
description: Executes command and gets results in c, everthing else ruby-yo
|
14
34
|
email:
|
15
35
|
- florian.stertz@gmail.com
|
@@ -22,6 +42,7 @@ files:
|
|
22
42
|
- ext/extconf.rb
|
23
43
|
- ext/nfclib.c
|
24
44
|
- ext/nfclib.h
|
45
|
+
- ext/rathalos.c
|
25
46
|
- lib/nfc.rb
|
26
47
|
- nfclib.gemspec
|
27
48
|
homepage: https://github.com/Triarier/lagiacrus
|
@@ -43,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
64
|
version: '0'
|
44
65
|
requirements: []
|
45
66
|
rubyforge_project:
|
46
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.5.1
|
47
68
|
signing_key:
|
48
69
|
specification_version: 4
|
49
70
|
summary: NFC-Reader Library.
|