public interface GpioBridge
| Modifier and Type | Method and Description |
|---|---|
Gpio |
getGpio(Pin pin,
Direction direction)
|
Signal |
readValue(Gpio gpio)
|
void |
register(Gpio gpio,
GpioSignalListener listener)
|
void |
start()
Starts the
GpioBridge's signal observing Thread. |
void |
stop()
Stops observing any pins and stops the
Thread |
boolean |
unregister(GpioBridgeTest gpio,
GpioSignalListener listener)
Unregisters a
GpioSignalListener from changes to the given Gpio |
void |
writeValue(Gpio gpio,
Signal signal)
|
void writeValue(Gpio gpio, Signal signal) throws GpioException
gpio - the Gpio to which the Signal should be writtensignal - the Signal to write to the given GpioGpioException - if the direction of the Gpio is not Direction.OUT, or if something goes wrong while
writing to the fileSignal readValue(Gpio gpio) throws GpioException
gpio - the Gpio for which the Signal should be readGpio's current signalGpioException - if the direction of the Gpio is not Direction.IN, or if something goes wrong while
reading from the filevoid start()
GpioBridge's signal observing Thread. If no observers are registered with the
register(Gpio, GpioSignalListener)-method, then this method needs not to be called.void stop()
ThreadGpio getGpio(Pin pin, Direction direction) throws GpioException
Returns the Gpio for the given Direction.
Note: This method can not be called multiple times with different Directions. The
GpioBridge does not handle pins that are simultaneously input and output as this is not supported by the
Linux kernel.
pin - The Pin for which the Gpio in the given Direction is to be returneddirection - the Direction for which this Gpio is to be returnedGpio with the configured DirectionGpioException - If the given Direction does not match the kernel's configured direction, or if the file
permissions are not set so that the Java process can access the file (read access for input pin,
write access for output pin.void register(Gpio gpio, GpioSignalListener listener) throws GpioException
gpio - the Gpio being observedlistener - the GpioSignalListener to be notified on changes on the Gpio's SignalGpioException - if the Direction of the Gpio is not Direction.INboolean unregister(GpioBridgeTest gpio, GpioSignalListener listener)
GpioSignalListener from changes to the given Gpiogpio - the Gpio for which the listener is to be removedlistener - the GpioSignalListener to be removed from changes to the given GpioCopyright © 2017. All rights reserved.