Class GpioInputDevice<T extends DeviceEvent>

java.lang.Object
com.diozero.api.GpioDevice
com.diozero.api.GpioInputDevice<T>
Type Parameters:
T - Event class that extends DeviceEvent. See DigitalInputEvent and AnalogInputEvent.
All Implemented Interfaces:
InputEventListener<T>, Closeable, AutoCloseable
Direct Known Subclasses:
AbstractDigitalInputDevice, AnalogInputDevice

public abstract class GpioInputDevice<T extends DeviceEvent>
extends GpioDevice
implements InputEventListener<T>
Common base class for digital and analog input devices.
  • Constructor Details

    • GpioInputDevice

      public GpioInputDevice​(int gpio)
      Parameters:
      gpio - GPIO to which the device is connected.
  • Method Details

    • addListener

      public void addListener​(InputEventListener<T> listener)
      Add a new listener.
      Parameters:
      listener - Callback instance.
    • removeListener

      public void removeListener​(InputEventListener<T> listener)
      Remove a specific listener.
      Parameters:
      listener - Callback instance to remove.
    • removeAllListeners

      public void removeAllListeners()
      Remove all listeners.
    • valueChanged

      public void valueChanged​(T event)
      Specified by:
      valueChanged in interface InputEventListener<T extends DeviceEvent>
    • enableDeviceListener

      protected abstract void enableDeviceListener()
    • disableDeviceListener

      protected abstract void disableDeviceListener()