SpaceControl DLL
Version 2.8.9
API documentation for the SpaceControl 3D input devices
|
This group of functions is used for setting up the connection with the SpaceControl Daemon and handle special things where the daemon is involved, but not the devices. More...
Functions | |
ScStatus | scConnect2 (bool isAlwaysReceivingData, char *applName) |
Establishes the connection to the SpaceControl daemon. More... | |
ScStatus | scConnect () |
ScStatus | scDisconnect () |
Closes the connection to the SpaceControl daemon. More... | |
ScStatus | scStop () |
Sends the SpaceControl Daemon a stop message, the process finishes itself after sending an OK message. More... | |
ScStatus | scGetDmnVrsn (char *versionP, char *pathP) |
Retrieves the SpaceControl daemon's software version and its binary name and path. More... | |
ScStatus | scGetFgAppl (char *fgApplNameP, char *fgApplStateP) |
Retrieves the name and potentially the state of the foreground application. More... | |
ScStatus | scSetState2 (char *state) |
Informs the daemon about the internal state (mode) of a supported application. More... | |
ScStatus | scSetState (char *str1, char *str2) |
ScStatus | scGetDaemonPar (int par, int *val) |
Retrieves one of the integer or boolean parameters available in the Daemon's configuration file "daemon.ini". More... | |
ScStatus | scSetDaemonPar (int par, int *val) |
Sets one of the integer or boolean parameters available in the Daemon's configuration file "daemon.ini". More... | |
This group of functions is used for setting up the connection with the SpaceControl Daemon and handle special things where the daemon is involved, but not the devices.
ScStatus scConnect | ( | ) |
Establishes the connection to the SpaceControl daemon. If this function is not executed successfully no other DLL functions can be used.
Example:
References SC_COMMUNICATION_ERROR, and SC_OK.
Referenced by scConnect2().
ScStatus scConnect2 | ( | bool | isAlwaysReceivingData, |
char * | applName | ||
) |
Establishes the connection to the SpaceControl daemon.
If this function is not executed successfully no other DLL functions can be used.
Two parameters can be handed over:
Due to security riscs it is not possible to connect to a daemon started by another user as the one who started the application which has loaded the DLL; error SC_WRONG_USER is returned in this case.
Example:
isAlwaysReceivingData | if false the application will receive the standard data set only if it is in the foreground |
applName | your application's name; only needed if your application is a "supported application"; set it to NULL otherwise |
References MAX_STR_LEN, SC_OK, SC_PARAMETER_OUT_OF_RANGE, scConnect(), scSetState(), and UNNAMED_TRNS.
ScStatus scDisconnect | ( | ) |
Closes the connection to the SpaceControl daemon.
The daemon will destroy its proxy objects when receiving this message.
Example:
References SC_OK.
ScStatus scGetDaemonPar | ( | int | par, |
int * | val | ||
) |
Retrieves one of the integer or boolean parameters available in the Daemon's configuration file "daemon.ini".
Which one is requested is controlled by the first parameter par. It can have one of the values given in the enumeration DaemonPar. Boolean parameters are returned as 0 for false and 1 for true.
String parameters are not accessible for the time being.
Example:
par | the parameter you want to retrieve as defined in enumeration DaemonPar |
val | the parameter's current value |
References SC_COMMUNICATION_ERROR, and SC_OK.
ScStatus scGetDmnVrsn | ( | char * | versionP, |
char * | pathP | ||
) |
Retrieves the SpaceControl daemon's software version and its binary name and path.
Example:
versionP | pointer to the memory the version string is to be copied |
pathP | pointer to the memory the version string is to be copied |
References MAX_FILENAME_LEN, MAX_VERSION_LEN, SC_COMMUNICATION_ERROR, and SC_OK.
ScStatus scGetFgAppl | ( | char * | fgApplNameP, |
char * | fgApplStateP | ||
) |
Retrieves the name and potentially the state of the foreground application.
The daemon checks regularly which application is in the foreground. With this information the daemon loads automatically the appropriate configuration.
Some applications are better integrated into the daemon than others. These "supported applications" can tell its inner state, Pro/ENGINEER tells e. g. the mode ("drawing", "part" etc.) it is in. This state is returned in the second argument.
The foreground application's name (what is this?) is not easy to determine: You see the application's window, and you can get its so called window identifier. The task is to get an unambiguous application name out of this number, and that should work for all operating systems. The daemon uses the following strategy: Try to get the application's binary file name out of the window identifier and deliver this as the application's name. If this fails (this may happen under Linux because there is no direct connection between the window identifier and the application since the X server creates the window and not the application itself, and because the binary name may not be unambiguous [e.g. all Java applications are under control of the same runtime executable]) the window title is used as application name. Be aware that this is ambiguous too; many applications name their windows according to some content of the window and not to the application's name. Example:
fgApplNameP | pointer to the actual foreground application's name |
fgApplStateP | pointer to the actual foreground application's state |
References MAX_APPL_NAME_LEN, MAX_APPL_STATE_LEN, SC_COMMUNICATION_ERROR, and SC_OK.
ScStatus scSetDaemonPar | ( | int | par, |
int * | val | ||
) |
Sets one of the integer or boolean parameters available in the Daemon's configuration file "daemon.ini".
Which one is to be set is controlled by the first parameter par. It can have one of the values given in the enumeration DaemonPar. Boolean parameters are handed over as 0 for false ("off") and 1 for true ("on").
String parameters are not accessible for the time being.
Example:
par | the parameter you want to set as defined in enumeration DaemonPar |
val | the parameter's new value |
References SC_COMMUNICATION_ERROR, and SC_OK.
ScStatus scSetState | ( | char * | str1, |
char * | str2 | ||
) |
Informs the daemon about the internal state (mode) of a supported application. The daemon will load the appropriate configuration file. See also scGetFgAppl().
Example:
This function is also used to tell the daemon the name of the application when the parameter str2 is set to "initializing". In this case the parameter str1 is put into the list of communication partners, and the daemon can identify this application. If the daemon knows an application by name it will stop sending data to it when it is not in the foreground any longer. An application not known to the daemon will always receive data whether it is in the foreground or not.
So, if you don't want getting data into your application when in background: Figure out how the daemon will identify your application by starting the control panel and getting your application into the foreground. The control panel prints the identifier in the status bar besides the label "Active
Application:"; say, it states "MyApplication". Insert a statement
status = scState("MyApplication", "initializing");
into your code after your scConnect(), and the daemon knows to send data to your application only when it is in the foreground.
New extension since version 2.0.0:
To avoid sending data to a second instance of the same application (which has the same application name) you will have to provide the daemon with the process id of each instance. Append it to the application name, separated by a semicolon. Example with process id 1234:
status = scState("MyApplication;1234", "initializing");
You have to retrieve your processe's id at runtime, of course. See the Win32 API function GetCurrentProcessId().
Sorry for this unhandy interface; as you can see it is cobbled together a little.
str1 | name of the supported application |
str2 | state (mode) the supported application is in |
References MAX_STR_LEN, SC_APPL_NOT_FOUND, SC_COMMUNICATION_ERROR, SC_OK, SC_PARAMETER_OUT_OF_RANGE, SC_WRONG_DEVICE_INDEX, and SC_WRONG_USER.
Referenced by scConnect2().
ScStatus scSetState2 | ( | char * | state | ) |
Informs the daemon about the internal state (mode) of a supported application.
The driver will load the appropriate configuration file. The following conditions must be fulfilled that the driver can do this:
Example:
state | state (mode) the supported application is in |
References MAX_STR_LEN, SC_APPL_NOT_FOUND, SC_COMMUNICATION_ERROR, SC_OK, SC_PARAMETER_OUT_OF_RANGE, and SC_WRONG_DEVICE_INDEX.
ScStatus scStop | ( | ) |
Sends the SpaceControl Daemon a stop message, the process finishes itself after sending an OK message.
Example:
References SC_COMMUNICATION_ERROR, and SC_OK.
Copyright (c) SpaceControl GmbH & Co. KG, Am Technologiepark 10, D-82229 Seefeld |