add function test_voice

This commit is contained in:
Fanani M. Ihsan 2016-05-24 21:52:42 +07:00
parent 411b2679ef
commit 79b856f448
2 changed files with 11 additions and 0 deletions

View File

@ -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()

View File

@ -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