update user command string

This commit is contained in:
Fanani M. Ihsan 2016-05-25 12:02:56 +07:00
parent 5d3aae3884
commit c4880a9c59
2 changed files with 12 additions and 2 deletions

View File

@ -202,9 +202,16 @@ class ZK(object):
else:
return cmd_response
def set_user(self, uid, privilege, password='', name='', card_num=chr(1), group='', timezone='', user_id=''):
def set_user(self, uid, name, password='', privilege=0, grup_id='', user_id=''):
command = const.CMD_USER_WRQ
command_string = pack('sss8s28ss7sx8s16s', chr(uid % 256), chr(uid >> 8), chr(privilege), password, name, card_num, group, user_id, timezone )
uid = chr(uid % 256) + chr(uid >> 8)
if privilege not in [const.USER_DEFAULT, const.USER_ADMIN]:
privilege = const.USER_DEFAULT
privilege = chr(privilege)
command_string = pack('2sc6s30sc8s24s', uid, privilege, password, name, chr(0), grup_id, user_id)
cmd_response = self.__send_command(command=command, command_string=command_string, response_size=1024)
cmd_response['data'] = ''
if cmd_response.get('status'):

View File

@ -93,6 +93,9 @@ EF_VERIFY = (1<<7)# be real-time to verify fingerprint
EF_FPFTR = (1<<8)# be real-time capture fingerprint minutia
EF_ALARM = (1<<9)# Alarm signal
USER_DEFAULT = 0
USER_ADMIN = 14
'''
Follow is data type sign (attendance record, fingerprint)
FCT_ATTLOG (U8)1 Attendance record