Package com.casioeurope.mis.edt
Class EeicLibrary.SpiDevice
Object
SpiDevice
- Enclosing class:
- EeicLibrary
public static class EeicLibrary.SpiDevice extends Object
The SpiDevice class is used to communicate with an external expansion device connected via the Serial Peripheral Interface (SPI).
- Since:
- 2.00
-
Constructor Summary
Constructors Constructor Description SpiDevice()
-
Method Summary
Modifier and Type Method Description static boolean
close()
Close the SPI Portstatic boolean
open()
Open the SPI Portstatic boolean
open(int flags)
Open the SPI Portstatic int
read(byte[] buffer, int length)
Read Data of a given length to a buffer from the SPI Port.static boolean
write(byte data)
Write one single Byte of Data to the SPI Portstatic boolean
write(byte[] buffer)
Write Data from a buffer to the SPI Portstatic boolean
write(byte[] buffer, int offset, int length)
Write Data of a given length from a buffer to the SPI Port, starting at the given offset.
-
Constructor Details
-
SpiDevice
public SpiDevice()
-
-
Method Details
-
open
Open the SPI 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 SPI Port- Parameters:
flags
-int
: Specify additional flags for SPI 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 SPI 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 SPI 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 SPI 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 SPI 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 SPI Port.- Parameters:
buffer
-byte[]
: Specify the data buffer holding the data being read from the SPI 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.
-