Each GPIO port is identified by a numerical ID and optionally by a name.

A GPIO port is a platform-defined grouping of GPIO pins that may be configured for output or input. Output ports are
both writable and readable while input ports are only readable. Note that GPIO pins that are part of a GPIO port
cannot be retrieved nor controlled individually as GPIOPin instances.

Once opened, an application can obtain the current value of a GPIO port by calling the getValue() method and
set its value by calling the setValue(int) method.
A GPIO port has a minimum/maximum value range. The minimum value is zero. An application can check the maximum value
by calling getMaxValue() method. An attempt to set a GPIO port with a value that exceeds its maximum range
value will result in an IllegalArgumentException being thrown.

An application can either monitor a GPIO port value changes using polling or can register a PortListener
instance which will get asynchronously notified of any value changes. To register a PortListener instance,
the application must call the setInputListener(PortListener) method. The registered listener can later on be
removed by calling the same method with a null listener parameter. Asynchronous notification is only
supported for GPIO port configured for input. An attempt to set a listener on a GPIO port configured for output will
result in an UnsupportedOperationException being thrown.

When an application is no longer using a GPIO port it should call the GPIOPort.close() method to
close the GPIO port. Any further attempt to set or get the value of a GPIO port which has been closed will result in
a ClosedPeripheralException been thrown.

Note that the initial direction of a GPIO port which may be used for output or input as well as the initial value of
a GPIO port set for output is configuration-specific. An application should always initially set the GPIO port's
direction; or first query the GPIO port's direction then set it if necessary.

Note that the configuration may allow for some GPIO ports to be set by an application for either output or input
while others may be used for input only or output only and their direction cannot be changed by an application. Note
also that asynchronous notification of port value changes is only loosely tied to hardware-level interrupt requests.
The platform does not guarantee notification in a deterministic/timely manner.

getValue

Returns the current value of this GPIO port. The value returned should be interpreted as an unsigned 32-bit
integer. If the value was not set previously using setValue(int) the peripheral configuration-specific
default value is returned.

This method can be called on both output and input ports.

Returns:

the current value of this GPIO port.

Throws:

java.io.IOException - if an I/O error occurred such as the port is not readable.

A script enabled browser is required for this page to function properly.A script enabled browser is required for this page to function properly.A script enabled browser is required for this page to function properly.