public class

Blink1

extends Object
java.lang.Object
   ↳ thingm.blink1.Blink1

Summary

Public Constructors
Blink1()
Constructor.
Public Methods
void close()
Close blink(1) device
synchronized int command(int cmd, byte[] buf_send, byte[] buf_recv)
Do a transaction with the Blink1.
int enumerate()
(re)Enumerate the bus and return a count of blink(1) device found.
synchronized int fadeToRGB(int fadeMillis, int r, int g, int b)
Fade blink(1) to RGB color over fadeMillis milliseconds.
int fadeToRGB(int fadeMillis, Color c)
Fade blink(1) to RGB color over fadeMillis milliseconds.
int getCount()
String[] getDevicePaths()
Return the list of blink(1) device paths found by enumerate.
String[] getDeviceSerials()
Return the list of blink(1) device serials found by enumerate.
synchronized int getFirmwareVersion()
final static int log2lin(int n)
one attempt at a degamma curve.
static void main(String[] args)
Simple command-line demonstration
int open()
Open blink(1) device.
int openById(int id)
Open blink(1) device by blink(1) numerical id (0-getCount()).
int openByPath(String devicepath)
Open blink(1) device by USB path, may be different for each insertion.
int openBySerial(String serialnumber)
Open blink(1) device by blink(1) serial number.
final static void pause(int millis)
Utility: A simple delay
synchronized int play(boolean play, int pos)
synchronized int serverdown(boolean on, int millis)
synchronized int setRGB(int r, int g, int b)
Set blink(1) RGB color immediately
int setRGB(Color c)
Set blink(1) RGB color immediately
static void usage()
int writePatternLine(int fadeMillis, Color c, int pos)
Write a blink(1) light pattern entry
synchronized int writePatternLine(int fadeMillis, int r, int g, int b, int pos)
Write a blink(1) light pattern entry
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Blink1 ()

Constructor. Searches for plugged in blink(1) devices and populates internal caches.

Public Methods

public void close ()

Close blink(1) device

public synchronized int command (int cmd, byte[] buf_send, byte[] buf_recv)

Do a transaction with the Blink1. length of both byte arrays determines amount of data sent or received

Parameters
cmd The blink1 command code
buf_send Is byte array of command to send, may be null
buf_recv Is byte array of any receive data, may be null

public int enumerate ()

(re)Enumerate the bus and return a count of blink(1) device found.

public synchronized int fadeToRGB (int fadeMillis, int r, int g, int b)

Fade blink(1) to RGB color over fadeMillis milliseconds.

Parameters
fadeMillis Milliseconds to take to get to color
r Red component 0-255
g Green component 0-255
b Blue component 0-255

public int fadeToRGB (int fadeMillis, Color c)

Fade blink(1) to RGB color over fadeMillis milliseconds.

Parameters
fadeMillis Milliseconds to take to get to color
c Color to set

public int getCount ()

public String[] getDevicePaths ()

Return the list of blink(1) device paths found by enumerate.

public String[] getDeviceSerials ()

Return the list of blink(1) device serials found by enumerate.

public synchronized int getFirmwareVersion ()

public static final int log2lin (int n)

one attempt at a degamma curve. //FIXME: this is now in blink1-lib

Parameters
n

public static void main (String[] args)

Simple command-line demonstration

Parameters
args

public int open ()

Open blink(1) device. Stores open device id statically in native lib. Only one device can be open at once.

public int openById (int id)

Open blink(1) device by blink(1) numerical id (0-getCount()). Id list is ordered by serial number.

Parameters
id

public int openByPath (String devicepath)

Open blink(1) device by USB path, may be different for each insertion.

Parameters
devicepath

public int openBySerial (String serialnumber)

Open blink(1) device by blink(1) serial number.

Parameters
serialnumber

public static final void pause (int millis)

Utility: A simple delay

Parameters
millis

public synchronized int play (boolean play, int pos)

Parameters
play True to play, false to stop
pos Starting position to play from, 0 = start

public synchronized int serverdown (boolean on, int millis)

Parameters
on True = turn on serverdown mode, false = turn it off
millis Milliseconds until light pattern plays if not updated

public synchronized int setRGB (int r, int g, int b)

Set blink(1) RGB color immediately

Parameters
r Red component 0-255
g Green component 0-255
b Blue component 0-255

public int setRGB (Color c)

Set blink(1) RGB color immediately

Parameters
c Color to set

public static void usage ()

public int writePatternLine (int fadeMillis, Color c, int pos)

Write a blink(1) light pattern entry

Parameters
fadeMillis Milliseconds to take to get to color
c Color to set
pos Entry position 0-patt_max

public synchronized int writePatternLine (int fadeMillis, int r, int g, int b, int pos)

Write a blink(1) light pattern entry

Parameters
fadeMillis Milliseconds to take to get to color
r Red component 0-255
g Green component 0-255
b Blue component 0-255
pos Entry position 0-patt_max