public class WaitableDigitalInputDevice extends DigitalInputDevice
activeHigh, device
listeners
pinNumber
Constructor and Description |
---|
WaitableDigitalInputDevice(GpioDeviceFactoryInterface deviceFactory,
int pinNumber,
GpioPullUpDown pud,
GpioEventTrigger trigger) |
WaitableDigitalInputDevice(int pinNumber) |
WaitableDigitalInputDevice(int pinNumber,
GpioPullUpDown pud,
GpioEventTrigger trigger) |
Modifier and Type | Method and Description |
---|---|
protected void |
disableListener() |
void |
valueChanged(DigitalInputEvent event) |
boolean |
waitForActive()
Wait indefinitely for the device state to go active.
|
boolean |
waitForActive(int timeout)
Wait the specified time period for the device state to go active.
|
boolean |
waitForInactive()
Wait indefinitely for the device state to go inactive.
|
boolean |
waitForInactive(int timeout)
Wait the specified time period for the device state to go inactive.
|
boolean |
waitForValue(boolean value,
int timeout)
Wait the specified time period for the device state to switch to value.
|
close, enableListener, getPullUpDown, getTrigger, getValue, isActive, isActiveHigh, whenActivated, whenDeactivated
addListener, removeAllListeners, removeListener
getPinNumber
public WaitableDigitalInputDevice(int pinNumber) throws RuntimeIOException
pinNumber
- Pin number to which the device is connected.RuntimeIOException
- If an I/O error occurred.public WaitableDigitalInputDevice(int pinNumber, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException
pinNumber
- Pin number to which the device is connected.pud
- Pull up/down configuration, values: NONE, PULL_UP, PULL_DOWN.trigger
- Event trigger configuration, values: NONE, RISING, FALLING, BOTH.RuntimeIOException
- If an I/O error occurred.public WaitableDigitalInputDevice(GpioDeviceFactoryInterface deviceFactory, int pinNumber, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException
deviceFactory
- Device factory to use to construct the device.pinNumber
- Pin number to which the device is connected.pud
- Pull up/down configuration, values: NONE, PULL_UP, PULL_DOWN.trigger
- Event trigger configuration, values: NONE, RISING, FALLING, BOTH.RuntimeIOException
- If an I/O error occurred.protected void disableListener()
disableListener
in class DigitalInputDevice
public void valueChanged(DigitalInputEvent event)
valueChanged
in interface InputEventListener<DigitalInputEvent>
valueChanged
in class DigitalInputDevice
public boolean waitForActive() throws InterruptedException
InterruptedException
- If interrupted while waiting.-public boolean waitForActive(int timeout) throws InterruptedException
timeout
- Timeout value if milliseconds, <= 0 is indefinite.InterruptedException
- If interrupted while waiting.-public boolean waitForInactive() throws InterruptedException
InterruptedException
- If interrupted while waiting.-public boolean waitForInactive(int timeout) throws InterruptedException
timeout
- Timeout value if milliseconds, <= 0 is indefinite.InterruptedException
- If interrupted while waiting.-public boolean waitForValue(boolean value, int timeout) throws InterruptedException
value
- The desired device state to wait for.timeout
- Timeout value if milliseconds, <= 0 is indefinite.InterruptedException
- If interrupted while waiting.-Copyright © 2016 mattjlewis. All rights reserved.