add enable/disable function
This commit is contained in:
parent
c0da6b715d
commit
411b2679ef
2
test.py
2
test.py
@ -9,6 +9,7 @@ print 'Connecting to device ...'
|
||||
conn = zk.connect()
|
||||
if conn.get('status'):
|
||||
print conn
|
||||
print zk.disable_device()
|
||||
print 'Firmware Version: : {}'.format(zk.get_firmware_version())
|
||||
# print 'Restarting device'
|
||||
# print zk.restart()
|
||||
@ -23,6 +24,7 @@ if conn.get('status'):
|
||||
# # level = 'User'
|
||||
# # print "[UID %d]: ID: %s, Name: %s, Level: %s, Password: %s" % ( uid, users[uid][0], users[uid][1], level, users[uid][3] )
|
||||
|
||||
print zk.enable_device()
|
||||
print 'Disconnecting to device ...'
|
||||
print zk.disconnect()
|
||||
# if status:
|
||||
|
20
zk/base.py
20
zk/base.py
@ -172,6 +172,26 @@ class ZK(object):
|
||||
else:
|
||||
return cmd_response
|
||||
|
||||
def disable_device(self):
|
||||
command = const.CMD_DISABLEDEVICE
|
||||
cmd_response = self.__send_command(command)
|
||||
cmd_response['data'] = ''
|
||||
if cmd_response.get('status'):
|
||||
cmd_response['message'] = 'device disabled'
|
||||
return cmd_response
|
||||
else:
|
||||
return cmd_response
|
||||
|
||||
def enable_device(self):
|
||||
command = const.CMD_ENABLEDEVICE
|
||||
cmd_response = self.__send_command(command)
|
||||
cmd_response['data'] = ''
|
||||
if cmd_response.get('status'):
|
||||
cmd_response['message'] = 'device enabled'
|
||||
return cmd_response
|
||||
else:
|
||||
return cmd_response
|
||||
|
||||
# def __get_size_user(self):
|
||||
# """Checks a returned packet to see if it returned CMD_PREPARE_DATA,
|
||||
# indicating that data packets are to be sent
|
||||
|
Loading…
Reference in New Issue
Block a user