Package com.diozero.api
Class GpioInputDevice<T extends DeviceEvent>
java.lang.Object
com.diozero.api.GpioDevice
com.diozero.api.GpioInputDevice<T>
- Type Parameters:
T
- Event class that extends DeviceEvent. SeeDigitalInputEvent
andAnalogInputEvent
.
- All Implemented Interfaces:
DeviceInterface
,DeviceEventConsumer<T>
,AutoCloseable
,Consumer<T>
- Direct Known Subclasses:
AbstractDigitalInputDevice
,AnalogInputDevice
public abstract class GpioInputDevice<T extends DeviceEvent> extends GpioDevice implements DeviceEventConsumer<T>
Common base class for digital and analog input devices.
-
Field Summary
Fields inherited from class com.diozero.api.GpioDevice
pinInfo
-
Constructor Summary
Constructors Constructor Description GpioInputDevice(PinInfo pinInfo)
-
Method Summary
Modifier and Type Method Description void
accept(T event)
void
addListener(DeviceEventConsumer<T> listener)
Add a new listenerprotected abstract void
disableDeviceListener()
protected abstract void
enableDeviceListener()
boolean
hasListeners()
void
removeAllListeners()
Remove all listenersvoid
removeListener(DeviceEventConsumer<T> listener)
Remove a specific listenerMethods inherited from class com.diozero.api.GpioDevice
getGpio
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
-
Constructor Details
-
GpioInputDevice
- Parameters:
pinInfo
- PinInfo object for the GPIO
-
-
Method Details
-
addListener
Add a new listener- Parameters:
listener
- Callback instance
-
removeListener
Remove a specific listener- Parameters:
listener
- Callback instance to remove
-
removeAllListeners
public void removeAllListeners()Remove all listeners -
hasListeners
public boolean hasListeners() -
accept
- Specified by:
accept
in interfaceConsumer<T extends DeviceEvent>
-
enableDeviceListener
protected abstract void enableDeviceListener() -
disableDeviceListener
protected abstract void disableDeviceListener()
-