Class TouchSwitchHelper

java.lang.Object
com.opensourcewithslu.inputdevices.TouchSwitchHelper

public class TouchSwitchHelper extends Object
The TouchSwitchHelper class is used to initialize a touch switch.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    Shows if the touch switch has been touched.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TouchSwitchHelper(com.pi4j.io.gpio.digital.DigitalInput touchSwitchInput)
    TouchSwitchHelper constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function)
    Adds an event listener to the touch switch.
    void
    Removes the event listener from the touch switch.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • isTouched

      public boolean isTouched
      Shows if the touch switch has been touched.
  • Constructor Details

    • TouchSwitchHelper

      public TouchSwitchHelper(com.pi4j.io.gpio.digital.DigitalInput touchSwitchInput)
      TouchSwitchHelper constructor.
      Parameters:
      touchSwitchInput - A Pi4J DigitalInput object.
  • Method Details

    • addEventListener

      public void addEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function)
      Adds an event listener to the touch switch.
      Parameters:
      function - A Pi4J DigitalStateChangeListener object.
    • removeEventListener

      public void removeEventListener()
      Removes the event listener from the touch switch.