示例#1
0
文件: motor.py 项目: cyrusbuilt/RasPy
    def dispose(self):
        """Dispose managed resources."""
        if self.is_disposed:
            return

        self.__emitter.remove_all_listeners()
        self.__emitter = None
        Component.dispose(self)
示例#2
0
    def dispose(self):
        """Dispose of all the managed resources used by this instance."""
        if self.is_disposed:
            return

        self.__emitter.remove_all_listeners()
        self._stop_hold_timer()
        self.__emitter = None
        Component.dispose(self)
示例#3
0
    def dispose(self):
        """Release managed resources used by this component."""
        if self.is_disposed:
            return

        self.__state = switch_state.OFF
        self.__emitter.remove_all_listeners()
        self.__emitter = None
        Component.dispose(self)
示例#4
0
    def dispose(self):
        """Release managed resources used by this component."""
        if self.is_disposed:
            return

        if self.__pin is not None:
            self.__pin.dispose()
            self.__pin = None

        self.__state = sensor_state.OPEN
        self.__emitter.remove_all_listeners()
        self.__emitter = None
        Component.dispose(self)
示例#5
0
    def __init__(self, pin):
        """Initialize a new instance of Sensor.

        :param raspy.io.gpio.Gpio pin: The input pin to sample data from.
        :raises: ArgumentNullException if 'pin' param is None.
        """
        Component.__init__(self)
        if pin is None:
            raise ArgumentNullException("'pin' param cannot be None.")

        self.__emitter = EventEmitter()
        self.__state = sensor_state.OPEN
        self.__pin = pin
        self.__pin.provision()
示例#6
0
    def dispose(self):
        """Release managed resources used by this component."""
        if self.is_disposed:
            return

        if self.__tempSensor is not None:
            self.__tempSensor.dispose()
            self.__tempSensor = None

        self.__rawTemp = 0.0
        self.__scale = temp_scale.CELCIUS
        self.__emitter.remove_all_listeners()
        self.__emitter = None
        Component.dispose(self)
示例#7
0
    def dispose(self):
        """Release managed resources used by this component."""
        if self.is_disposed:
            return

        if self.__pin is not None:
            self.__pin.dispose()
            self.__pin = None

        self.__lastMotion = None
        self.__lastInactive = None
        self.__emitter.remove_all_listeners()
        self.__emitter = None
        Component.dispose(self)
示例#8
0
    def __init__(self, pin):
        """Initialize a new instance of Relay.

        :param raspy.io.gpio.Gpio pin: The output pin being used to control
        the relay.
        :raises: ArgumentNullException if pin param is None.
        """
        Component.__init__(self)
        if pin is None:
            raise ArgumentNullException("'pin' param cannot be None.")

        self.__emitter = EventEmitter()
        self.__state = relay_state.OPEN
        self.__pin = pin
        self.__pin.provision()
示例#9
0
    def __init__(self, pin):
        """Initialize a new instance of MotionSensor.

        :param raspy.io.gpio.Gpio pin: The input pin to check for motion on.
        :raises: ArgumentNullException if pin is None.
        """
        Component.__init__(self)
        if pin is None:
            raise ArgumentNullException("'pin' param cannot be None.")

        self.__emitter = EventEmitter()
        self.__lastMotion = None
        self.__lastInactive = None
        self.__pin = pin
        self.__pin.provision()
示例#10
0
    def __init__(self, clock, data, reset):
        """Initialize a new instance of TempSensor.

        :param raspy.io.gpio.Gpio clock: The GPIO pin used for the clock.
        :param raspy.io.gpio.Gpio data: The GPIO used for data.
        :param raspy.io.gpio.Gpio reset: The GPIO pin used to trigger reset.
        :raises: ArgumentNullException if any of the pins are None.
        """
        Component.__init__(self)
        if clock is None:
            raise ArgumentNullException("'clock' cannot be None.")

        if data is None:
            raise ArgumentNullException("'data' cannot be None.")

        if reset is None:
            raise ArgumentNullException("'reset' cannot be None.")

        self.__emitter = EventEmitter()
        self.__rawTemp = 0.0
        self.__scale = temp_scale.CELCIUS
        self.__tempSensor = DS1620(clock, data, reset)
示例#11
0
 def __init__(self):
     """Initialize a new instance of a Buzzer."""
     Component.__init__(self)
示例#12
0
文件: motor.py 项目: cyrusbuilt/RasPy
 def __init__(self):
     """Initialize a new instance of Motor."""
     Component.__init__(self)
     self.__emitter = EventEmitter()
     self.__state = motor_state.STOP
示例#13
0
 def __init__(self):
     """Initialize a new instance of Light."""
     Component.__init__(self)
     self.__emitter = EventEmitter()
示例#14
0
 def __init__(self):
     """Initialize a new instance of Potentiometer."""
     Component.__init__(self)
示例#15
0
 def __init__(self):
     """Initialize a new instance of Switch."""
     Component.__init__(self)
     self.__emitter = EventEmitter()
     self.__state = switch_state.OFF
示例#16
0
 def __init__(self):
     """Initialize a new instance of Gyro."""
     Component.__init__(self)
示例#17
0
 def __init__(self):
     """Initialize a new instance of PowerInterface."""
     Component.__init__(self)
     self.__emitter = EventEmitter()
     self.__state = power_state.OFF