Class AbstractDigitalInputDevice

All Implemented Interfaces:
DigitalInputDeviceInterface, DeviceEventConsumer<DigitalInputEvent>, Closeable, AutoCloseable, Consumer<DigitalInputEvent>
Direct Known Subclasses:
DigitalInputDevice, DigitalInputOutputDevice

public abstract class AbstractDigitalInputDevice
extends GpioInputDevice<DigitalInputEvent>
implements DigitalInputDeviceInterface
Abstract base class for low-level GPIO digital input devices.
  • Field Details

    • activeHigh

      protected boolean activeHigh
  • Constructor Details

    • AbstractDigitalInputDevice

      public AbstractDigitalInputDevice​(int gpio, boolean activeHigh)
  • Method Details

    • isActiveHigh

      public boolean isActiveHigh()
      Get active high configuration.
      Returns:
      Returns false if configured as pull-up, true for all other pull up / down options.
    • enableDeviceListener

      protected void enableDeviceListener()
      Specified by:
      enableDeviceListener in class GpioInputDevice<DigitalInputEvent>
    • disableDeviceListener

      protected void disableDeviceListener()
      Specified by:
      disableDeviceListener in class GpioInputDevice<DigitalInputEvent>
    • accept

      public void accept​(DigitalInputEvent event)
      Specified by:
      accept in interface Consumer<DigitalInputEvent>
      Overrides:
      accept in class GpioInputDevice<DigitalInputEvent>
    • whenActivated

      public void whenActivated​(Action action)
      Action to perform when the device state is active.
      Parameters:
      action - Action callback object.
    • whenDeactivated

      public void whenDeactivated​(Action action)
      Action to perform when the device state is inactive.
      Parameters:
      action - Action callback object.
    • setListener

      protected abstract void setListener()
    • removeListener

      protected abstract void removeListener()