Skip to content

allanmc/java-cue-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Corsair CUE SDK wrapper for Java

Description

This wrapper is based on an JNA interface generated by JNAerator.

The CueSDK class provides some helper methods to access the most common needs from the native SDK, simplifying handling arrays of structs, etc.

Usage Example

package dk.allanmc.test;

import dk.allanmc.cuesdk.LedColor;
import dk.allanmc.cuesdk.CueSDK;

public class CueSDKExample {
    public static void main(String[] args) throws InterruptedException {
        // Establish connection with device
        final CueSDK cue = new CueSDK(true);

        // Set LED of the Enter key to red
        cue.setLedColor(new LedColor(LedId.CLK_Enter, 255, 0, 0));
        // Set LED of the left Shift key to green
        cue.setLedColor(new LedColor(LedId.CLK_RightShift, Color.GREEN));

        // Set color of multiple keys at the same time
        cue.setLedsColors(Arrays.asList(
                new LedColor(LedId.CLK_W, Color.YELLOW),
                new LedColor(LedId.CLK_A, Color.YELLOW),
                new LedColor(LedId.CLK_S, Color.YELLOW),
                new LedColor(LedId.CLK_D, Color.YELLOW)
        ));

        // Wait some time before exiting, so we can see the LEDs.
        Thread.sleep(1000);
    }

}

Reference

public CueSDK()

Instantiates a new CueSDK, and establishes a connection to the Corsair SDK with shared control.

public CueSDK(boolean exclusiveLightingControl)

Instantiates a new CueSDK, and establishes a connection to the Corsair SDK with shared or exclusive control.

  • Parameters: exclusiveLightingControl — Whether exclusive light control is needed or not.
public int getDeviceCount()

Get the number of connected devices compatible with the Corsair CUE SDK.

  • Returns: number of devices
public DeviceInfo getDeviceInfo(int deviceIndex)

Retrieve information about a connected device.

  • Parameters: deviceIndex — Index of the connected device to get information about
  • Returns: device information
public List<LedPosition> getLedPositions()

Retrieve a list of available LED positions, including their id and physical properties.

  • Returns: list of LED details
public void setLedsColors(Collection<LedColor> ledColors)

Set the color af several LED at the same time.

  • Parameters: ledColors — List of LED identifiers and colors
public void setLedColor(LedColor ledColor)

Set the color of a single LED.

  • Parameters: ledColor — LED identifier and color

About

Corsair CUE SDK wrapper for Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages