6 |
.status { |
.status { |
7 |
background: #ff8; |
background: #ff8; |
8 |
} |
} |
9 |
|
|
10 |
|
.da { |
11 |
|
background: #fcc; |
12 |
|
} |
13 |
|
|
14 |
|
.d7 { |
15 |
|
background: #cfc; |
16 |
|
} |
17 |
|
|
18 |
|
label[for=pull-reader] { |
19 |
|
position: absolute; |
20 |
|
top: 1em; |
21 |
|
right: 1em; |
22 |
|
background: #eee; |
23 |
|
} |
24 |
|
|
25 |
</style> |
</style> |
26 |
<script type="text/javascript"> |
<script type="text/javascript"> |
27 |
|
|
28 |
|
function got_visible_tags(data,textStatus) { |
29 |
|
var html = 'No tags in range'; |
30 |
|
if ( data.tags ) { |
31 |
|
html = '<ul class="tags">'; |
32 |
|
$.each(data.tags, function(i,tag) { |
33 |
|
console.debug( i, tag ); |
34 |
|
html += '<li class=' + tag.security + '><tt>' + tag.sid + ' ' + tag.content + '</tt>'; |
35 |
|
}); |
36 |
|
html += '</ul>'; |
37 |
|
} |
38 |
|
html = '<div class=status>' |
39 |
|
+ textStatus |
40 |
|
+ '##########'.substr(0,data.time % 10) |
41 |
|
+ '</div>' |
42 |
|
+ html |
43 |
|
; |
44 |
|
$('#tags').html( html ); |
45 |
|
window.setTimeout(function(){ |
46 |
|
scan_tags(); |
47 |
|
},200); // re-scan every 200ms |
48 |
|
}; |
49 |
|
|
50 |
function scan_tags() { |
function scan_tags() { |
51 |
console.info('scan_tags'); |
console.info('scan_tags'); |
52 |
$.getJSON("http://localhost:9000/scan?callback=?", |
if ( $('input#pull-reader').attr('checked') ) |
53 |
function(data,textStatus) { |
$.getJSON("http://localhost:9000/scan?callback=?", got_visible_tags); |
|
var html = 'No tags in range'; |
|
|
if ( data.tags ) { |
|
|
html = '<ul class="tags">'; |
|
|
$.each(data.tags, function(i,tag) { |
|
|
console.debug( i, tag ); |
|
|
html += '<li>' + tag.sid + ' <tt>' + tag.content + '</tt>'; |
|
|
}); |
|
|
html += '</ul>'; |
|
|
} |
|
|
html = '<div class=status>' |
|
|
+ textStatus |
|
|
+ '##########'.substr(0,data.time % 10) |
|
|
+ '</div>' |
|
|
+ html |
|
|
; |
|
|
$('#tags').html( html ); |
|
|
window.setTimeout(function(){ |
|
|
scan_tags(); |
|
|
},200); // re-scan every 200ms |
|
|
}); |
|
54 |
} |
} |
55 |
|
|
56 |
$(document).ready(function() { |
$(document).ready(function() { |
57 |
|
$('input#pull-reader').click( function() { |
58 |
|
scan_tags(); |
59 |
|
}); |
60 |
|
$('input#pull-reader').attr('checked', true); // force check on load |
61 |
scan_tags(); |
scan_tags(); |
62 |
}); |
}); |
63 |
</script> |
</script> |
66 |
|
|
67 |
<h1>RFID tags in range</h1> |
<h1>RFID tags in range</h1> |
68 |
|
|
69 |
|
<label for=pull-reader> |
70 |
|
<input id=pull-reader type=checkbox checked=1> |
71 |
|
active |
72 |
|
</label> |
73 |
|
|
74 |
<div id="tags"> |
<div id="tags"> |
75 |
RFID reader not found or driver program not started. |
RFID reader not found or driver program not started. |
76 |
</div> |
</div> |