Add support for writing RFID cards

This commit is contained in:
Ajay Ramaswamy 2018-04-19 05:22:38 +05:30
parent bea82416f1
commit 362c5b9600

View File

@ -526,7 +526,9 @@ class ZK(object):
print "Error pack: %s" % sys.exc_info()[0]
raise ZKErrorResponse("Cant pack user")
else:
command_string = pack('Hc8s28sc7sx24s', uid, privilege, password, name, chr(0), group_id, user_id)
name_pad = name.ljust(24, '\x00')[:24]
card_str = pack('i', int(card))[:4]
command_string = pack('Hc8s24s4sc7sx24s', uid, privilege, password, name_pad, card_str, chr(0), group_id, user_id)
response_size = 1024
cmd_response = self.__send_command(command, command_string, response_size)
if cmd_response.get('status'):