本文整理匯總了Python中querier.Querier.cancel方法的典型用法代碼示例。如果您正苦於以下問題:Python Querier.cancel方法的具體用法?Python Querier.cancel怎麽用?Python Querier.cancel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類querier.Querier
的用法示例。
在下文中一共展示了Querier.cancel方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Modem2413U
# 需要導入模塊: from querier import Querier [as 別名]
# 或者: from querier.Querier import cancel [as 別名]
class Modem2413U(Device):
"""============== Insteon PowerLinc modem (PLM) ==============="""
def __init__(self, name, addr):
Device.__init__(self, name, addr)
self.dbbuilder = ModemDBBuilder(addr, self.db)
def __modifyModemDB(self, listener):
self.dbbuilder.setListener(listener)
# after db download complete, listener will perform action
iofun.out("getting db, be patient!")
self.dbbuilder.clear()
self.dbbuilder.start()
def getdb(self):
"""getdb()
download the modem database and print it on the console"""
self.dbbuilder.start()
self.dbbuilder.wait()
self.dbbuilder.dumpDB()
out("Modem Link DB complete")
def startWatch(self):
"""startWatch()
modem will print all incoming messages on terminal"""
self.querier = Querier(InsteonAddress("00.00.00"))
self.querier.setMsgHandler(MsgDumper("modem"))
self.querier.startWait(10000)
def stopWatch(self):
"""stopWatch()
stop modem from printing all incoming messages on terminal"""
if (self.querier):
self.querier.cancel()
def getid(self):
"""getid()
get modem id data"""
self.querier = Querier(InsteonAddress("00.00.00"))
self.querier.setMsgHandler(IMInfoMsgHandler("getid"))
msg = Msg.s_makeMessage("GetIMInfo")
self.querier.sendMsg(msg)
def sendOn(self, group):
"""sendOn(group)
sends ALLLink broadcast ON message to group "group" """
msg = message.createStdMsg(InsteonAddress("00.00.00"), 0x0f,
0x11, 0xFF, group)
iofun.writeMsg(msg)
iofun.out("sent msg: " + msg.toString())
def sendOff(self, group):
"""sendOff(group)
sends ALLLink broadcast OFF message to group "group" """
msg = message.createStdMsg(InsteonAddress("00.00.00"), 0x0f,
0x13, 0xFF, group)
iofun.writeMsg(msg)
iofun.out("sent msg: " + msg.toString())
def linkAsController(self, otherDevice, group):
"""linkAsController(otherDevice, group)
puts modem in link mode to control device "otherDevice" on group "group" """
addr = InsteonAddress(otherDevice)
self.querier = Querier(addr)
self.querier.setMsgHandler(DefaultMsgHandler("link as controller"))
msg = Msg.s_makeMessage("StartALLLinking")
msg.setByte("LinkCode", 0x01)
msg.setByte("ALLLinkGroup", group)
self.querier.sendMsg(msg)
def linkAsResponder(self, otherDevice, group):
"""linkAsResponder(otherDevice, group)
puts modem in link mode to respond to device "otherDevice" on group "group" """
addr = InsteonAddress(otherDevice)
self.querier = Querier(addr)
self.querier.setMsgHandler(DefaultMsgHandler("start linking"))
msg = Msg.s_makeMessage("StartALLLinking")
msg.setByte("LinkCode", 0x00)
msg.setByte("ALLLinkGroup", group)
self.querier.sendMsg(msg)
def linkAsEither(self, otherDevice, group):
"""linkAsEither(otherDevice, group)
puts modem in link mode to link as controller or responder to device "otherDevice" on group "group" """
addr = InsteonAddress(otherDevice)
self.querier = Querier(addr)
self.querier.setMsgHandler(
DefaultMsgHandler("link/unlink as controller or responder"))
msg = Msg.s_makeMessage("StartALLLinking")
msg.setByte("LinkCode", 0x03)
msg.setByte("ALLLinkGroup", group)
self.querier.sendMsg(msg)
def respondToUnlink(self, otherDevice, group):
"""respondToUnlink(otherDevice, group)
make modem respond to unlink message from other device"""
# could not get 0xFF to unlink
self.linkAsEither(otherDevice, group)
def unlinkAsController(self, otherDevice, group):
"""unlinkAsController(otherDevice, group)
puts modem in unlink mode to unlink as controller from device "otherDevice" on group "group" """
addr = InsteonAddress(otherDevice)
self.querier = Querier(addr)
self.querier.setMsgHandler(DefaultMsgHandler("unlink as controller"))
msg = Msg.s_makeMessage("StartALLLinking")
msg.setByte("LinkCode", 0xFF)
msg.setByte("ALLLinkGroup", group)
self.querier.sendMsg(msg)
def cancelLinking(self):
"""cancelLinking()
#.........這裏部分代碼省略.........