2013-01-26 09:21:41 +00:00
|
|
|
<h1>Door Logs</h1>
|
2012-08-25 06:28:00 +00:00
|
|
|
|
|
|
|
<%= link_to 'Download Door Logs', download_path %>
|
2012-09-17 04:01:21 +00:00
|
|
|
<a href="#" onclick="$('#log-guide').toggle();">Show Log Guide</a>
|
|
|
|
<div id="log-guide" style="display: none;">
|
|
|
|
<pre>
|
|
|
|
Guide to Card Number storage:
|
|
|
|
cardnum = (R+(r*32767)), convert to hex
|
|
|
|
|
|
|
|
Guide to log keys and data:
|
|
|
|
* A=alarm armed (# level)
|
|
|
|
* a=added user (# usernum)
|
|
|
|
* C=keypad command (# command)
|
|
|
|
* c=second half
|
|
|
|
* c=checked user (0=failed, #=found usernum)
|
|
|
|
* D=denied access (# card num)
|
|
|
|
* d=second half
|
|
|
|
* d=deleted user (# usernum)
|
|
|
|
* E=second (#=second)
|
|
|
|
* F=priv fail (0=wrong pw, 1=too many attempts, 2=not logged in)
|
|
|
|
* f=second half
|
|
|
|
* f=card fail (#=usermask)
|
|
|
|
* G=granted access (# card num)
|
|
|
|
* g=second half of card
|
|
|
|
* H=hour (#=hour)
|
|
|
|
* i=attempt to write to invalid eeprom address (# usernum)
|
|
|
|
* I=attempt to delete from invalid eeprom address (# usernum)
|
|
|
|
* L=locked (1=door1, 2=door2, 3=bedtime)
|
|
|
|
* M=minute (#=minute)
|
|
|
|
* m=alarm state (# level)
|
|
|
|
* R=read tag (# card num)
|
|
|
|
* r=second half of tag
|
|
|
|
* Q=superuser authed (#=superuser)
|
|
|
|
* S=auth (0=privileged mode enabled)
|
|
|
|
* s=alarm sensor (# zone)
|
|
|
|
* t=alarm trained (#=sensor value)
|
|
|
|
* T=alarm triggered (0)
|
|
|
|
* U=unlocked door (1=door1, 2=door2, # card num)
|
|
|
|
* u=second half of card
|
|
|
|
* Z=user db cleared (0)
|
|
|
|
* z=log cleared (0)
|
|
|
|
</pre>
|
|
|
|
</div>
|
2012-08-25 06:28:00 +00:00
|
|
|
<table>
|
|
|
|
<tr>
|
2012-09-16 05:52:17 +00:00
|
|
|
<th>Date</th>
|
2012-08-25 06:28:00 +00:00
|
|
|
<th>Key</th>
|
|
|
|
<th>Data</th>
|
|
|
|
<th></th>
|
|
|
|
<th></th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
|
2012-09-16 05:52:17 +00:00
|
|
|
<% @divided_tmp = nil %>
|
2012-08-25 06:28:00 +00:00
|
|
|
<% @door_logs.each do |door_log| %>
|
|
|
|
<tr>
|
2012-09-16 05:52:17 +00:00
|
|
|
<td><%= door_log.created_at %></td>
|
2012-08-25 06:28:00 +00:00
|
|
|
<td><%= door_log.key %></td>
|
|
|
|
<td><%= door_log.data %></td>
|
2012-09-16 04:41:11 +00:00
|
|
|
<%
|
2012-09-16 05:52:17 +00:00
|
|
|
if door_log.key == 'r' || door_log.key == 'd' ||door_log.key == 'g'
|
|
|
|
@divided_tmp = door_log.data.to_i
|
|
|
|
elsif (door_log.key == 'R' || door_log.key == 'D' || door_log.key == 'G') && !@divided_tmp.nil? %>
|
2012-09-16 04:41:11 +00:00
|
|
|
<td>
|
|
|
|
<%= case door_log.key
|
2012-09-16 05:52:17 +00:00
|
|
|
when 'R'
|
2012-09-16 04:41:11 +00:00
|
|
|
"Read"
|
2012-09-16 05:52:17 +00:00
|
|
|
when 'D'
|
2012-09-16 04:41:11 +00:00
|
|
|
"Denied"
|
2012-09-16 05:52:17 +00:00
|
|
|
when 'G'
|
2012-09-16 04:41:11 +00:00
|
|
|
"Granted"
|
|
|
|
end %>
|
2012-09-16 09:53:45 +00:00
|
|
|
<% @cardnum = (door_log.data.to_i+(@divided_tmp*32767)).to_s(16) %>
|
|
|
|
<%= "Card: "+@cardnum %>
|
2013-10-04 09:59:41 +00:00
|
|
|
<% @card = Card.find(:first,:conditions=>['lower(card_number) = ?', @cardnum.downcase]) %>
|
2012-12-16 03:37:44 +00:00
|
|
|
<%= "("+@card.user.name+")" unless @card.nil? %>
|
2012-09-16 04:41:11 +00:00
|
|
|
</td>
|
|
|
|
<% else
|
2012-09-16 05:52:17 +00:00
|
|
|
@divided_tmp = nil
|
2012-09-16 04:41:11 +00:00
|
|
|
end %>
|
2012-08-25 06:28:00 +00:00
|
|
|
</tr>
|
|
|
|
<% end %>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<br />
|
|
|
|
|