From 79b856f448e9b5165065a80c6cfbeba6398881ca Mon Sep 17 00:00:00 2001 From: "Fanani M. Ihsan" Date: Tue, 24 May 2016 21:52:42 +0700 Subject: [PATCH] add function test_voice --- test.py | 1 + zk/base.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/test.py b/test.py index a5e9856..27420f2 100644 --- a/test.py +++ b/test.py @@ -24,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.test_voice() print zk.enable_device() print 'Disconnecting to device ...' print zk.disconnect() diff --git a/zk/base.py b/zk/base.py index 55e874e..aac786e 100644 --- a/zk/base.py +++ b/zk/base.py @@ -192,6 +192,16 @@ class ZK(object): else: return cmd_response + def test_voice(self): + command = const.CMD_TESTVOICE + cmd_response = self.__send_command(command) + cmd_response['data'] = '' + if cmd_response.get('status'): + cmd_response['message'] = 'voice detected' + 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