add function to clear data

This commit is contained in:
Fanani M. Ihsan 2016-06-10 11:27:49 +07:00
parent 457749cee0
commit 7b33ceeded

View File

@ -183,7 +183,7 @@ class ZK(object):
raise Exception("Invalid response") raise Exception("Invalid response")
def get_serialnumber(self): def get_serialnumber(self):
command = 11 command = const.CMD_OPTIONS_RRQ
command_string = '~SerialNumber' command_string = '~SerialNumber'
checksum = 0 checksum = 0
session_id = self.__sesion_id session_id = self.__sesion_id
@ -360,12 +360,23 @@ class ZK(object):
cmd_response = self.__send_command(command=command, command_string=command_string) cmd_response = self.__send_command(command=command, command_string=command_string)
print cmd_response print cmd_response
def clear_user(self): def clear_data(self):
''' '''
Not implemented yet clear all data (include: user, attendance report, finger database )
''' '''
command = const.CMD_CLEAR_DATA
command_string = ''
checksum = 0
session_id = self.__sesion_id
reply_id = self.__reply_id
response_size = 1024
pass cmd_response = self.__send_command(command, command_string, checksum, session_id, reply_id, response_size)
if cmd_response.get('status'):
serialnumber = self.__data_recv[8:].split('=')[-1].strip('\x00|\x01\x10x')
return serialnumber
else:
raise Exception("Invalid response")
def get_attendance(self): def get_attendance(self):
''' '''