Class EeicLibrary.I2cDevice

Object
I2cDevice
Enclosing class:
EeicLibrary

public static class EeicLibrary.I2cDevice
extends Object
The I2cDevice class is used to communicate with an external expansion device connected via I²C Interface.
Since:
2.00
  • Constructor Summary

    Constructors 
    Constructor Description
    I2cDevice()  
  • Method Summary

    Modifier and Type Method Description
    static boolean close()
    Close the I²C Interface Port
    static boolean open()
    Open the I²C Interface Port
    static boolean open​(int flags)
    Open the I²C Interface Port
    static int read​(byte[] buffer, int length)
    Read Data of a given length to a buffer from the I²C Interface Port.
    static boolean setSlaveAddress​(int address)
    Set the Slave Address to be used for Communication on the I²C Interface Port.
    static boolean write​(byte data)
    Write one single Byte of Data to the I²C Interface Port
    static boolean write​(byte[] buffer)
    Write Data from a buffer to the I²C Interface Port
    static boolean write​(byte[] buffer, int offset, int length)
    Write Data of a given length from a buffer to the I²C Interface Port, starting at the given offset.
  • Constructor Details

  • Method Details

    • open

      public static boolean open() throws RemoteException, UnsupportedOperationException
      Open the I²C Interface Port
      Returns:
      boolean: Returns true on success and false on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.
    • open

      public static boolean open​(int flags) throws RemoteException, UnsupportedOperationException
      Open the I²C Interface Port
      Parameters:
      flags - int: Specify additional flags for I²C Port Operation.
      Returns:
      boolean: Returns true on success and false on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.
    • close

      public static boolean close() throws RemoteException, UnsupportedOperationException
      Close the I²C Interface Port
      Returns:
      boolean: Returns true on success and false on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.
    • write

      public static boolean write​(byte data) throws RemoteException, UnsupportedOperationException
      Write one single Byte of Data to the I²C Interface Port
      Parameters:
      data - byte: Specify the data Byte to be written.
      Returns:
      boolean: Returns true on success and false on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.
    • write

      public static boolean write​(byte[] buffer) throws RemoteException, UnsupportedOperationException
      Write Data from a buffer to the I²C Interface Port
      Parameters:
      buffer - byte[]: Specify the data buffer to be written.
      Returns:
      boolean: Returns true on success and false on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.
    • write

      public static boolean write​(byte[] buffer, int offset, int length) throws RemoteException, UnsupportedOperationException
      Write Data of a given length from a buffer to the I²C Interface Port, starting at the given offset.
      Parameters:
      buffer - byte[]: Specify the data buffer to be written.
      offset - int: Specify the offset of the buffer at which the write operation will start.
      length - int: Specify the number of bytes to be written.
      Returns:
      boolean: Returns true on success and false on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.
    • read

      public static int read​(byte[] buffer, int length) throws RemoteException, UnsupportedOperationException, IllegalStateException
      Read Data of a given length to a buffer from the I²C Interface Port.
      Parameters:
      buffer - byte[]: Specify the data buffer holding the data being read from the I²C Interface Port.
      length - int: Specify the number of bytes to be read.
      Returns:
      int: Returns the number of read bytes on success and -1 on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.
      IllegalStateException - Gets thrown when the Library is not ready yet to accept method calls.
      In such case, please use onLibraryReady Method to add a callback which then processes this method. See API Notes of this class for further details.
    • setSlaveAddress

      public static boolean setSlaveAddress​(int address) throws RemoteException, UnsupportedOperationException
      Set the Slave Address to be used for Communication on the I²C Interface Port.
      Parameters:
      address - int: Specify the I²C Interface Port Slave Address to be used.
      Returns:
      boolean: Returns true on success and false on failure.
      Throws:
      RemoteException - Gets thrown when access to the system service fails.
      UnsupportedOperationException - Gets thrown when the current device does not support this method.