Class SysFsDigitalInputDevice
- java.lang.Object
-
- com.diozero.internal.spi.AbstractDevice
-
- com.diozero.internal.spi.AbstractInputDevice<DigitalInputEvent>
-
- com.diozero.internal.provider.builtin.SysFsDigitalInputDevice
-
- All Implemented Interfaces:
DeviceInterface
,GpioDeviceInterface
,GpioDigitalDeviceInterface
,GpioDigitalInputDeviceInterface
,InternalDeviceInterface
,PollEventListener
,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(DefaultDeviceFactory deviceFactory, String key, PinInfo pinInfo, GpioEventTrigger trigger)
-
Method Summary
All Methods Instance Methods Concrete Methods 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.spi.AbstractInputDevice
accept, generatesEvents, isListenerEnabled, removeListener, setListener
-
Methods inherited from class com.diozero.internal.spi.AbstractDevice
close, getDeviceFactory, getKey, isChild, isOpen, setChild
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.diozero.api.DeviceInterface
close
-
Methods inherited from interface com.diozero.internal.spi.GpioDigitalInputDeviceInterface
getMode, removeListener, setListener
-
Methods inherited from interface com.diozero.internal.spi.InternalDeviceInterface
getKey, isChild, isOpen, setChild
-
-
-
-
Constructor Detail
-
SysFsDigitalInputDevice
public SysFsDigitalInputDevice(DefaultDeviceFactory deviceFactory, String key, PinInfo pinInfo, GpioEventTrigger trigger)
-
-
Method Detail
-
getGpio
public int getGpio()
- Specified by:
getGpio
in interfaceGpioDeviceInterface
-
getValue
public boolean getValue() throws RuntimeIOException
- 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
protected void closeDevice() throws RuntimeIOException
- Overrides:
closeDevice
in classAbstractInputDevice<DigitalInputEvent>
- Throws:
RuntimeIOException
-
notify
public void notify(long epochTime, long nanoTime, char value)
- Specified by:
notify
in interfacePollEventListener
-
-