Merge pull request #12 from shubhamoy/master

Enroll User Fingerprint
This commit is contained in:
Fanani M. Ihsan 2018-03-07 16:06:24 +07:00 committed by GitHub
commit 55e15e54d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 4 deletions

View File

@ -84,6 +84,11 @@ users = conn.get_users()
conn.delete_user(uid=1)
```
* Remote Fingerprint Enrollment
```
zk.enroll_user('23')
```
* Attendance Record
```
# Get attendances (will return list of Attendance object)

21
test_user_enrollment.py Normal file
View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
import sys
from zk import ZK, const
sys.path.append("zk")
conn = None
zk = ZK('192.168.1.201', port=4370, timeout=5)
try:
conn = zk.connect()
conn.disable_device()
zk.set_user(26, 'Shubhamoy Chakrabarty', 0, '', '1', '26')
zk.enroll_user('26')
conn.enable_device()
except Exception, e:
print "Process terminate : {}".format(e)
finally:
if conn:
conn.disconnect()

View File

@ -417,17 +417,21 @@ class ZK(object):
cmd_response = self.__send_command(command=command)
print cmd_response
def enroll_user(self, uid):
def enroll_user(self, uid=''):
'''
start enroll user
'''
command = const.CMD_STARTENROLL
uid = chr(uid % 256) + chr(uid >> 8)
command_string = pack('2s', uid)
cmd_response = self.__send_command(command=command, command_string=command_string)
checksum = 0
session_id = self.__sesion_id
reply_id = self.__reply_id
response_size = 8
cmd_response = self.__send_command(command, command_string, checksum, session_id, reply_id, response_size)
print cmd_response
def clear_data(self):
'''
clear all data (include: user, attendance report, finger database )