diff --git a/test.py b/test.py index bbd425e..a5e9856 100644 --- a/test.py +++ b/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: diff --git a/zk/base.py b/zk/base.py index 78b3304..55e874e 100644 --- a/zk/base.py +++ b/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