added raw finger template (dump) for test_machine
TODO: upload dumped finger
This commit is contained in:
parent
20b1768ca8
commit
cd2ae44b92
12
README.md
12
README.md
@ -188,9 +188,11 @@ for attendance in conn.live_capture():
|
||||
pass
|
||||
else:
|
||||
print (attendance) # Attendance object
|
||||
#
|
||||
#if you need to break gracefully just set
|
||||
# conn.end_live_capture = True
|
||||
# on interactive mode,
|
||||
#
|
||||
# On interactive mode,
|
||||
# use Ctrl+C to break gracefully
|
||||
# this way it restores timeout
|
||||
# and disables live capture
|
||||
@ -214,9 +216,11 @@ optional arguments:
|
||||
Default [10] seconds (0: disable timeout)
|
||||
-P PASSWORD, --password PASSWORD
|
||||
Device code/password
|
||||
-b, --basic get Basic Information only. (no bulk read, ie: users)
|
||||
-f, --force-udp Force UDP communication
|
||||
-v, --verbose Print debug information
|
||||
-t, --templates Get templates / fingers
|
||||
-t, --templates Get templates / fingers (compare bulk and single read)
|
||||
-tr, --templates-raw Get raw templates (dump templates)
|
||||
-r, --records Get attendance records
|
||||
-u, --updatetime Update Date/Time
|
||||
-l, --live-capture Live Event Capture
|
||||
@ -307,7 +311,7 @@ If you have another version tested and it worked, please inform me to update thi
|
||||
# Todo
|
||||
|
||||
* Create better documentation
|
||||
* Finger template downloader & uploader
|
||||
* ~~Finger template downloader & uploader~~
|
||||
* HTTP Rest api
|
||||
* Create real time api (if possible)
|
||||
* ~~Create real time api (if possible)~~
|
||||
* and much more ...
|
||||
|
@ -5,6 +5,7 @@ import traceback
|
||||
import argparse
|
||||
import time
|
||||
import datetime
|
||||
import codecs
|
||||
from builtins import input
|
||||
|
||||
sys.path.append("zk")
|
||||
@ -31,13 +32,15 @@ parser.add_argument('-T', '--timeout', type=int,
|
||||
parser.add_argument('-P', '--password', type=int,
|
||||
help='Device code/password', default=0)
|
||||
parser.add_argument('-b', '--basic', action="store_true",
|
||||
help='display Basic Information (no buld read, ie: users)')
|
||||
help='get Basic Information only. (no bulk read, ie: users)')
|
||||
parser.add_argument('-f', '--force-udp', action="store_true",
|
||||
help='Force UDP communication')
|
||||
parser.add_argument('-v', '--verbose', action="store_true",
|
||||
help='Print debug information')
|
||||
parser.add_argument('-t', '--templates', action="store_true",
|
||||
help='Get templates / fingers')
|
||||
help='Get templates / fingers (compare bulk and single read)')
|
||||
parser.add_argument('-tr', '--templates-raw', action="store_true",
|
||||
help='Get raw templates (dump templates)')
|
||||
parser.add_argument('-r', '--records', action="store_true",
|
||||
help='Get attendance records')
|
||||
parser.add_argument('-u', '--updatetime', action="store_true",
|
||||
@ -178,23 +181,34 @@ try:
|
||||
conn.refresh_data()
|
||||
#print ("Voice Test ...")
|
||||
#conn.test_voice(10)
|
||||
if args.templates:
|
||||
if args.templates or args.templates_raw:
|
||||
print ("Read Templates...")
|
||||
inicio = time.time()
|
||||
templates = conn.get_templates()
|
||||
final = time.time()
|
||||
print (' took {:.3f}[s]'.format(final - inicio))
|
||||
if args.templates:
|
||||
print ('now checking individually...')
|
||||
i = 0
|
||||
for tem in templates:
|
||||
i += 1
|
||||
tem2 =conn.get_user_template(tem.uid,tem.fid)
|
||||
if tem2 is None:
|
||||
print ("bulk! %s" % tem)
|
||||
print ("%i: bulk! %s" % (i, tem))
|
||||
elif tem == tem2: # compare with alternative method
|
||||
print ("OK! %s" % tem)
|
||||
print ("%i: OK! %s" % (i, tem))
|
||||
else:
|
||||
print ("dif-1 %s" % tem)
|
||||
print ("dif-2 %s" % tem2)
|
||||
print ("%i: dif-1 %s" % (i, tem))
|
||||
print ("%i: dif-2 %s" % (i, tem2))
|
||||
print (' took {:.3f}[s]'.format(final - inicio))
|
||||
else:
|
||||
print ('template dump')
|
||||
i = 0
|
||||
for tem in templates:
|
||||
i += 1
|
||||
print ("%i: %s" % (i, tem.dump()))
|
||||
print (' took {:.3f}[s]'.format(final - inicio))
|
||||
|
||||
if args.records:
|
||||
print ("Read Records...")
|
||||
inicio = time.time()
|
||||
@ -203,7 +217,7 @@ try:
|
||||
print (' took {:.3f}[s]'.format(final - inicio))
|
||||
i = 0
|
||||
for att in attendance:
|
||||
i +=1
|
||||
i += 1
|
||||
print ("ATT {:>6}: uid:{:>3}, user_id:{:>8} t: {}, s:{} p:{}".format(i, att.uid, att.user_id, att.timestamp, att.status, att.punch))
|
||||
print (' took {:.3f}[s]'.format(final - inicio))
|
||||
print ('')
|
||||
|
@ -25,3 +25,6 @@ class Finger(object):
|
||||
|
||||
def __repr__(self):
|
||||
return "<Finger> [uid:{:>3}, fid:{}, size:{:>4} v:{} t:{}]".format(self.uid, self.fid, self.size, self.valid, self.mark)
|
||||
|
||||
def dump(self):
|
||||
return "<Finger> [uid:{:>3}, fid:{}, size:{:>4} v:{} t:{}]".format(self.uid, self.fid, self.size, self.valid, codecs.encode(self.template, 'hex'))
|
||||
|
Loading…
Reference in New Issue
Block a user