Interface GpioService
- All Known Implementing Classes:
UsbGpioService
public interface GpioService
Service API for manipulating GPIO.
- Version:
- 1.0
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptionvoidConfigure the GPIO direction of all GPIO addresses.voidconfigureWriteMask(BitSet set) Configure a bitmask to use on futureconfigureIoDirection(BitSet)orwriteAll(BitSet)calls.Get the device version information.getId()Get the ID of the device.booleanread(int address) Get the value of the GPIO address as a binary value.readAll()Read the value of all GPIO addresses.intreadAnalog(int address) Get the analog value of the GPIO address.voidset(int address, boolean value) Set the value of the GPIO address as a binary value.voidSet the ID of the device.voidSet the value of all GPIO addresses on enabled/disabled based on aBitSet.
-
Method Details
-
getDeviceVersion
Get the device version information.- Returns:
- the device version
- Throws:
IOException- if a communication error occurs
-
getId
Get the ID of the device.- Returns:
- the ID, an 8-character string
- Throws:
IOException- if a communication error occurs
-
setId
Set the ID of the device.- Parameters:
id- the ID to set: an 8-character string- Throws:
IOException- if a communication error occurs
-
read
Get the value of the GPIO address as a binary value.- Parameters:
address- the address, starting from 0, of the GPIO to get- Returns:
- true if the GPIO is on, otherwise false
- Throws:
IOException- if a communication error occurs
-
readAnalog
Get the analog value of the GPIO address.- Parameters:
address- the address- Returns:
- the analog value
- Throws:
IOException- if a communication error occurs
-
readAll
Read the value of all GPIO addresses.- Returns:
- the set of enabled GPIO addresses
- Throws:
IOException- if a communication error occurs
-
set
Set the value of the GPIO address as a binary value.- Parameters:
address- the address, starting from 0, of the GPIO to getvalue- true if the GPIO is on, otherwise false- Throws:
IOException- if a communication error occurs
-
writeAll
Set the value of all GPIO addresses on enabled/disabled based on aBitSet.- Parameters:
values- the value to set, with bit positions representing GPIO addresses- Throws:
IOException- if a communication error occurs
-
configureWriteMask
Configure a bitmask to use on futureconfigureIoDirection(BitSet)orwriteAll(BitSet)calls.- Parameters:
set- the GPIO addresses to enable for future operations, using bit positions- Throws:
IOException- if a communication error occurs
-
configureIoDirection
Configure the GPIO direction of all GPIO addresses.If a bit is enabled that means the coreponsing GPIO address should be configured as the input direction, otherwise as output.
- Parameters:
set- the GPIO addresses to configure as input, using bit positions- Throws:
IOException- if a communication error occurs
-