public class GpioEventWatcher extends Object implements AutoCloseable
| Constructor and Description |
|---|
GpioEventWatcher()
Basic constructor allocating the needed resources.
|
| Modifier and Type | Method and Description |
|---|---|
GpioEventWatcher |
addHandle(GpioEventHandle handle,
int id)
Adds a GPIO event to monitor.
|
void |
close()
Closes this instance and release associated resources.
|
GpioEventWatcher |
removeHandle(GpioEventHandle handle)
Removes a GPIO event from being monitored.
|
boolean |
waitForEvent(GpioEvent data)
Waits forever until a GPIO event occurs.
|
boolean |
waitForEvent(GpioEvent data,
int timeout)
Waits `
timeout` milliseconds at most until a GPIO event occurs. |
public GpioEventWatcher()
throws LinuxException
LinuxException - When something fails on the native side.public GpioEventWatcher addHandle(GpioEventHandle handle, int id) throws LinuxException
handle - The GPIO event handle to monitor.id - An arbitrary identifier so that when this event happens, it can be recognized by
the user.LinuxException - When something fails on the native side.public GpioEventWatcher removeHandle(GpioEventHandle handle) throws LinuxException
handle - The GPIO event handle to remove.LinuxException - When something fails on the native side.public boolean waitForEvent(GpioEvent data) throws LinuxException
data - Where information about the event will be written.LinuxException - When something fails on the native side.public boolean waitForEvent(GpioEvent data, int timeout) throws LinuxException
timeout` milliseconds at most until a GPIO event occurs.data - Where information about the event will be written.timeout - A timeout in milliseconds where -1 means forever.LinuxException - When something fails on the native side.public void close()
throws LinuxException
The previously registered GPIO event handles WILL NOT be closed.
close in interface AutoCloseableLinuxException - When something fails on the native side.