SpaceControl DLL  Version 2.8.3
API documentation for the SpaceControl 3D input devices
Functions for handling the LEDs

These functions are used to set the brightness and color of all LEDs. More...

Functions

ScStatus scSetLeds (int devIdx, int *redP, int *greenP, int *blueP)
 Sets and retrieves the brightness of the device's blue LEDs. More...
 
ScStatus scGetLed (int devIdx, int ledNo, int *brightnessP)
 Gets the brightness of a single LED. More...
 
ScStatus scSetLed (int devIdx, int ledNo, int *brightnessP)
 Sets and retrieves the brightness of a single LED. More...
 
ScStatus scGetLedsEx (int devIdx, char brightness[LED_NUM])
 Gets the brightnesses of all LEDs. More...
 
ScStatus scSetLedsEx (int devIdx, char brightness[LED_NUM])
 Sets and retrieves the brightness of all LEDs. More...
 

Detailed Description

These functions are used to set the brightness and color of all LEDs.

Function Documentation

ScStatus scGetLed ( int  devIdx,
int  ledNo,
int *  brightnessP 
)

Gets the brightness of a single LED.


Example:

1 int devIdx = 0;
2 int ledNo = 5;
3 int brightness;
4 ScStatus status = scGetLed(devIdx, ledNo, &brightness);
5 if (status == SC_OK)
6  printf("brightness of LED no. 5: %d\n", brightness);
7 else
8  printf("error\n");
Parameters
devIdxthe index of the device to be requested
ledNothe index of the requested LED (0..32)
Return values
brightnessPbrightness of the requested LED
Returns
SC_OK, SC_COMMUNICATION_ERROR, SC_WRONG_DEVICE_INDEX

References LED_NUM, SC_COMMUNICATION_ERROR, SC_OK, SC_PARAMETER_OUT_OF_RANGE, and SC_WRONG_DEVICE_INDEX.

ScStatus scGetLedsEx ( int  devIdx,
char  brightness[LED_NUM] 
)

Gets the brightnesses of all LEDs.


Example:

1 int devIdx = 0;
2 char brightness[LED_NUM];
3 ScStatus status = scGetLedsEx(devIdx, brightness);
4 if (status == SC_OK)
5  printf("brightness of LED with index 5: %d\n", brightness[5]);
6 else
7  printf("error\n");
Parameters
devIdxthe index of the device to be requested
Return values
brightnessbuffer with the 33 brightness values (0..15 each)
Returns
SC_OK, SC_COMMUNICATION_ERROR, SC_WRONG_DEVICE_INDEX

References LED_NUM, SC_COMMUNICATION_ERROR, SC_OK, and SC_WRONG_DEVICE_INDEX.

ScStatus scSetLed ( int  devIdx,
int  ledNo,
int *  brightnessP 
)

Sets and retrieves the brightness of a single LED.

Example:

1 int devIdx = 0;
2 int ledNo = 5;
3 int brightness = 10;
4 ScStatus status = scSetLed(devIdx, ledNo, &brightness);
5 if (status == SC_OK)
6  printf("brightness of LED no. 5: %d\n", brightness);
7 else
8  printf("error\n");
Parameters
devIdxthe index of the device the data is to be set
ledNothe number of the LED to be set (0..32)
Return values
brightnessPbrightness the LED is to be set to (0..15)
Returns
SC_OK, SC_COMMUNICATION_ERROR, SC_WRONG_DEVICE_INDEX, SC_PARAMETER_OUT_OF_RANGE

References LED_NUM, MAX_BRIGHTNESS, MIN_BRIGHTNESS, SC_COMMUNICATION_ERROR, SC_OK, SC_PARAMETER_OUT_OF_RANGE, and SC_WRONG_DEVICE_INDEX.

ScStatus scSetLeds ( int  devIdx,
int *  redP,
int *  greenP,
int *  blueP 
)

Sets and retrieves the brightness of the device's blue LEDs.

Hint: There is an optimization done in the daemon: The daemon stores the last set brightness and sends a new brightness to the device only in case the brightness has changed. But, there is a special case in the GUI where it is necessary to really set the brightness even if the brightness values are the same as before. This can be achieved by adding the value of 20 (FORCE_SET_BRIGHTNESS) to the wanted value (of course this is an unaesthetic workaround and should be replaced by an extra parameter). Example:

1 int devIdx = 0;
2 int red = 15; // all red LEDs to maximum
3 int green = 5; // all green LEDs to 5
4 int blue = 0; // switch all blue LEDs off
5 ScStatus status = scSetLeds(devIdx, &red, &green, &blue);
6 if (status == SC_OK)
7  printf("red LED's brightness: %d\n", red);
8 else
9  printf("error\n");
Parameters
devIdxthe index of the device the data is to be set
Return values
redPbrightness of the red LEDs (this parameter is obsolete and will be ignored)
greenPbrightness of the green LEDs (this parameter is obsolete and will be ignored)
bluePbrightness of the blue LEDs
Returns
SC_OK, SC_COMMUNICATION_ERROR, SC_WRONG_DEVICE_INDEX, SC_PARAMETER_OUT_OF_RANGE

References FORCE_SET_BRIGHTNESS, MIN_BRIGHTNESS, NO_BRGHT_CHANGE, SC_COMMUNICATION_ERROR, SC_OK, SC_PARAMETER_OUT_OF_RANGE, and SC_WRONG_DEVICE_INDEX.

ScStatus scSetLedsEx ( int  devIdx,
char  brightness[LED_NUM] 
)

Sets and retrieves the brightness of all LEDs.


Example:

1 int devIdx = 0;
2 char brightness[LED_NUM] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
3  1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
4  1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
5  1, 2, 3 };
6 ScStatus status = scSetLedsEx(devIdx, brightness);
7 if (status == SC_OK)
8  printf("brightness of LED with index 5: %d\n", brightness[5]);
9 else
10  printf("error\n");
Parameters
devIdxthe index of the device to be requested
Return values
brightnessbuffer with the 33 brightness values (0..15 each or NO_BRGHT_CHANGE)
Returns
SC_OK, SC_COMMUNICATION_ERROR, SC_WRONG_DEVICE_INDEX

References LED_NUM, MIN_BRIGHTNESS, NO_BRGHT_CHANGE, SC_COMMUNICATION_ERROR, SC_OK, SC_PARAMETER_OUT_OF_RANGE, and SC_WRONG_DEVICE_INDEX.

SC DLL

SpaceControl Copyright (c) SpaceControl GmbH, Am Technologiepark 10, D-82229 Seefeld
Generated by Doxygen