Interface GpioService

All Known Implementing Classes:
UsbGpioService

public interface GpioService
Service API for manipulating GPIO.
Version:
1.0
Author:
matt
  • Method Details

    • getDeviceVersion

      String getDeviceVersion() throws IOException
      Get the device version information.
      Returns:
      the device version
      Throws:
      IOException - if a communication error occurs
    • getId

      String getId() throws IOException
      Get the ID of the device.
      Returns:
      the ID, an 8-character string
      Throws:
      IOException - if a communication error occurs
    • setId

      void setId(String id) throws IOException
      Set the ID of the device.
      Parameters:
      id - the ID to set: an 8-character string
      Throws:
      IOException - if a communication error occurs
    • read

      boolean read(int address) throws IOException
      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

      int readAnalog(int address) throws IOException
      Get the analog value of the GPIO address.
      Parameters:
      address - the address
      Returns:
      the analog value
      Throws:
      IOException - if a communication error occurs
    • readAll

      BitSet readAll() throws IOException
      Read the value of all GPIO addresses.
      Returns:
      the set of enabled GPIO addresses
      Throws:
      IOException - if a communication error occurs
    • set

      void set(int address, boolean value) throws IOException
      Set the value of the GPIO address as a binary value.
      Parameters:
      address - the address, starting from 0, of the GPIO to get
      value - true if the GPIO is on, otherwise false
      Throws:
      IOException - if a communication error occurs
    • writeAll

      void writeAll(BitSet values) throws IOException
      Set the value of all GPIO addresses on enabled/disabled based on a BitSet.
      Parameters:
      values - the value to set, with bit positions representing GPIO addresses
      Throws:
      IOException - if a communication error occurs
    • configureWriteMask

      void configureWriteMask(BitSet set) throws IOException
      Configure a bitmask to use on future configureIoDirection(BitSet) or writeAll(BitSet) calls.
      Parameters:
      set - the GPIO addresses to enable for future operations, using bit positions
      Throws:
      IOException - if a communication error occurs
    • configureIoDirection

      void configureIoDirection(BitSet set) throws IOException
      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