public class WaitableDigitalInputDevice extends DigitalInputDevice
Modifier and Type | Field and Description |
---|---|
protected DigitalInputEvent |
lastPinEvent |
activeHigh, device, pud, trigger
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
protected DigitalInputEvent lastPinEvent
public WaitableDigitalInputDevice(int pinNumber) throws RuntimeIOException
RuntimeIOException
public WaitableDigitalInputDevice(int pinNumber, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException
RuntimeIOException
public WaitableDigitalInputDevice(GpioDeviceFactoryInterface deviceFactory, int pinNumber, GpioPullUpDown pud, GpioEventTrigger trigger) throws RuntimeIOException
RuntimeIOException
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.