update documentation

This commit is contained in:
Fanani M. Ihsan 2016-05-27 08:54:17 +07:00
parent af9e590ccb
commit aca1e14b4e

View File

@ -138,6 +138,9 @@ class ZK(object):
return cmd_response return cmd_response
def get_firmware_version(self): def get_firmware_version(self):
'''
get firmware version name
'''
command = const.CMD_GET_VERSION command = const.CMD_GET_VERSION
cmd_response = self.__send_command(command, response_size=1024) cmd_response = self.__send_command(command, response_size=1024)
if cmd_response.get('status'): if cmd_response.get('status'):
@ -149,7 +152,7 @@ class ZK(object):
def restart(self): def restart(self):
''' '''
shutdown device restart connected device
''' '''
command = const.CMD_RESTART command = const.CMD_RESTART
@ -163,7 +166,7 @@ class ZK(object):
def power_off(self): def power_off(self):
''' '''
shutdown device shutdown connected device
''' '''
command = const.CMD_POWEROFF command = const.CMD_POWEROFF
@ -176,6 +179,9 @@ class ZK(object):
return cmd_response return cmd_response
def disable_device(self): def disable_device(self):
'''
disable (lock) connected device, make sure no activity when process run
'''
command = const.CMD_DISABLEDEVICE command = const.CMD_DISABLEDEVICE
cmd_response = self.__send_command(command) cmd_response = self.__send_command(command)
cmd_response['data'] = '' cmd_response['data'] = ''
@ -186,6 +192,9 @@ class ZK(object):
return cmd_response return cmd_response
def enable_device(self): def enable_device(self):
'''
re-enable connected device
'''
command = const.CMD_ENABLEDEVICE command = const.CMD_ENABLEDEVICE
cmd_response = self.__send_command(command) cmd_response = self.__send_command(command)
cmd_response['data'] = '' cmd_response['data'] = ''
@ -196,6 +205,9 @@ class ZK(object):
return cmd_response return cmd_response
def test_voice(self): def test_voice(self):
'''
play test voice
'''
command = const.CMD_TESTVOICE command = const.CMD_TESTVOICE
cmd_response = self.__send_command(command) cmd_response = self.__send_command(command)
cmd_response['data'] = '' cmd_response['data'] = ''
@ -206,6 +218,9 @@ class ZK(object):
return cmd_response return cmd_response
def set_user(self, uid, name, privilege, password='', group_id='', user_id=''): def set_user(self, uid, name, privilege, password='', group_id='', user_id=''):
'''
create or update user by uid
'''
command = const.CMD_USER_WRQ command = const.CMD_USER_WRQ
uid = chr(uid % 256) + chr(uid >> 8) uid = chr(uid % 256) + chr(uid >> 8)
@ -235,6 +250,9 @@ class ZK(object):
return 0 return 0
def get_users(self): def get_users(self):
'''
get all users
'''
command = const.CMD_USERTEMP_RRQ command = const.CMD_USERTEMP_RRQ
cmd_response = self.__send_command(command=command, response_size=1024) cmd_response = self.__send_command(command=command, response_size=1024)
if cmd_response: if cmd_response:
@ -292,17 +310,26 @@ class ZK(object):
return cmd_response return cmd_response
def cancel_capture(self): def cancel_capture(self):
'''
cancel capturing finger
'''
command = const.CMD_CANCELCAPTURE command = const.CMD_CANCELCAPTURE
cmd_response = self.__send_command(command=command) cmd_response = self.__send_command(command=command)
print cmd_response print cmd_response
def verify_user(self): def verify_user(self):
'''
verify finger
'''
command = const.CMD_STARTVERIFY command = const.CMD_STARTVERIFY
# uid = chr(uid % 256) + chr(uid >> 8) # uid = chr(uid % 256) + chr(uid >> 8)
cmd_response = self.__send_command(command=command) cmd_response = self.__send_command(command=command)
print cmd_response print cmd_response
def enroll_user(self, uid): def enroll_user(self, uid):
'''
start enroll user
'''
command = const.CMD_STARTENROLL command = const.CMD_STARTENROLL
uid = chr(uid % 256) + chr(uid >> 8) uid = chr(uid % 256) + chr(uid >> 8)
command_string = pack('2s', uid) command_string = pack('2s', uid)