1 |
<html> |
2 |
<head> |
3 |
<title>3M RFID</title> |
4 |
<script type="text/javascript" src="jquery-1.3.2.min.js"></script> |
5 |
<style type="text/css"> |
6 |
.status { |
7 |
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> |
26 |
<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() { |
51 |
console.info('scan_tags'); |
52 |
if ( $('input#pull-reader').attr('checked') ) |
53 |
$.getJSON("http://localhost:9000/scan?callback=?", got_visible_tags); |
54 |
} |
55 |
|
56 |
$(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(); |
62 |
}); |
63 |
</script> |
64 |
</head> |
65 |
<body> |
66 |
|
67 |
<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"> |
75 |
RFID reader not found or driver program not started. |
76 |
</div> |
77 |
|
78 |
</body> |
79 |
</html> |