當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。