本文整理汇总了Python中link.Link.open方法的典型用法代码示例。如果您正苦于以下问题:Python Link.open方法的具体用法?Python Link.open怎么用?Python Link.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类link.Link
的用法示例。
在下文中一共展示了Link.open方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from link import Link [as 别名]
# 或者: from link.Link import open [as 别名]
def test(name):
logger.info("hello world %s" % __name__)
d = Link('/dev/ttyUSB1')
logger.debug("%s" % d)
d = Link('/dev/ttyUSB1')
logger.debug("%r" % d)
if not d.isOpen():
d.open()
command = commands.ATCommand()
result = d.process(command)
print "%r" % command
command = commands.CMEE.query()
result = d.process(command)
print "%r" % command
command = commands.CMEE.assign(2)
result = d.process(command)
print "%r" % command
command = commands.CGDCONT.query()
result = d.process(command)
print "%r" % command
示例2: setup_argparser
# 需要导入模块: from link import Link [as 别名]
# 或者: from link.Link import open [as 别名]
self.args.out.write(self.formatter(self.data))
if __name__ == "__main__":
import sys
parser = setup_argparser()
args = parser.parse_args()
# args = sys.argv[:]
# mac = (args[1:2] or [None]).pop( )
mac = args.mac
channel = choose_rx_channel(args.rx)
format_record = Formatter(args)
if args.verbosity > 0:
print args
if args.mac:
link = Link(mac, sleep_interval=args.sleep_interval)
link.open()
monitor = Monitor(
link, RX=channel, sleep_interval=args.sleep_interval, timeout=args.timeout, verbosity=args.verbosity
)
try:
monitor.listen(format_record)
except (KeyboardInterrupt), e:
if args.verbosity > 0:
print "Quitting"
finally:
if not args.stream:
format_record.finish_concat()
link.close()