Class SlideSwitchHelper

java.lang.Object
com.opensourcewithslu.inputdevices.SlideSwitchHelper

public class SlideSwitchHelper extends Object
The SlideSwitchHelper class is used to initialize a slide switch.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    boolean
    Shows if the slide switch is on.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    void
    addEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function)
    Adds an EvenListener to the slide switch.
    void
    Initializes the listener that keeps track of whether the slide switch is high/low.
    void
    removeEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function)
    Removes the EventListener from the slide switch.

    Methods inherited from class java.lang.Object

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

    • isOn

      public boolean isOn
      Shows if the slide switch is on.
  • Constructor Details

    • SlideSwitchHelper

      public SlideSwitchHelper(com.pi4j.io.gpio.digital.DigitalInput slideSwitchInput)
      SlideSwitchHelper constructor.
      Parameters:
      slideSwitchInput - A Pi4J DigitalInput Object.
  • Method Details

    • initialize

      public void initialize()
      Initializes the listener that keeps track of whether the slide switch is high/low. Automatically called when the SlideSwitchHelper is instantiated.
    • addEventListener

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

      public void removeEventListener(com.pi4j.io.gpio.digital.DigitalStateChangeListener function)
      Removes the EventListener from the slide switch.
      Parameters:
      function - A Pi4J DigitalStateChangeListener object.