Package com.casioeurope.mis.edt
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 Portstatic boolean
open()
Open the I²C Interface Portstatic boolean
open(int flags)
Open the I²C Interface Portstatic 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 Portstatic boolean
write(byte[] buffer)
Write Data from a buffer to the I²C Interface Portstatic 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
-
I2cDevice
public I2cDevice()
-
-
Method Details
-
open
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
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
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
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
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, UnsupportedOperationExceptionWrite 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, IllegalStateExceptionRead 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 useonLibraryReady
Method to add acallback
which then processes this method. See API Notes ofthis class
for further details.
-
setSlaveAddress
public static boolean setSlaveAddress(int address) throws RemoteException, UnsupportedOperationExceptionSet 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.
-