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


Python InterfaceKit.setOnOutputChangeHandler方法代码示例

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


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

示例1: HomeMonDaemon

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOnOutputChangeHandler [as 别名]
class HomeMonDaemon(daemon.BaseDaemon):
    """ Serves one device
    """
    def __init__(self):
        daemon.BaseDaemon.__init__(self)
        self.ikit = None
        
        self.deviceName = None
        self.inputs = None
        self.outputs = None
    
        self.state = states['init']
    
    def init(self):
        """ Init 
        """
        try:
            self.ikit = InterfaceKit()
            
            self.ikit.setOnAttachHandler(self.inferfaceKitAttached)
            self.ikit.setOnDetachHandler(self.interfaceKitDetached)
            self.ikit.setOnErrorhandler(self.interfaceKitError)
            self.ikit.setOnInputChangeHandler(self.interfaceKitInputChanged)
            self.ikit.setOnOutputChangeHandler(self.interfaceKitOutputChanged)
            self.ikit.setOnSensorChangeHandler(self.interfaceKitSensorChanged)
        except Exception,e:
            pass
开发者ID:jldupont,项目名称:jldupont.com,代码行数:29,代码来源:daemon.py

示例2: interfaceKitSensorChanged

# 需要导入模块: from Phidgets.Devices import InterfaceKit [as 别名]
# 或者: from Phidgets.Devices.InterfaceKit import setOnOutputChangeHandler [as 别名]
def interfaceKitSensorChanged(e):
    print "Sensor %i: %i" % (e.index, e.value)
    return 0

def interfaceKitOutputChanged(e):
    print "Output %i: %s" % (e.index, e.state)
    return 0

#Main Program Code
try:
    interfaceKit.setOnAttachHandler(inferfaceKitAttached)
    interfaceKit.setOnDetachHandler(interfaceKitDetached)
    interfaceKit.setOnErrorhandler(interfaceKitError)
    interfaceKit.setOnInputChangeHandler(interfaceKitInputChanged)
    interfaceKit.setOnOutputChangeHandler(interfaceKitOutputChanged)
    interfaceKit.setOnSensorChangeHandler(interfaceKitSensorChanged)
except PhidgetException, e:
    print "Phidget Exception %i: %s" % (e.code, e.message)
    print "Exiting...."
    exit(1)

print "Opening phidget object...."

try:
    interfaceKit.openPhidget()
except PhidgetException, e:
    print "Phidget Exception %i: %s" % (e.code, e.message)
    print "Exiting...."
    exit(1)
开发者ID:jldupont,项目名称:pyjld,代码行数:31,代码来源:test2.py


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