See: Description
Class | Description |
---|---|
ScAdvancedSettings |
Advanced Settings of a device's parameters.
|
ScAdvSens |
A device's advanced sensitivity parameters.
|
ScBasicSettings |
Basic Settings of a device's parameters.
|
ScDevInfo |
This class is used for returning the device info back from a wrapper
function.
|
ScDevPars |
The complete device parameters.
|
ScDllWrapper |
This class wraps all functions of the SC DLL (Windows) or the
SC Shared Library (Linux) respectively and makes them accessible with Java,
using the Java Native Interface (JNI).
|
ScFunc |
This class holds all members needed for handling a function mapped to a
device's key.
|
ScKeyAssignment |
This class holds the assignment between a device's key and the function it
triggers.
|
ScLogPars |
This class is used for returning the logging parameters back from a wrapper
function or pass it to it.
|
ScOneBoolean |
This class is used for returning one boolean back from a wrapper function.
|
ScOneByte |
This class is used for returning one byte back from a wrapper function.
|
ScOneInt |
This class is used for returning one integer back from a wrapper function.
|
ScOneString |
This class is used for returning a string back from a wrapper function.
|
ScStdData |
This class is used for returning the standard data back from the wrapper
functions scFetchStdData() and scGetStdData.
|
ScThreeInts |
This class is used for returning three integers back from a wrapper function.
|
ScThreeStrings |
This class is used for returning three strings back from a wrapper function.
|
ScTwoInts |
This class is used for returning two integers back from a wrapper function.
|
ScTwoStrings |
This class is used for returning two strings back from a wrapper function.
|
Util |
The Util class contains some utility functions usable from anywhere in the
code.
|
Enum | Description |
---|---|
ScStatus | Deprecated
This enum is not longer necessary because all functions are void
now and throw exceptions.
|
Exception | Description |
---|---|
ScApplNotFoundEx |
This exception is thrown if an foreground application name is not found by the
SC daemon.
|
ScComErrEx |
This exception is thrown if the SC daemon detects a communication error
between itself and a SC device.
|
ScEx |
This class is the base class for all exceptions thrown by the DLL wrapper.
|
ScExecCmdErrEx |
This exception is thrown if the command can not be executed.
|
ScFileIoEx |
This exception is thrown if the SC daemon detects a file input/output error
This happens usually if saving or reading configuration data fails.
|
ScKeystrokeEx |
This exception is thrown if simulation of key press and release events fail.
|
ScNotSupportedEx |
This exception is thrown if the SC daemon is ordered to execute a command not
supported by the device.
|
ScParOutOfRangeEx |
This exception is thrown if a data parameter given to one of the wrapper
functions is out of range.
|
ScRegistryEx |
This exception is thrown if the SC daemon detects an error when accessing the
Windows registry.
|
ScThreadErrEx |
This exception is thrown if a callback thread in the API could not be created.
|
ScWrongDevIdxEx |
This Exception is thrown if the device index given as parameter to a wrapper
function is out of range.
|
ScWrongUserEx |
This exception is thrown if a user's application tries to connect with the
daemon, and the daemon's user is not the same as the application's user is.
|
Most that is said about the SC DLL (see its C++ documentation for details) applies for this wrapper. See there in case of ambiguities.
The JNI is rather unhandy with respect to returning function arguments. The functions in the SC DLL have a signature like
ScStatus scGetSens(int devIdx, int* transSensP, int* rotSensP)that is, they return a status code of type ScStatus as return value, accept a device index as input and return the interesting data in one or more reference variables. The last is not possible with Java because of the Java calling conventions:
int
, boolean
,
double
and so on are always
transferred to a function with the "call by value" standard.
Integer
, Double
,
String
etc. are immutable.
ScOneInt
,
ScTwoInts
, ScOneBoolean
etc.) wrapping the DLL's
return parameters needed. ScApplNotFoundEx
: Is thrown by scSetState2()
when an application name is given not known
by the daemon.
ScComErrEx
: Is thrown if a communication error has
occured. This can be if there is no
connection to the SC Daemon or the device
has needed too much time to answer.
ScFileIoEx
: Is thrown by scSaveDevPars()
only in case saving the device parameters
to file failed.
ScKeyStrokeEx
: Is thrown by scPressKey()
and
scRelKey()
when simulating
the key action failed.
ScParOutOfRangeEx
: Is thrown if an input parameter is out of
range.
ScRegistryEx
: Is thrown by the functions accessing the
Windows registry (not available with Linux).
ScWrongDevIdxEx
: Is thrown if a device index is given and
the device is not connected to the computer.
ScEx
. void scGetSens(int devIdx, ScTwoInts) throws ScExThe functions are realized as static methods of the ScDllWrapper class. The principle usage is therefore:
public void setSensitivity() { int devIdx = 0; ScTwoInts sens = new ScTwoInts(); sens.mVal1 = 10; // translational sensitivity to be set sens.mVal1 = 12; // rotational sensitivity to be set try { scSetSens(devIdx, sens); System.out.println("Act. trans. sens.: " + sens.mVal1); System.out.println("Act. rot. sens.: " + sens.mVal2); } catch (ScWrongDevIdxEx ex) { System.out.println("Wrong device index transferred."); } catch (ScParOutOfRangeEx ex) { System.out.println("Given parameter out of range."); } catch (ScComErrEx ex) { System.out.println("Communication error occured."); } }A minimal application getting data from the cap could be:
package spacecontrollerapitest; import de.spacecontrol.sc.dllwrapper.ScDllWrapper; import de.spacecontrol.sc.dllwrapper.ScEx; import de.spacecontrol.sc.dllwrapper.ScStdData; public class Main { public static void main(String[] args) { int devIdx = 0; int cnt = 0; ScStdData data = new ScStdData(); try { // connect to the driver: ScDllWrapper.scConnect2(true, null); // fetch data from the device in an endless loop: while (true) { try { ScDllWrapper.scFetchStdData(devIdx, data); System.out.println("y: " + data.mY + ", b: " + data.mB); } catch(ScEx ex) { // scFetchStdData() throws this Exception if no data is // received inert 30 ms; this is no error System.out.println("no data received"); } // our endlessness will last only 100 loop cycles: if (cnt++ == 100) break; } ScDllWrapper.scDisconnect(); } catch(ScEx ex) { System.out.println("scConnect() or scDisconnect() failed."); } } }For a more complete example see the C++ documentation mentioned above. Do not forget to add the library SC_DLL_Wrapper.jar to your project and place the spc_ctrlr_32.dll or spc_ctrlr_64.dll file resp. into your project folder.