2016-05-23 13:50:54 +07:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import sys
|
|
|
|
sys.path.append("zk")
|
|
|
|
|
|
|
|
import zk
|
|
|
|
|
|
|
|
zk = zk.ZK('192.168.1.201')
|
2016-05-23 23:59:43 +07:00
|
|
|
print 'Connecting to device ...'
|
|
|
|
conn = zk.connect()
|
|
|
|
if conn.get('status'):
|
|
|
|
print conn
|
2016-05-24 21:49:04 +07:00
|
|
|
print zk.disable_device()
|
2016-05-23 14:41:39 +07:00
|
|
|
print 'Firmware Version: : {}'.format(zk.get_firmware_version())
|
2016-05-23 23:59:43 +07:00
|
|
|
# print 'Restarting device'
|
|
|
|
# print zk.restart()
|
|
|
|
# print 'Turning off device'
|
|
|
|
# print zk.power_off()
|
|
|
|
# # users = zk.get_users()
|
|
|
|
# # if users:
|
|
|
|
# # for uid in users:
|
|
|
|
# # if users[uid][2] == 14:
|
|
|
|
# # level = 'Admin'
|
|
|
|
# # else:
|
|
|
|
# # level = 'User'
|
|
|
|
# # print "[UID %d]: ID: %s, Name: %s, Level: %s, Password: %s" % ( uid, users[uid][0], users[uid][1], level, users[uid][3] )
|
2016-05-23 19:49:36 +07:00
|
|
|
|
2016-05-24 21:52:42 +07:00
|
|
|
print zk.test_voice()
|
2016-05-24 21:49:04 +07:00
|
|
|
print zk.enable_device()
|
2016-05-23 23:59:43 +07:00
|
|
|
print 'Disconnecting to device ...'
|
2016-05-23 14:41:39 +07:00
|
|
|
print zk.disconnect()
|
2016-05-23 23:59:43 +07:00
|
|
|
# if status:
|
|
|
|
# print 'Disonnected !'
|
|
|
|
# else:
|
|
|
|
# print 'Disconnecting Error: {}'.format(message)
|
2016-05-23 14:41:39 +07:00
|
|
|
else:
|
2016-05-23 23:59:43 +07:00
|
|
|
print 'Connecting Error: {}'.format(conn.get('message'))
|
|
|
|
|