Package com.casioeurope.mis.edt
Class EeicLibrary
Object
EeicLibrary
public class EeicLibrary extends Object
The CASIO Enterprise Developer Tools External Expansion Interface Control (EEIC) Library
- Since:
- 2.00
- API Note:
- The External Expansion Interface Control (EEIC) Library is bound to the calling application on application startup time automatically.
The Library's lifecycle therefore depends on the application lifecycle.
Due to the Lifecycle of Android Applications and the underlying timing, it is strongly advised not to call any Library Methods inside theonCreate
method.
When the activity is being launched (and hence the process gets created), the same applies to theonStart
andonResume
methods.
If you need to call any Library methods at application start in one of the above mentioned methods, you should use theCallback
Mechanism offered by theonLibraryReady
method instead.
For instance, instead of callingEeicLibrary.SerialDevice.sendBreak()
directly inonCreate
, use this code to postpone it to aCallback
appropriately:
EeicLibrary.onLibraryReady(new LibraryCallback() { public void onLibraryReady() { EeicLibrary.SerialDevice.sendBreak(); } });
Which can be simplified to:
EeicLibrary.onLibraryReady(() -> { EeicLibrary.SerialDevice.sendBreak(); });
Or even further to:
EeicLibrary.onLibraryReady(EeicLibrary.SerialDevice::sendBreak);
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EeicLibrary.GpioDevice
The GpioDevice class is used to control general purpose input / output pinsstatic class
EeicLibrary.I2cDevice
The I2cDevice class is used to communicate with an external expansion device connected via I²C Interface.static class
EeicLibrary.InterruptCallback
This callback class called when an interrupt occurs.static class
EeicLibrary.SerialDevice
The SerialDevice class is used to communicate with an external expansion device connected via Serial Interface.static class
EeicLibrary.SpiDevice
The SpiDevice class is used to communicate with an external expansion device connected via the Serial Peripheral Interface (SPI). -
Method Summary
Modifier and Type Method Description static String
getLibraryVersion()
Gets the EEIC Library Version.static boolean
isMethodSupported(String methodName)
static boolean
isMethodSupported(BigInteger method)
Check whether theMethod
indicated by theBigInteger
method parameter is supported on the currently active devicestatic boolean
isPowerOn()
Gets the power status of the external expansion interface.static void
onLibraryReady(LibraryCallback callback)
Add a new Callback to the Queue of Callbacks to be processed once the EeicLibrary Service becomes availablestatic boolean
setPower(boolean enable)
Turns the power of the external expansion interface on and off.
-
Method Details
-
getLibraryVersion
public static String getLibraryVersion() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGets the EEIC Library Version.- Returns:
String
: Returns the String Representation of the EEIC Library Version currently being used, or null 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.
-
isPowerOn
public static boolean isPowerOn() throws RemoteException, UnsupportedOperationException, IllegalStateExceptionGets the power status of the external expansion interface.- 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.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.
-
setPower
public static boolean setPower(boolean enable) throws RemoteException, UnsupportedOperationExceptionTurns the power of the external expansion interface on and off.- Parameters:
enable
-boolean
: On/Off
Specify the power status of the external expansion interface.
Turn on with true, turn off with false.- 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.
-
isMethodSupported
Check whether theMethod
indicated by theBigInteger
method parameter is supported on the currently active device- Parameters:
method
-BigInteger
: Constant referencing the method to be checked- Returns:
boolean
:true
if the method is supported on the currently active device, otherwisefalse
- Throws:
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.
-
isMethodSupported
Check whether theMethod
indicated by theString
methodName parameter is supported on the currently active device- Parameters:
methodName
-String
: Name of the method to be checked- Returns:
boolean
:true
if the method is supported on the currently active device, otherwisefalse
- Throws:
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.
-
onLibraryReady
public static void onLibraryReady(LibraryCallback callback) throws RemoteException, UnsupportedOperationExceptionAdd a new Callback to the Queue of Callbacks to be processed once the EeicLibrary Service becomes available- Parameters:
callback
-LibraryCallback
: Instance of theLibraryCallback
Interface which holds theonLibraryReady()
Method which will get called once the regarding library becomes available- Throws:
RemoteException
- Gets thrown when access to the system service fails.UnsupportedOperationException
- Gets thrown when the current device does not support this method.
-