本文整理汇总了Python中scanner.Scanner.command方法的典型用法代码示例。如果您正苦于以下问题:Python Scanner.command方法的具体用法?Python Scanner.command怎么用?Python Scanner.command使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scanner.Scanner
的用法示例。
在下文中一共展示了Scanner.command方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Scanner
# 需要导入模块: from scanner import Scanner [as 别名]
# 或者: from scanner.Scanner import command [as 别名]
from scanner import Scanner
from time import sleep
s = Scanner()
print("We have our scanner:", s)
print("Writing a simple GLG command")
s.writeline('GLG')
print("Retrieving the rsponse")
print(s.readline())
print("Now send a few commands with decoded response")
print("MDL:", s.command("MDL"))
print("VER:", s.command("VER"))
print("GLG:", s.command("GLG"))
# Run a loop for a minute (more or less)
print("Looping for 5 receptions. Use ^C if it's taking too long.")
t = 0
try:
while t < 5:
r = s.command("GLG")
if r.NAME1:
print("Sys={NAME1}, Group={NAME2}, Chan={NAME3}, Sql={SQL}, Mute={MUT}, Time={TIME}".format_map(r))
t += 1
sleep(1)
except KeyboardInterrupt:
print("\nOK, quitting the loop")