All Classes Functions Variables
com.agileinnovative.blinkstick.BlinkStick Class Reference

Public Member Functions

void setDevice (UsbDevice device)
 
UsbDevice getDevice ()
 
void setConnection (UsbDeviceConnection con)
 
int getVersionMajor ()
 
int getVersionMinor ()
 
BlinkStickDeviceEnum getBlinkStickDevice ()
 
void setBrightnessLimit (int value)
 
int getBrightnessLimit ()
 
boolean isConnected ()
 
void setColor (int r, int g, int b)
 
void setColor (byte r, byte g, byte b)
 
void setIndexedColor (int channel, int index, int r, int g, int b)
 
void setIndexedColor (byte channel, byte index, byte r, byte g, byte b)
 
void setIndexedColor (int channel, int index, int value)
 
void setIndexedColor (int index, int value)
 
void setColor (int value)
 
void setColor (String value)
 
void setRandomColor ()
 
void turnOff ()
 
int getColor ()
 
String getColorString ()
 
String getInfoBlock1 ()
 
String getInfoBlock2 ()
 
void setInfoBlock1 (String value)
 
void setInfoBlock2 (String value)
 
String getManufacturer ()
 
String getProduct ()
 
String getSerial ()
 
void setColors (byte[] colorData)
 
void setColors (int channel, byte[] colorData)
 
void setColors (byte channel, byte[] colorData)
 
void setMode (int mode)
 
void setMode (byte mode)
 
byte getMode ()
 

Static Protected Attributes

static final int STD_USB_REQUEST_GET_DESCRIPTOR = 0x06
 
static final int LIBUSB_DT_STRING = 0x03
 

Detailed Description

Class designed to communicate with BlinkStick devices.

Member Function Documentation

BlinkStickDeviceEnum com.agileinnovative.blinkstick.BlinkStick.getBlinkStickDevice ( )

Get BlinkStick device type

Returns
BlinkStick device type
int com.agileinnovative.blinkstick.BlinkStick.getBrightnessLimit ( )

Get the current brightness limit

Returns
the maximum amount of brightness for LEDs in the range of [0..255]
int com.agileinnovative.blinkstick.BlinkStick.getColor ( )

Get the current color of the device as int

Returns
The current color of the device as int
String com.agileinnovative.blinkstick.BlinkStick.getColorString ( )

Get the current color of the device in #rrggbb format

Returns
Returns the current color of the device as #rrggbb formated string
UsbDevice com.agileinnovative.blinkstick.BlinkStick.getDevice ( )

Get UsbDevice

Returns
USB device reference
String com.agileinnovative.blinkstick.BlinkStick.getInfoBlock1 ( )

Get value of InfoBlock1

Returns
The value of info block 1
String com.agileinnovative.blinkstick.BlinkStick.getInfoBlock2 ( )

Get value of InfoBlock2

Returns
The value of info block 2
String com.agileinnovative.blinkstick.BlinkStick.getManufacturer ( )

Get the manufacturer of the device

Returns
Returns the manufacturer name of the device
byte com.agileinnovative.blinkstick.BlinkStick.getMode ( )

Get the mode of BlinkStick Pro

Returns
0 - Normal, 1 - Inverse, 2 - WS2812, 3 - WS2812 mirror
String com.agileinnovative.blinkstick.BlinkStick.getProduct ( )

Get the product description of the device

Returns
Returns the product name of the device.
String com.agileinnovative.blinkstick.BlinkStick.getSerial ( )

Get the serial number of the device

Returns
Returns the serial number of device.
int com.agileinnovative.blinkstick.BlinkStick.getVersionMajor ( )

Get major version number from serial

Returns
Major version number as int
int com.agileinnovative.blinkstick.BlinkStick.getVersionMinor ( )

Get minor version number from serial

Returns
Minor version number as int
boolean com.agileinnovative.blinkstick.BlinkStick.isConnected ( )

Check if BlinkStick is connected

Returns
Returns true if BlinkStick is connected
void com.agileinnovative.blinkstick.BlinkStick.setBrightnessLimit ( int  value)

Set the brightness limit

Parameters
valuethe maximum amount of brightness for LEDs in the range of [0..255]
void com.agileinnovative.blinkstick.BlinkStick.setColor ( int  r,
int  g,
int  b 
)

Set the color of the device with separate r, g and b int values. The values are automatically converted to byte values

Parameters
rred int color value 0..255
ggree int color value 0..255
bblue int color value 0..255
void com.agileinnovative.blinkstick.BlinkStick.setColor ( byte  r,
byte  g,
byte  b 
)

Set the color of the device with separate r, g and b byte values

Parameters
rred byte color value 0..255
ggree byte color value 0..255
bblue byte color value 0..255
void com.agileinnovative.blinkstick.BlinkStick.setColor ( int  value)

Set the color of the device with Processing color value

Parameters
valuecolor as int
void com.agileinnovative.blinkstick.BlinkStick.setColor ( String  value)

Set the color of the device with string value

Parameters
valuethis can either be a named color "red", "green", "blue" and etc. or a hex color in #rrggbb format
void com.agileinnovative.blinkstick.BlinkStick.setColors ( byte[]  colorData)

Send a packet of data to LEDs on channel 0 (R)

Parameters
colorDataReport data must be a byte array in the following format: [g0, r0, b0, g1, r1, b1, g2, r2, b2 ...]
void com.agileinnovative.blinkstick.BlinkStick.setColors ( int  channel,
byte[]  colorData 
)

Send a packet of data to LEDs

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
colorDataReport data must be a byte array in the following format: [g0, r0, b0, g1, r1, b1, g2, r2, b2 ...]
void com.agileinnovative.blinkstick.BlinkStick.setColors ( byte  channel,
byte[]  colorData 
)

Send a packet of data to LEDs

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
colorDataReport data must be a byte array in the following format: [g0, r0, b0, g1, r1, b1, g2, r2, b2 ...]
void com.agileinnovative.blinkstick.BlinkStick.setConnection ( UsbDeviceConnection  con)

Assign USB device connection

Parameters
conConnection object to communicate with BlinkStick device
void com.agileinnovative.blinkstick.BlinkStick.setDevice ( UsbDevice  device)

Assign UsbDevice

Parameters
deviceobject to communicate directly with BlinkStick
void com.agileinnovative.blinkstick.BlinkStick.setIndexedColor ( int  channel,
int  index,
int  r,
int  g,
int  b 
)

Set indexed color of the device with separate r, g and b byte values for channel and LED index

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
rred int color value 0..255
ggree int color value 0..255
bblue int color value 0..255
void com.agileinnovative.blinkstick.BlinkStick.setIndexedColor ( byte  channel,
byte  index,
byte  r,
byte  g,
byte  b 
)

Set indexed color of the device with separate r, g and b byte values for channel and LED index

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
rred byte color value 0..255
ggree byte color value 0..255
bblue byte color value 0..255
void com.agileinnovative.blinkstick.BlinkStick.setIndexedColor ( int  channel,
int  index,
int  value 
)

Set the indexed color of BlinkStick Pro with Processing color value

Parameters
channelChannel (0 - R, 1 - G, 2 - B)
indexIndex of the LED
valuecolor as int
void com.agileinnovative.blinkstick.BlinkStick.setIndexedColor ( int  index,
int  value 
)

Set the indexed color of BlinkStick Pro with Processing color value for channel 0

Parameters
indexIndex of the LED
valuecolor as int
void com.agileinnovative.blinkstick.BlinkStick.setInfoBlock1 ( String  value)

Set value for InfoBlock1

Parameters
valueThe value to be written to the info block 1
void com.agileinnovative.blinkstick.BlinkStick.setInfoBlock2 ( String  value)

Set value for InfoBlock2

Parameters
valueThe value to be written to the info block 2
void com.agileinnovative.blinkstick.BlinkStick.setMode ( int  mode)

Set the mode of BlinkStick Pro as int

Parameters
mode0 - Normal, 1 - Inverse, 2 - WS2812, 3 - WS2812 mirror
void com.agileinnovative.blinkstick.BlinkStick.setMode ( byte  mode)

Set the mode of BlinkStick Pro as byte

Parameters
mode0 - Normal, 1 - Inverse, 2 - WS2812, 3 - WS2812 mirror
void com.agileinnovative.blinkstick.BlinkStick.setRandomColor ( )

Set random color

void com.agileinnovative.blinkstick.BlinkStick.turnOff ( )

Turn BlinkStick off


The documentation for this class was generated from the following file: