Class SysFsDigitalInputDevice
java.lang.Object
com.diozero.internal.provider.AbstractDevice
com.diozero.internal.provider.AbstractInputDevice<DigitalInputEvent>
com.diozero.internal.provider.sysfs.SysFsDigitalInputDevice
- All Implemented Interfaces:
DeviceInterface
,GpioDeviceInterface
,GpioDigitalDeviceInterface
,GpioDigitalInputDeviceInterface
,PollEventListener
,java.io.Closeable
,java.lang.AutoCloseable
public class SysFsDigitalInputDevice extends AbstractInputDevice<DigitalInputEvent> implements GpioDigitalInputDeviceInterface, PollEventListener
Pure Java implementation using the sysfs (/sys/class/gpio) kernel module.
-
Field Summary
Fields Modifier and Type Field Description protected int
gpio
-
Constructor Summary
Constructors Constructor Description SysFsDigitalInputDevice(SysFsDeviceFactory deviceFactory, java.lang.String key, PinInfo pinInfo, GpioEventTrigger trigger)
-
Method Summary
Modifier and Type Method Description protected void
closeDevice()
protected void
disableListener()
protected void
enableListener()
int
getGpio()
boolean
getValue()
void
notify(long epochTime, long nanoTime, char value)
void
setDebounceTimeMillis(int debounceTime)
Methods inherited from class com.diozero.internal.provider.AbstractInputDevice
generatesEvents, removeListener, setListener, valueChanged
Methods inherited from class com.diozero.internal.provider.AbstractDevice
close, getDeviceFactory, getKey, isOpen
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.diozero.internal.provider.DeviceInterface
close, getKey, isOpen
Methods inherited from interface com.diozero.internal.provider.GpioDigitalInputDeviceInterface
getMode, removeListener, setListener
-
Field Details
-
gpio
protected int gpio
-
-
Constructor Details
-
SysFsDigitalInputDevice
public SysFsDigitalInputDevice(SysFsDeviceFactory deviceFactory, java.lang.String key, PinInfo pinInfo, GpioEventTrigger trigger)
-
-
Method Details
-
getGpio
public int getGpio()- Specified by:
getGpio
in interfaceGpioDeviceInterface
-
getValue
- Specified by:
getValue
in interfaceGpioDigitalDeviceInterface
- Throws:
RuntimeIOException
-
setDebounceTimeMillis
public void setDebounceTimeMillis(int debounceTime)- Specified by:
setDebounceTimeMillis
in interfaceGpioDigitalInputDeviceInterface
-
enableListener
protected void enableListener()- Overrides:
enableListener
in classAbstractInputDevice<DigitalInputEvent>
-
disableListener
protected void disableListener()- Overrides:
disableListener
in classAbstractInputDevice<DigitalInputEvent>
-
closeDevice
- Specified by:
closeDevice
in classAbstractDevice
- Throws:
RuntimeIOException
-
notify
public void notify(long epochTime, long nanoTime, char value)- Specified by:
notify
in interfacePollEventListener
-