当前位置: 首页>>代码示例>>Python>>正文


Python YowNetworkLayer.EVENT_STATE_DISCONNECT属性代码示例

本文整理汇总了Python中yowsup.layers.network.YowNetworkLayer.EVENT_STATE_DISCONNECT属性的典型用法代码示例。如果您正苦于以下问题:Python YowNetworkLayer.EVENT_STATE_DISCONNECT属性的具体用法?Python YowNetworkLayer.EVENT_STATE_DISCONNECT怎么用?Python YowNetworkLayer.EVENT_STATE_DISCONNECT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在yowsup.layers.network.YowNetworkLayer的用法示例。


在下文中一共展示了YowNetworkLayer.EVENT_STATE_DISCONNECT属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from yowsup.layers.network import YowNetworkLayer [as 别名]
# 或者: from yowsup.layers.network.YowNetworkLayer import EVENT_STATE_DISCONNECT [as 别名]
def main():
    rospy.init_node("whatsapp_service")
    cred = credentials.WHATSAPP
    stackBuilder = YowStackBuilder()
    stack = (stackBuilder
             .pushDefaultLayers(True)
             .push(AideRosLayer)
             .build())
    loginfo("Stack built...")
    stack.setCredentials(cred)
    stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_CONNECT))  # sending the connect signal
    loginfo("Connected...")
    atexit.register(lambda: stack.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT)))

    th = threading.Thread(target=stack.loop)
    th.daemon = True
    th.start()
    loginfo("Running in background.")
    loginfo("All done. spinning.")
    while not rospy.is_shutdown():
        rospy.spin() 
开发者ID:Lambda-3,项目名称:aide,代码行数:23,代码来源:whatsapp.py

示例2: handleFailure

# 需要导入模块: from yowsup.layers.network import YowNetworkLayer [as 别名]
# 或者: from yowsup.layers.network.YowNetworkLayer import EVENT_STATE_DISCONNECT [as 别名]
def handleFailure(self, node):
        nodeEntity = FailureProtocolEntity.fromProtocolTreeNode(node)
        self.toUpper(nodeEntity)
        self.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT, reason = "Authentication Failure"))
        raise AuthError(nodeEntity.getReason()) 
开发者ID:svub,项目名称:whatsapp-rest-webservice,代码行数:7,代码来源:layer_authentication.py

示例3: waitPong

# 需要导入模块: from yowsup.layers.network import YowNetworkLayer [as 别名]
# 或者: from yowsup.layers.network.YowNetworkLayer import EVENT_STATE_DISCONNECT [as 别名]
def waitPong(self, id):
        self._pingQueueLock.acquire()
        self._pingQueue[id] = None
        pingQueueSize = len(self._pingQueue)
        self._pingQueueLock.release()
        self.__logger.debug("ping queue size: %d" % pingQueueSize)
        if pingQueueSize >= 2:
            self.getStack().broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT, reason = "Ping Timeout")) 
开发者ID:svub,项目名称:whatsapp-rest-webservice,代码行数:10,代码来源:layer.py

示例4: disconnect

# 需要导入模块: from yowsup.layers.network import YowNetworkLayer [as 别名]
# 或者: from yowsup.layers.network.YowNetworkLayer import EVENT_STATE_DISCONNECT [as 别名]
def disconnect(self):
        if self.assertConnected():

            self.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT)) 
开发者ID:svub,项目名称:whatsapp-rest-webservice,代码行数:6,代码来源:layer.py

示例5: disconnect

# 需要导入模块: from yowsup.layers.network import YowNetworkLayer [as 别名]
# 或者: from yowsup.layers.network.YowNetworkLayer import EVENT_STATE_DISCONNECT [as 别名]
def disconnect(self):
        if self.assertConnected():
            self.broadcastEvent(
                YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT)) 
开发者ID:Dargmuesli,项目名称:bottom-news,代码行数:6,代码来源:layer.py

示例6: disconnect

# 需要导入模块: from yowsup.layers.network import YowNetworkLayer [as 别名]
# 或者: from yowsup.layers.network.YowNetworkLayer import EVENT_STATE_DISCONNECT [as 别名]
def disconnect(self):
        if self.assertConnected():
            self.broadcastEvent(YowLayerEvent(YowNetworkLayer.EVENT_STATE_DISCONNECT)) 
开发者ID:Gab0,项目名称:dZAP,代码行数:5,代码来源:layer.py


注:本文中的yowsup.layers.network.YowNetworkLayer.EVENT_STATE_DISCONNECT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。