Package com.casioeurope.mis.edt
Class EeicLibrary.SerialDevice
Object
SerialDevice
- Enclosing class:
- EeicLibrary
public static class EeicLibrary.SerialDevice extends Object
The SerialDevice class is used to communicate with an external expansion device connected via Serial Interface.
- Since:
- 2.00
-
Constructor Summary
Constructors Constructor Description SerialDevice()
-
Method Summary
Modifier and Type Method Description static boolean
close()
Close the Serial Interface Portstatic boolean
open(int baudrate)
Open the Serial Interface Portstatic boolean
open(int baudrate, int flags, boolean hwflow, int bitLen, int parityBit, int stopBit)
Open the Serial Interface Portstatic boolean
open(int baudrate, int bitLen, int parityBit, int stopBit)
Open the Serial Interface Portstatic int
read(byte[] buffer, int length)
Read Data of a given length to a buffer from the Serial Interface Port.static boolean
sendBreak()
Send a "break" command to the Serial Interface Port.static boolean
write(byte data)
Write one single Byte of Data to the Serial Interface Portstatic boolean
write(byte[] buffer)
Write Data from a buffer to the Serial Interface Portstatic boolean
write(byte[] buffer, int offset, int length)
Write Data of a given length from a buffer to the Serial Interface Port, starting at the given offset.
-
Constructor Details
-
SerialDevice
public SerialDevice()
-
-
Method Details
-
open
public static boolean open(int baudrate, int flags, boolean hwflow, int bitLen, int parityBit, int stopBit) throws RemoteException, UnsupportedOperationExceptionOpen the Serial Interface Port- Parameters:
baudrate
-int
: Specify the baud rate.
SeeSERIAL_DEVICE Constants
for detailsflags
-int
: Specify additional flags for Serial Port Operation.hwflow
-int
: Specify Hardware Flow Control Settings.bitLen
-int
: Specify 7 or 8 bit word lenght. SeeSERIAL_DEVICE Constants
for detailsparityBit
-int
: Specify Parity Bit (None/Even/Odd). SeeSERIAL_DEVICE Constants
for detailsstopBit
-int
: Specify Stopbit (1/2). SeeSERIAL_DEVICE Constants
for details- 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 baudrate, int bitLen, int parityBit, int stopBit) throws RemoteException, UnsupportedOperationExceptionOpen the Serial Interface Port- Parameters:
baudrate
-int
: Specify the baud rate.
SeeSERIAL_DEVICE Constants
for detailsbitLen
-int
: Specify 7 or 8 bit word lenght. SeeSERIAL_DEVICE Constants
for detailsparityBit
-int
: Specify Parity Bit (None/Even/Odd). SeeSERIAL_DEVICE Constants
for detailsstopBit
-int
: Specify Stopbit (1/2). SeeSERIAL_DEVICE Constants
for details- 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 Serial Interface Port- Parameters:
baudrate
-int
: Specify the baud rate.
SeeSERIAL_DEVICE Constants
for details- 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 Serial 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 Serial 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 Serial 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 Serial 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 Serial Interface Port.- Parameters:
buffer
-byte[]
: Specify the data buffer holding the data being read from the Serial 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.
-
sendBreak
Send a "break" command to the Serial 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.
-