本文整理汇总了Python中device.Device.get_device方法的典型用法代码示例。如果您正苦于以下问题:Python Device.get_device方法的具体用法?Python Device.get_device怎么用?Python Device.get_device使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类device.Device
的用法示例。
在下文中一共展示了Device.get_device方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getDeviceForDynAnalysis
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import get_device [as 别名]
def getDeviceForDynAnalysis():
dev_list = Device.get_devices_list()
devNum = len(dev_list)
if devNum <= 0:
logger.error("No device has been detected! Connect your device and restart the application!")
return None
if devNum == 1:
return Device.get_device(dev_list[0])
choice = None
if devNum > 1:
print "Select the device to use for analysis:\n"
for i in xrange(0, devNum):
print "%d. %s\n" % ((i + 1), dev_list[i])
while not choice:
try:
choice = int(raw_input())
if choice not in range(1, devNum+1):
choice = None
print 'Invalid choice! Choose right number!'
except ValueError:
print 'Invalid Number! Choose right number!'
return Device.get_device(dev_list[choice - 1])
示例2: main
# 需要导入模块: from device import Device [as 别名]
# 或者: from device.Device import get_device [as 别名]
def main():
dev = Device.get_device("303195BA0D4D00EC")
messages = Queue.Queue()
seccon_producer = SecconMessageProducer(messages, dev)
seccon_consumer = SecconMessageProcessor(messages)
seccon_producer.setDaemon(False)
seccon_consumer.setDaemon(False)
seccon_producer.start()
seccon_consumer.start()
time.sleep(60)
print "Time is finished!!!"
seccon_producer.stopThread()
seccon_consumer.stopThread()
seccon_producer.join()
seccon_consumer.join()