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


Python NetworkTable.addGlobalListener方法代码示例

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


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

示例1: open

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import addGlobalListener [as 别名]
    def open(self):
        logger.info("NetworkTables websocket opened")

        self.ioloop = IOLoop.current()
        self.nt = NetworkTable.getGlobalTable()
        NetworkTable.addGlobalListener(self.on_nt_change, immediateNotify=True)
        self.nt.addConnectionListener(self, immediateNotify=True)
开发者ID:computer-whisperer,项目名称:pynetworktables2js,代码行数:9,代码来源:handlers.py

示例2: __init__

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import addGlobalListener [as 别名]
    def __init__(self, update_callback):
        """
        :param update_callback: A callable with signature ```callable(update)``` for processing outgoing updates
        formatted as strings.
        """
        self.update_callback = update_callback
        self.nt = NetworkTable.getGlobalTable()
        NetworkTable.addGlobalListener(self._nt_on_change, immediateNotify=True)

        class Empty:
            pass
        self.conn_listener = Empty()
        self.conn_listener.connected = self._nt_connected
        self.conn_listener.disconnected = self._nt_disconnected

        self.nt.addConnectionListener(self.conn_listener, immediateNotify=True)
开发者ID:FRC830,项目名称:pynetworktables2js,代码行数:18,代码来源:nt_serial.py

示例3: foo

# 需要导入模块: from networktables import NetworkTable [as 别名]
# 或者: from networktables.NetworkTable import addGlobalListener [as 别名]
import sys
import time

import logging
logging.basicConfig(level=logging.DEBUG)

NetworkTable.setIPAddress("127.0.0.1")
NetworkTable.setClientMode()
NetworkTable.initialize()

def foo(value):
    print("foo", value)

def bar(value):
    print("bar", value)

def valueChanged(key, value, isNew):
    print("valueChanged: %s = %s" % (key, value) )

NetworkTable.addGlobalListener(valueChanged)

cc = ChooserControl("control_preset",
                    foo,
                    bar)
sd = NetworkTable.getTable("SmartDashboard")

while True:
    time.sleep(1)

开发者ID:rIGSteam,项目名称:Potatobot,代码行数:30,代码来源:dash.py


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