SpaceControl DLL  Version 2.8.9
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

◆ scGetLed()

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

Gets the brightness of a single LED.


Example:

int devIdx = 0;
int ledNo = 5;
int brightness;
ScStatus status = scGetLed(devIdx, ledNo, &brightness);
if (status == SC_OK)
printf("brightness of LED no. 5: %d\n", brightness);
else
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.

◆ scGetLedsEx()

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

Gets the brightnesses of all LEDs.


Example:

int devIdx = 0;
char brightness[LED_NUM];
ScStatus status = scGetLedsEx(devIdx, brightness);
if (status == SC_OK)
printf("brightness of LED with index 5: %d\n", brightness[5]);
else
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.

◆ scSetLed()

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

Sets and retrieves the brightness of a single LED.

Example:

int devIdx = 0;
int ledNo = 5;
int brightness = 10;
ScStatus status = scSetLed(devIdx, ledNo, &brightness);
if (status == SC_OK)
printf("brightness of LED no. 5: %d\n", brightness);
else
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.

◆ scSetLeds()

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:

int devIdx = 0;
int red = 15; // all red LEDs to maximum
int green = 5; // all green LEDs to 5
int blue = 0; // switch all blue LEDs off
ScStatus status = scSetLeds(devIdx, &red, &green, &blue);
if (status == SC_OK)
printf("red LED's brightness: %d\n", red);
else
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.

◆ scSetLedsEx()

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

Sets and retrieves the brightness of all LEDs.


Example:

int devIdx = 0;
char brightness[LED_NUM] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1, 2, 3 };
ScStatus status = scSetLedsEx(devIdx, brightness);
if (status == SC_OK)
printf("brightness of LED with index 5: %d\n", brightness[5]);
else
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 & Co. KG, Am Technologiepark 10, D-82229 Seefeld
Generated by Doxygen